Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passed SCJD URLyBird 1.1.2 398/400

 
Alecsandru Cocarla
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just received my results today - 398/400.
Both points were lost on general considerations.

I'm really happy, and I just wanted to brag a little bit about it (although, it's true, I expected a full 400/400 )
I don't have the time right now to write details about my implementation, but I promise I'll come back with them in a day or two.

Many thanks to all those who wrote on this forum, now or in the past!
 
Jari Timonen
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alecsandru Cocarla wrote:I just received my results today - 398/400.
Both points were lost on general considerations.

I'm really happy, and I just wanted to brag a little bit about it (although, it's true, I expected a full 400/400 )
I don't have the time right now to write details about my implementation, but I promise I'll come back with them in a day or two.

Many thanks to all those who wrote on this forum, now or in the past!


 
Anne Crace
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should brag... a lot! That is quite an accomplishment.
 
Alecsandru Cocarla
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As promised, some details about my implementation:

- Three layers architecture.
- Used RoomVacancy DTO instead of plain String[].
- Data class is a Facade, it's not a Singleton. However, it delegates to the two singletons of my application: RecordLockManager and DataFileAccessManager
- I added runtime exceptions to the DB interface, whenever I felt like I should - for example I added DatabaseAccessException. No error codes, no wrapping of IOException in RecordNotFoundException.
- No record cache. All calls execute directly on the database.
- One RandomAccessFile, all calls which read or update the file are synchronized on this instance.
- The record number is the primary key
- Deadlocks avoided by specification included in the DB's interface javadoc (the lock() method). My services always lock one record at a time.
- I had a RecordFormat class containing constants about the field lengths. The database schema is not read or updated dynamically.
- One lock per record, without hand-over-hand (see http://www.coderanch.com/t/418337/Developer-Certification-SCJD/certification/locking-Hand-over-hand-remove for details)
- Only System.nanoTime() used for cookie (no random stuff)
- Filtering: by name, by location, or by (name AND location). No filtering by (name OR location) provided.
- Filtering only bookable rooms was provided - bookable = not booked, in the future and obeying the 48 hours rule. This rule was implemented in the business layer.
- RoomVacancyFilter object used instead of separate filtering parameters or String[].
- User is not able to book non-bookable rooms (but can see them all).
- In order to avoid RemoteException in my local services implementation, I chose the following design: Services interface, declaring RemoteExceptions. The LocalServices interface extends Services, but without the RemoteException. The LocalServicesImpl impements LocalServices. The RemoteServices extends both Services and java.rmi.Remote.
- Networking with RMI
- MVC inspired by HMVC, but seriously changed and modified for my project's needs. http://www.javaworld.com/javaworld/jw-07-2000/jw-0721-hmvc.html - I recommend this reading!
- M, V and C clearly separated. Almost all Swing code is in Views. The Model does not contain Swing code at all (no table models, no Documents).
- Used Actions instead of ActionListeners wherever possible.
- No background threads, everything happens in the dispatcher thread.
- Hardcoded labels and messages.
- Implemented a PositiveIntegerDocument, which only allows positive integer input from zero up to a configurable maximum value. This is quite different from the one in the book, in that it does not allow any errors like the ones described in http://www.coderanch.com/t/418338/Developer-Certification-SCJD/certification/Errors-SCJD-Exam-with-JSE - point 6.
- Tooltips and mnemonics for everything.
- Status bar and menu bar.
- Table was not sortable.
- A lot of care for testing what happens with the GUI when various errors happen. You can make your code throw exceptions in various places and see if your GUI can handle it.
- Used the default Java 6 look and feel
- Programming to interfaces - almost everything has an interface. My project has more than 60 java files, and probably around 1/3 are interfaces.
- Documentation - no method or class without complete javadoc (method, parameters, return values, exceptions). Javadoc generated for protected level.
- Logged everything, with configurable loggers.
- Unit tests for almost everything except GUI. Here are some of them: http://www.coderanch.com/t/418342/Developer-Certification-SCJD/certification/Data-class-multithreaded-load-test
- Application was tested on Windows and Linux, Linux makes it easier to test what happens when you don't have writing rights for the current directory.
- User guide (html) was quite a complete description/specification of the application: from prerequisites, running, general workings of the application (like what's a mnemonic, what TAB key does, how to access the menu bar using keyboard etc) to the various screens functionality, with screenshots.

If you have any questions, feel free to ask.
 
Roel De Nijs
Sheriff
Posts: 9807
101
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Congratulations Alecsandru

could you give a little example of how you declared a method in each interface, because i'm getting a bit confused of your explanation

In order to avoid RemoteException in my local services implementation, I chose the following design: Services interface, declaring RemoteExceptions. The LocalServices interface extends Services, but without the RemoteException. The LocalServicesImpl impements LocalServices. The RemoteServices extends both Services and java.rmi.Remote.


 
Alecsandru Cocarla
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just an example:

 
Roel De Nijs
Sheriff
Posts: 9807
101
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alecsandru,

Thanks for the example. I just had to think a little bit harder myself and i would have discovered the overridden method myself

But why not just use Services for both the local and the remote interface. because an exception in the method declaration indicates that the method could throw that exception but is not a must

Hoping to score a little bit, better than you: i would say 2 points, or maybe 3 points to make it even more unbelievable

Kind regards,
Roel
 
Alecsandru Cocarla
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:Alecsandru,
But why not just use Services for both the local and the remote interface. because an exception in the method declaration indicates that the method could throw that exception but is not a must

Because I did not want my local services implementation to depend on RemoteException at all. At any moment, I can throw away the Services interface, and just use LocalService as my main interface, if needed.

Anyway, it's just a matter of taste, I guess...

Thanks for the congratulations! (not only you, but to all those who wrote here )
 
mohamed sulibi
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Congratulations

best regards
Mohamed Sulibi (from 1/8/2007 till now)
 
Roel De Nijs
Sheriff
Posts: 9807
101
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alecsandru Cocarla wrote:
I can throw away the Services interface


I guess that you have somewhere in your code
Services services = (appMode="standalone"?getLocalClient():getRemoteClient());

or something a bit more readible then throwing the Services-interface would be a little bit stupid? or did you work with LocalServices and RemoteServices in your client?

And another question: did you expose locking methods to the client? or did you just used a bookRoom and findRooms method?
 
Alain Dickson
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Congrats Alecsandru

I have a quick question: Did allow user to search for any name and any location i.e (load all records into JTable)?

Alain
 
Bert Bates
author
Sheriff
Posts: 8898
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
congrats -

off to the results forum
 
Krishna Srinivasan
Ranch Hand
Posts: 1862
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
congrats!!
 
Alecsandru Cocarla
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:
I guess that you have somewhere in your code
Services services = (appMode="standalone"?getLocalClient():getRemoteClient());

or something a bit more readible then throwing the Services-interface would be a little bit stupid? or did you work with LocalServices and RemoteServices in your client?

Of course, my client code depends on RemoteException. Throwing away the Services interface cannot easily be achieved within the current application, since I'm using RMI anyway. But, at any time, I could use LocalServices for something else, which does not work with RMI.

Anyway, my main concern was to have an interface for my local implementation which does not depend on RemoteException, just because I felt like this is how it should be...
Roel De Nijs wrote:
And another question: did you expose locking methods to the client? or did you just used a bookRoom and findRooms method?

Of course not. Why would I have a three layer architecture then?

Alain Dickson wrote:I have a quick question: Did allow user to search for any name and any location i.e (load all records into JTable)?

Yes. As I said - the user can see any records, just can't book all of them.
 
Roel De Nijs
Sheriff
Posts: 9807
101
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alecsandru Cocarla wrote:
Of course not. Why would I have a three layer architecture then?


It was just a question regarding some remarks Andrew Monkhouse made because i was planning to create a business layer with a bookRoom and findRooms method.

you don't really have a 3 tier system - you have a 2 tier system where you have logically put the business logic in the same tier as the database. You may have separated the business logic into it's own packages (which would be a good thing), but that in itself doesn't make it a 3 tier system. You could similarly have the business logic in it's own package in a thick client system (which would allow for reuse).


And also regarding this thread.
 
Alecsandru Cocarla
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I think I've read that thread some time ago... But I decided to stick to a 3 layer architecture. And lock methods are not provided in my Services interface. I had something like find(), book(), isBookable() and getRoomVacancy(id) in this interface.
 
thuy nguyen
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Congratulations!

When did you submit your project? I did mine, took essay 6 weeks ago but still not heard back from them.
 
Alecsandru Cocarla
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had my essay in January, and got the results back in exactly 4 weeks.
What I did is sent them an email right after the essay exam, requesting to know if everything went all right (upload), and informing about my taking the essay exam. I don't know if sending this email helped in a faster grading...
 
Leandro Coutinho
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amazing!!!

What was your strategy to change the jpanels? Did you use CardLayout?
 
Naveen Narayanan
Ranch Hand
Posts: 114
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Congratz
 
Juee Doo
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
congratulations
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Congrats on the passing. URLyBird is tough!

-Cameron McKenzie
 
Alecsandru Cocarla
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all!!

Leandro Coutinho wrote:Amazing!!!

What was your strategy to change the jpanels? Did you use CardLayout?

No, because from the program's parameters you already know what the layout will be, so there's no need to switch some panels at runtime.
 
Roel De Nijs
Sheriff
Posts: 9807
101
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alecsandru Cocarla wrote:
What I did is sent them an email right after the essay exam, requesting to know if everything went all right (upload), and informing about my taking the essay exam. I don't know if sending this email helped in a faster grading...

I also sent a similar email and I got my grade also in exactly 4 weeks
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Congratulations!

-Cameron McKenzie
 
mayuresh chaubal
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
congrats..
 
arulk pillai
Author
Ranch Hand
Posts: 3385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Congrats and keep up the good work
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic