Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passed SCJD 155/155 points

 
Arto Santala
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, couldn't believe it myself. I'm feeling great, and I think there will be some celebration tonight.
Big thanks to this forum and people here. I already did my programming assignment once, but fortunately I decided to spend some time around here. I ended up re-doing my locking scheme completely. Just reading this forum has been unbelievable help for me as well as giving a good warm feeling - there are others out there trying the same thing I'm trying.
So, the basic planning decisions:
-I used RMI
-I didn't implement local locking
-I left the original files as untouched as possible - but I did implement criteriaFind and a separate utility method parseCriteria
-I used a few interfaces and a client facade to separate re-usable db code (model), businesslogic (flight booking), and UI.
-I added some cleanup stuff that wasn't in requirements
So pretty standard stuff.
Also-
-Good documentation is essential
-I hand-coded everything, with EditPlus text editor, and used Apache ANT for project management and packing - helped me to keep stuff fast and errorless. ANT can compile&create RMI stubs & javadocs and package stuff and move it around. Great tool! I didn't put any ANT-specific stuff with the final package, though.
So - thanks once more, and keep up the hope! I'm heading for the architect forums - after a small break.
 
Gosling Gong
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Congratulations!
Could you explain your GUI and Exceptions handling?
did you use MVC in GUI, and did you chain the exception?
 
Arto Santala
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure how deep into it it's fair to go - but the basic idea of my GUI was this:
Controller.java handles all UI events (Well, most of them. All that make sense at least) and doesn't contain any swing - it calls methods on...
ClientUI.java - which contains most UI code - and registers Controller as its listener.
I also had FlightTableModel - as a model for JTable, that cached results from database and offered them as nice JTable model.
Controller uses ClientFacade.java, which contains businesslogic, and it uses either RemoteDataClient, or Data directly, depending on startup mode. I also had errordialog and seatreservationdialog, and a nifty help page which uses HyperlinkHandler - it shows use-time help screens and works as HTML browser.
I think this (Help browser) was mostly unneccessary but I felt like doing it since in my experience UI should be very easy and intuitive and offer many ways of doing the same operation - so I couldn't bear letting what I felt unfinished product out of my hands, even though it wasn't in the specifications.
All in all, pretty fun excercise. I tested this also with my girlfriend, and since she seemed to be able to use it, it seems pretty intuitive.
 
Robin Underwood
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Congratulations! Great score!
 
Sam Stackly
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well Done Arto , Congrats,
Can you explain how you implement lock(-1) and did you just implement it in server side (ServerGUI) or both side (Client and Server GUI)
Thanks in advance
Sam
 
Arto Santala
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, guys. Locking was implemented remotely in RemoteDataClient - required by the specifications. But I had a separate ClientFacade class that used RemoteDataClient to offer simpler close-to businesslogic operations for the Controller. By businesslogic operations I mean for example bookFlight(flightCode, seats).
So RemoteDataClient is exactly like Data-only works remotely. ClientFacade calls the lock() unlock() pair when needed. In effect, I implemented client doing the locking, since I this is the way I interpreted the original specification.
Hint: As I understand, the background model (Existing code) should be left pretty open-ended, so that it can be used for other projects as well. That's at least my judgement after reading the specification carefully. So no flight-booking-application-specific code to the Data class.
 
Arto Santala
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, lock(-1) - there's great advice already in the forums. I ended up making a routine that will try to lock every existing record and wait until it can get the lock on them, by calling lock(record) for each record.
This ensures that all updates are done. Of course, you need to also make sure that locks are not left hanging.
 
Sam Stackly
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Arto for you quick reply,
Just a quick question , did u implement lock(-1) in server side (ServerGUI while admin wants to shutdown server ) or in client side (so each client can close, or better I say lock the whole database)?
Thanks again
Sam
 
Arto Santala
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, I implemented lock(-1) on server side, but it can be called remotely by client as well, if neccessary. Actual implementation of locking a record or database is in LockManager class, which is called by server-side code.
 
Sam Stackly
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arto hope you will forgive me about asking to many question but I stuck in this lock(-1)!!
so you made a routine that would try to lock every existing record and wait until it can get the lock on them, by calling lock(record) for each record but how did you prevent new user for asking to lock a record while you were waiting to lock each record in entire database? Did you use a Flag or something like that?
Thanks
Sam
 
Arto Santala
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem, I'll be glad to answer as long as I'm online.
I didn't feel the need to check for client locks. If client tries to lock a record that has already been locked - client doesn't get a lock and so can't try to commit anything. If client tries to lock an unlocked record - let it go ahead. Typical lock&unlock situations take a second at maximum, so server can afford to lock it. I decided that server shutdown is not about speed - in my solution it was more about taking the time, letting transactions be complete, and just one by one locking the records.
In typical use server locks all records inside a second. Only situations that would cause any problems would be 1) improper client locking - no unlocking (can be handled on client end with timeout sanity checking) 2) operations that take a loong time to commit (we don't have such operations here neither we will be having for long time).
That's my approach. But I have to say that I think more important than what you do is to have a pretty good explanation on why you did. I've seen very high scores with very different approaches. So pick what makes sense top you. Fortunately these forums are full of ideas.
 
Sam Stackly
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Arto, Now it's clear for me
Sam
 
Sam Stackly
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Arto,
Sorry to bug you again,
Just a quick question, If you implement lock(-1) in LockManager, how do u know the total number of records? I assume your LockManager is seprate class .
Thanks again for your help,
Sam
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perfect job Arto
 
Ashik Uzzaman
Ranch Hand
Posts: 2373
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Congrats Arto... , very
And your feedbacks are also
Wish you success in future also.
 
Rasika Chitnis
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you track client id's in your locking scheme ?
 
Eduard Jodas
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And another question: did you followed strictly the Java Coding Rules?
P.d: Congratulations!
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Congratulations Arto. Very well done. Please stick around and help us out at the SCJD Forum. Pretty soon we can get everyone getting 155/155.
Mark
 
Arto Santala
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Mark, your posts were among the most useful I read while preparing for this.

Yes, I tracked clients, but I didn't use any specific id values for that. Instead, I had a separate instance for each client on the server end - in other words, I used the object instance itself as identifier.
As for coding standards, I am not 100% sure what you are thinking about, but I follow standard naming rules at least, for methods, classes, constructors, final variables, etc, automatically, since they make sense. If you meant standard patterns, I used a few and documented well what I was using.
Main point is to explain well what you were doing - the more the reader understands the better you are probably going to do. And using standard approaches, naming and patterns, makes design and code more readable and clear --> easier to understand, so it makes sense always, especially here. This works well in real life problems, and works well for this certification as well.
 
Younes Essouabni
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great job artho!
I hope that you will stay around to help us
Wish you the best
 
Sarada Bhasker
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Congratulations!
Can you tell me something about documentation and design choices doc. Like how many pages each was and what all things you mentioned in that
Regards
Sarada
 
Sarita Gupta
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Congratulations Arto...
Sarita
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic