aspose file tools*
The moose likes Certification Results and the fly likes Passed URLyBird 1.3.2 (400/400) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Certification Results
Bookmark "Passed URLyBird 1.3.2 (400/400)" Watch "Passed URLyBird 1.3.2 (400/400)" New topic
Author

Passed URLyBird 1.3.2 (400/400)

Cless Alvein
Ranch Hand

Joined: Jun 18, 2007
Posts: 39
Wow, I did not expect to receive a perfect score on my SCJD assignment! While I was working on my solution I know that I looked at the results of others here to see what they did right, what improvements could have been made, etc. so it is now my turn to give back to the community here. I spent about seven days designing and developing the application and then three days reviewing it, adding to my choices.txt file, writing the manual, and making sure that I had all my files in the correct location. Be sure to read the requirements carefully!

The resources I used were this forum (most helpful) and I remember reading through the CD included with the SCJP book by Sierra and Bates. It took six weeks to get results.

Section Summary:
General Con: 100 100
Documentation: 70 70
OOD: 30 30
GUI: 40 40
Locking: 80 80
Data Store: 40 40
Network Server: 40 40
Total: 400 400
Perfect Score - Excellent job.

Design
I chose a three-tier design with a database layer, a business logic layer, and a GUI layer. The database layer had an interface to interact with the raw flatfile format and abstract it in terms of records. The class that implemented that interface made it specific for the URLyBird record format I was given. Higher up in the database layer, I had classes that implemented my DBMain interface (provided by Sun) and a RemoteDBMain interface (defined by me - it was basically a copy of DBMain but its methods threw RemoteExceptions). There was also a lock management class here that maintained the integrity of the database with respect to concurrency concerns. 1300 lines.

The business logic layer had a ReservationManager interface that exposed the methods that I would use in the GUI. The implementing classes where LocalReservationManager and RemoteReservationManager, which used a DBMain and RemoteDBMain as data accessors, respectively. The notion of records was also abstracted into Reservations. 950 lines.

At the top, the GUI layer had an abstract frame that displayed most of the information. It had two subclasses - one for local mode and one for remote mode. These would create the appropriate ReservationManager type and also do a little bit of customization (e.g. the remote mode frame would display the server host and port). 1400 lines (Swing sucks).

More about the GUI
It seems that people have typically received scores of 32/40 on the GUI so I'll elaborate on this point. My GUI was very simple. I had a JMenuBar that had only an Exit option, my JTable was very simple and did not allow for reordering of columns (however, since it was very easy to enable row-sorting, I turned that on). In fact my code for the JTable was super simple - every time I got new data from the database, I would create a completely new table model, populate it with the new data, and swap the JTable's models, leaving the old one to be GC'd.

I really didn't have anything fancy. The nicest features I had were that I loaded the native LAF and instead of clicking Search to execute a query, you could press Enter inside of my search fields. No progress bars, connection states, etc. I did remember to save the server IP, server port, and database file location within the suncertify.properties file. (Some of these properties wouldn't be changed, depending on the context.) The Properties class was great for this.

In a nutshell, be sure to handle all of the error cases, and try to have just a few features that are easy to use.

Locking and thread-safety
I thought that this part was easy but I had done some OS kernel work a few months before working on my SCJD project, which probably helped. In short, there are two levels where concurrency can bite you. The first is at the data storage level. If two concurrent requests to write to the database end up writing to the same location you're going to be in trouble. (On a side note, I did reuse record numbers of deleted records. Think of record slots like slots in a CPU cache, page table, database buffer, etc.) A higher level problem exists with the reservation management. This is why the DBMain interface provides locking and unlocking methods. Again, this is similar to recurring themes in computer science, like pinning.

Miscellaneous
  • My user's manual was a simple HTML document which let me link to other parts within the document from a table of contents. Some CSS made it look nice.
  • I JavaDoc'd every method and class, even if they were private. My comments were solid, for lack of a better word. There weren't too many one-sentence comments, and I also made sure to fill in all the @param, @return, and @throws tags. This is probably why my line count is high.
  • In my JavaDoc I included a UML class diagram (basically a bunch of boxes representing my classes and their relationships). I spent about an hour with NetBeans reverse-engineering my final source into a UML diagram and then fiddling with it to hide all of the class methods and clean things up into a decent-sized image.
  • I was thorough during my written exam. I feel that writing concisely and with clear English (I took my exam in the US) would only make it easier for the reader to understand my points. This applies to the JavaDoc comments, choices.txt, and user's manual as well.


  • Devaka Cooray
    ExamLab Creator
    Saloon Keeper

    Joined: Jul 29, 2008
    Posts: 3106
        
      41

    Whoa!
    Congratulations Cless, on your perfect score

    Devaka.


    Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
    What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
    Alecsandru Cocarla
    Ranch Hand

    Joined: Feb 29, 2008
    Posts: 158
    Congratulations!


    SCJP 1.4 100%
    SCJD 99.5%
    mohamed sulibi
    Ranch Hand

    Joined: Sep 04, 2005
    Posts: 169
    hi;
    Congratulations

    best regards.
    Roberto Perillo
    Bartender

    Joined: Dec 28, 2007
    Posts: 2265
        
        3

    Hey partner, congrats for the perfect score!!!


    Cheers, Bob "John Lennon" Perillo
    SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
    Kevin Florish
    Ranch Hand

    Joined: Jan 06, 2009
    Posts: 175
    Congratulations


    Java5 Tutorials | Java6 Tutorials | HTML/CSS Tutorials | JavaScript and jQuery Tutorials
    K. Tsang
    Bartender

    Joined: Sep 13, 2007
    Posts: 2419
        
        7

    congrats on your perfect score.

    I would like to ask how you implemented updating network clients' table view when one client books a record?

    Thanks.


    K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
    Roel De Nijs
    Bartender

    Joined: Jul 19, 2004
    Posts: 5286
        
      13

    Hi Cless,

    Congratulations on that perfect score

    May I ask you how you handled the InterruptedException ?

    Kind regards,
    Roel


    SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
    http://www.javaroe.be/
    Anne Crace
    Ranch Hand

    Joined: Aug 29, 2005
    Posts: 223
    Super-awesome! And thanks for posting comments on your solution. These are quite helpful to those of us still working on the assignment.


    SCJP, SCJD
    Jeffry Kristianto Yanuar
    Ranch Hand

    Joined: Oct 01, 2007
    Posts: 759
    Wow, excelent !!! I just scored 365/400 on the same assignment.


    Jeffry Kristianto Yanuar (Java Instructor)
    SCJP 5.0, SCJA, SCJD (UrlyBird 1.3.2)
    Bert Bates
    author
    Sheriff

    Joined: Oct 14, 2002
    Posts: 8815
        
        5
    That's awesome Cless!

    We're glad that our ancient SCJD materials were still useful

    Off to the results forum,

    Bert


    Spot false dilemmas now, ask me how!
    (If you're not on the edge, you're taking up too much room.)
    satishkumar janakiraman
    Ranch Hand

    Joined: May 03, 2004
    Posts: 334
    Congrats! Amazing score!!!


    sat
    Juee Doo
    Ranch Hand

    Joined: Sep 26, 2008
    Posts: 232
    congrats!
    Mahesh Kumaraguru
    Ranch Hand

    Joined: Jun 01, 2005
    Posts: 95
    Congrats best score


    Regards,<br />K. Mahesh<br /> <br />SCJP 1.2 Aug-2001 : 79%
    Joe Harry
    Ranch Hand

    Joined: Sep 26, 2006
    Posts: 9389
        
        2

    There was no need to mention the section wise summary. Great job. Congrats!


    SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
    Did a rm -R / to find out that I lost my entire Linux installation!
    vaibhav mishra
    Ranch Hand

    Joined: Jun 18, 2008
    Posts: 168
    wow, perfect , Congratulations this will help us a lot.


    SCJP
    Cless Alvein
    Ranch Hand

    Joined: Jun 18, 2007
    Posts: 39
    K. Tsang wrote:congrats on your perfect score.

    I would like to ask how you implemented updating network clients' table view when one client books a record?

    Thanks.


    I assume you're asking about a scenario in which clients A and B start the GUI, and then client A books some reservation. Simply put, I didn't update client B's view. What I did do was display an error message if B then tried to book the same record. From what I remember, the program flow was like this:

    A books the record - the database is atomically updated.
    B tries to book the record.
    The database sees that the record is booked, and an exception is thrown.
    The exception propagates up to the client GUI.
    The GUI displays the error message to the user, and then refreshes the JTable (this step was implemented naively - if the user had performed some search, the refresh-operation would ignore that and just retrieve and display all of records.)


    Roel De Nijs wrote:Hi Cless,

    Congratulations on that perfect score

    May I ask you how you handled the InterruptedException ?

    Kind regards,
    Roel


    My code only threw an InterruptedException in four places. Three were in the main method where I launch the GUI so I just display an error message in a JOptionPane and exit the application.

    The other InterruptedException is when I wait() for a database record to be unlocked. In this case, I just log the message (I wrote a small error-logging utility that wraps the Java API's logger - the output of the logger is never printed anywhere but presumably it could be used for debugging.) and that's that.

    The reason why it doesn't matter is because whenever you have a call to wait(), it should most likely be wrapped within a while-loop. Read up on Mesa vs. Hoare monitor locks if you're not sure why (Java uses Mesa-style locks). So, even if the exception is thrown and the error is logged, the while-loop will continue to make the thread wait until the desired condition (i.e. the condition for the while-loop to terminate) is satisfied.
     
     
    subject: Passed URLyBird 1.3.2 (400/400)