• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bunch of questions - near the end...

 
Piotr Nowicki
Ranch Hand
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy Ranchers!

I think I'm close to the end of my project if it comes to the coding and commenting part. However I have some questions I hope you will help me with :-)

1. Eclipse sometimes (when the line has a little more than 80 columns, say 81 or 82) doesn't split the line into two.
In SCJD - does the single line has to be solid 80 columns and not a single one more? Did you guys was very adequate with this?

2. Did you use case insensitive searching in your Data class (how about business logic layer?)?

3. What did you put in your File menu in client GUI? Did you add a link to your user manual (BTW: your user manual was a HTML or embedded into the application?)

4. Did you business logic layer (or Data layer) is protected against typing a customer ID less than 8 character? I am not talking about the presentation layer validations but rather about the BLL/DAO layers.

5. If an exception occurs in GUI I am poping up an alert. As an addition I use System.err (or e.printStackTrace) to print error in the console (no loggers on the client side). Do you think this is fine or rather wrong approach?

6. Did you use static final Strings for the messages in the GUI? Or did you use ResourceBundle? Did you have any parametrized messages?

Thanks in advance for your opinion.

Cheers!
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fast answers:

1/ I adapted Eclipse formatter to coding conventions a bit (80 chars per line was not altered), every java file was formatted using this formatter (and I didn't count the chars to see if it actually was 80 chars per line )

2/ in dao case insensitive search, in business layer exact matching (as required by the instructions)

3/ file menu has only an "Exit" menu-item (my manual is plain text, no html)

4/ in business layer if you pass an invalid customer id, an IllegalArgumentException will be thrown. in dao only database schema validations are executed (number of fields, field length,...)

5/ I only used a message in a popup, no logging to console or loggers (because this was not required, nor described)

6/ I used static final Strings (no parametrized messages)
 
Piotr Nowicki
Ranch Hand
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Roel - it helped me a lot :-)

Roel De Nijs wrote:1/ I adapted Eclipse formatter to coding conventions a bit (80 chars per line was not altered), every java file was formatted using this formatter (and I didn't count the chars to see if it actually was 80 chars per line )

I have also my slighly modified code formatter based strictly on Java code conventions. You know - there is a 'show print margin' option in Eclipse, so you don't have to count the characters

So, I'll better get going to clean up my messages and see what did I forgot about

Cheers!
 
Piotr Nowicki
Ranch Hand
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Next part of problems Guys! :-)

1. Did you cope with the problem of re-registering RMI service? I mean did you prepare yourself for following scenario:

Server: startup
Client: runs application and connects to the Server
Server: shutdown
Server: startup
Client: search for records
??? - most likely connection error, because the location of remote object (service) has been changed.

2. Did you provide tips for every text field?

3. My interface is waiting for the cookie to update / delete / unlock of the record. My implementation creates a deadlock if ONE thread blocks twice the same record one after another, like:

T1: lock RecNo 2
T1: lock RecNo 2
<deadlock>

Because I have a three layer architecture, the locks are managed by the business logic layer. The possibility of a deadlock can occur only if the programmer will not obey to the rules. Normal client / user of the business logic cannot create such a deadlock.

Should I be worried about that and work on it, or can I safely leave it that way?

4. Did you inform the user (in GUI) about how the filter works (logical AND, OR, exact match) or did you put it only in the user manual?

5. I am using a as a mechanism for generating lock cookie. As far as I know, the first execution of Math.random() creates a generator with particular seed, and every following executions use the create generator to get pseudo-random numbers. In my opinion if the generator is reused, and the value is multiplied by the range of LONG it is enough for the SCJD if it comes to randomization. What do you think?

6. Firstly in my data class in long create(-) method I didn't throw DuplicateKeyException. By "throw" I mean that literally I didn't add "throws DuplicateKeyException" to the method signature. I assumed that this is still a valid implementation of the interface, as reducing number of exceptions is perfectly legal when overriding / implementing methods. After some thinking I decided to add the "throws DuplicateKeyException" to the method signature but remain with the idea of not actually throwing the exception from the method body.

I changed my mind, because I thought, that if they have a some kind of framework where they tests how the data class is working, they might have a catch block which will catch the DuplicateKeyException. If the method signature is not throwing it, it will not even compile, as it is a checked exception.

This is why I decided to finally just add the throws declaration to my create method signature in the data class.

Do you think it is a right choice?

7. I do not plan to add the 48 hours rule in my project.


Off Topic: be careful kids - SimpleDateFormatters are not thread-safe and can really mess your day ;-)))

Cheers!
 
Jason Then
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel, where does the data layer search specify case-insensitive?
I think it specifies String.startsWith() behaviour, but not case-insensitive.

For example, "Fred" matches "Fred" or "Freddy"...
But "fred" does not match "Fred" or "Freddy".

Yes, the GUI should match on exact matches only.

As for your other questions Pedro...

1. Yes, I popup an error in this case. The client will need to restart, or reconnect to the server via options.

2. Yes, I used tooltips where possible.

3. Yes, mine also deadlocks in this scenario. It's a programmer error, rather than an application fault, so I think this is ok. I talked about it in choices.txt.

4. I only put the details in the user manual.

5. I use System.nanoTime().

6. I don't throw DuplicateKeyException - the primary key is the record number and this is not held within the data.

7. Me neither.

Re: SimpleDateFormat, yeah I realised this - it can bite you if you store one of these in a final static field. So now I only store the format string, and create a new instance everytime

Cheers,
Jason
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jason Then wrote:Roel, where does the data layer search specify case-insensitive?
Just my own decision


Fast answers on Pedro's other questions:

1/ An error dialog will be shown

2/ Yes

3/ If a client tries to lock the same record again (or another record if it is already locking a record) an IllegalStateException is thrown. Like Jason already said: it's a developer's error (so the IllegalStateException is not caught)

4/ That's why you have a user manual

5/ System.nanoTime()

6/ no DuplicateKeyException is thrown from create method, but the method signature has a throws-clause

7/ Me neither

I don't use SimpleDateFormat The dates are just handled as Strings, simply because they can not be altered
 
Piotr Nowicki
Ranch Hand
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Guys for your fast response :-)

@Roel, AD. 3 - in your version of the DB interface did you have to recognize the users? I mean, that's the only idea I can come up with to get know what user blocked which record while being inside the lock method to throw an appropriate exception then.

@Jason, AD SimpleDateFormat - that's exactly what I did :-) Firstly it was my static final field of RoomUtils class but during unit testing I've got some seriously strange messages like: "NumberFormatException - cannot parse date '2005/07/27' [or insert any other perfectly legal date here]". So moving only the date format string as a final static field was also my choice to solve this problem :-))
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pedro Kowalski wrote:@Roel, AD. 3 - in your version of the DB interface did you have to recognize the users? I mean, that's the only idea I can come up with to get know what user blocked which record while being inside the lock method to throw an appropriate exception then.

I don't have a lockCookie in my interface, so I have my own client identification mechanism which makes it very easy to intercept a client trying to lock more than 1 record at a time
 
Piotr Nowicki
Ranch Hand
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys, did you provide user manual in a txt or HTML format? With or without screenshots?
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
plain text, no pictures
 
Piotr Nowicki
Ranch Hand
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:plain text, no pictures


Faster than the ligthning ;-) Thanks!
 
Piotr Nowicki
Ranch Hand
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

1. What file headers did you add? I mean this /* */ section when the file begins...

Could someone post their actual header? Did you add your prometric ID there?

2. If I understand this correctly - I need to first pass the essay before submitting the assignment?

3. What level did you use for javadoc generation? Only public, above packet, above protected, ...?
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1/ I used a file header like the one used by Roberto in his data class test (prometric id included)

2/ You don't have to pass the essay exam, you just have to take the essay exam. But I don't know if the order of submission and taking essay exam is important. I submitted the assignment first and then took the essay exam (but that was during the pre-Oracle days)

3/ "above packet" That's a level I don't know Because I have a lot of package-private classes, I decided to use package level for javadoc generation. Normally generating javadoc for public classes and members will do
 
Piotr Nowicki
Ranch Hand
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Roel!

AD 3. You're quite fussy Roel, aren't you? ;-)) Of course I meant a package level :-)

BTW. In Polish, 'package' word is translated as 'pakiet', which also means 'packet' :-)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic