File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes UrlyBird 1.2.1 passed 359/400 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "UrlyBird 1.2.1 passed 359/400" Watch "UrlyBird 1.2.1 passed 359/400" New topic
Author

UrlyBird 1.2.1 passed 359/400

Chris Be
Ranch Hand

Joined: Sep 11, 2006
Posts: 36
All,

After a good 3 months of development, passed the SCJD as below:

Summary:
UrlyBird 1.2.1
Java 6
RMI Networking
Eclipse IDE, JUnit, ant build, Jalopy code formatting with Checkstyle verification, Sun doccheck tool

Score:
General Considerations (maximum = 100): 90
Documentation (maximum = 70): 70
O-O Design (maximum = 30): 30
GUI (maximum = 40): 31
Locking (maximum = 80): 58
Data store (maximum = 40): 40
Network server (maximum = 40): 40

Stats:
Source: 5 sub-packages, 20 public classes, 2 inner classes, 2 anonumous classes, 3 Enums, 102 KB
runme.jar size: 43 KB
choices.txt: 9.34 KB

Things I find worth mentioning:

I used many ideas from Ken Krebs
and Kaspar Thommen

Documentation:
Created user manual as word document with below structure and screenshots (taken with tool Printkey 2000),
then saved the whole microsoft caboodle it as html file.

URLyBird 1.2.1 User Manual
1Prerequisites
1Application Start-up1
1.1URLyBird Network Server Start-up1
1.2URLyBird Network Client Start-up3
1.3URLyBird Standalone Application Start-up4
2Application Shut-down5
2.1URLyBird Network Server Shut-down6
2.2URLyBird Client Shut-down6
3Application Usage6
3.1Search for Room6
3.1.1Search Functionality6
3.1.2Search Hints7
3.1.3Search Examples7
3.2Book Room8
3.2.1Booking Functionality8
3.2.2Booking Failure9
4Troubleshooting10
4.1.1Incorrect Start-up Parameters10
4.1.2Start-up Error Reports10
4.1.3Operation Error Reports12

Created javadoc down to private level (including package-info.java), used Jalopy, Checkstyle and Sun's dockcheck to ensure consistency and correctness

O-O Design:

3 tier architecture, Presentation (swing client), Business (search and book functionality), Data Access (Interface implementation)
Business Delegate Pattern between client and database
Adapter Pattern to adapt local to network mode
Transported String array data from datastore to GUI. JTable is happy with string arrays, so did not bother stuffing in and out of specific objects (DTO/VO).

GUI:
Single, non-resizable frame layout with two search text boxes (name/location), a radio button group (AND/OR search), a Search button and the results table. No menus, tabs etc.
Booking done by adding a customer id into the respective table column. The table listener picks this up and initiates the booking. Due to the text boxes the search
is a bit clumsy, but it did exactly what the must requirements said: match exact against criteria provided by user.
Maybe I lost the points for not updating the table if a booking failed. Hence the attempted record
remained in the table showing the id of the failed customer, even though the customer had not actually booked the room. Though the failure
instructions said to refresh. Or it was the fixed screen size as I didn't bother worrying about resize adjustments.

Used in-built JOptionPane as configuration GUIs.

Locking:
I am a bit diappointed here. It seemed so simplistic. Used the Lockable Object Pattern. One lock object per row,
extending the ReentrantLock class, maintained in a sychronized map. Get lock object from map, then call lock/unlock providing and verifying cookie. Hence, no lock wait or synchronize
bottlenecks for unrelated record access and minimum coding. Also, specified the lock->process->unlock sequence for update and delete. It did a perfect job according to the extensive
JUnit Test Cases, but must have been too simple to be good.
Create method appended to end of file, which is a bit of a moving target. It couldn't be locked using any of the available interface
methods. Hence, was synchronized.

Lock cookie generated from static variable.

Edited: PS - after studying up on the Java Memory Model (JSR 133 and 166) I am not so disappointed any more. The key words are double-checked locking, which I used and should not have, and volatile - which I should have used and did not. You are always more knowledgeable afterwards, when you know what you are looking for: Java Memory Model!

Datastore:
No great inventions here. No reuse of deleted rows, append instead. Schema hard coded. New RandomAccessFile instance for each individual CRUD action to avoid
a shared file pointer being moved about by unrelated threads, or the need for synchronization.

Network Server:
RMI, and thanks to Ken Krebs' ideas, a simplistic adapter for the local business layer with a handful of lines of code.

Other:
- Only 2 log statements for the book method, before and after a successful booking. 20 log statements to print additional details when exceptions occur.
Used the default JRE logging.properties config, no specific log files, appenders etc.
- Used the clever RuntimeException pass-around for interface IOException deficiency, used IOException trick from Ken for RMI mode.
- Ignored 48 hour rule
- Used jalopy and checkstyle for code formatting
[ February 17, 2008: Message edited by: Chris Be ]

ChrisBe<br />-------<br />SCJP, SCJD, SCEA in the making
Musab Al-Rawi
Ranch Hand

Joined: Aug 06, 2007
Posts: 231
Congratulations Chris,
It's important that you have done it, it is not an easy certificate yet it is not impossible.

It seems that your locking technique sounds pretty close to Monkhouse's suggested technique (the one that allows you to lock on each record instead of locking the whole DB) is that correct ?
I am concerned because that is similar to what I did more or less and based on my tests it is work fine, I wonder why you lose those points for locking !


SCBCD - SCWCD - SCJD - SCJP - OCA
Chris Be
Ranch Hand

Joined: Sep 11, 2006
Posts: 36
Musab,

Yes, I lock on each record, though I haven't read Monkhouse. This is what I find a major disadvantage, no feedback. Not much room for improvement.

Nevertheless, it is better than the cursed 40/80 score that haunts so many candidates. I read that using synchronization only has given high marks before. Maybe synchronization is what the assessor's are after? But then, each assessor would have their own opinion.

The 20 points less doesn't bring you below the pass/fail mark, provided the remaining app is well designed and implemented.

Chris
Joelle Ghazal
Greenhorn

Joined: Jan 08, 2008
Posts: 14
chris, i have a question about SCJD assignment

did you create an additional class to call the server and the client programs?

if yes how did you package them in runme.jar?


Thank You
archana kher
Greenhorn

Joined: Oct 04, 2007
Posts: 16
Lee, I have a query, Once you uploaded the assignment, did you get any mail from sun stating that your assignment is accepted and that you could take a exam? Please advice.

btw congrats!!
Chris Be
Ranch Hand

Joined: Sep 11, 2006
Posts: 36
Originally posted by joelle ghazal:
chris, i have a question about SCJD assignment

did you create an additional class to call the server and the client programs?

if yes how did you package them in runme.jar?


Thank You


I had a class in the suncertify package root, which acted as a bootstrap to start the app and take care of parameters and configuration. It then initialized the database, then the local or remote business layer with the given database, then the swing client with the given remote or local business layer.

It ended up as a normal java class in the jar, with the manifest referring to it's main method.
Chris Be
Ranch Hand

Joined: Sep 11, 2006
Posts: 36
Originally posted by archana kher:
Lee, I have a query, Once you uploaded the assignment, did you get any mail from sun stating that your assignment is accepted and that you could take a exam? Please advice.

btw congrats!!


I had registered for/scheduled the exam about a month prior to handing up my assignment. As far as I recall, the only requirement is that the assignment is handed up prior to exam time, not exam registration time.

Remember though that you'll be very likely ask for upload permissions first from Sun. As I understand, the permissions cease about 3 months or so after you downloaded the assignment. It didn't take more than a day though, as I sent an Email request for upload permissions to prometric and sun (6 email addresses alltogether). I figured this way one would surely attend, and I think 4 did.
Joelle Ghazal
Greenhorn

Joined: Jan 08, 2008
Posts: 14
Thank you chris for your reply.
I have 2 main class in each program (client and server) but you add an additional class to load either client or server according to user arguments (java -jar runme alone/server) ?

this what i want to know.
i have created an additional independent class to load either the client or server program. is it ok? or this is unlegal?

And i jar client program, server program and the bootstrap class in runme.jar and i mentioned in the MANIFEST.MF file the mainclass=boostrap class
and in bootstrap class i write
e.g.:import suncertify.main.mainprogram; import suncertifyserv.main.mainprogram;

if it is ok, my question here is when you jar the 2 programs and the additional class file in runme.jar how you tell the jar that those import classes is located inside the jar itself?


Thank You in advance
Chris Be
Ranch Hand

Joined: Sep 11, 2006
Posts: 36
Originally posted by neojewel:
Thank you chris for your reply.
I have 2 main class in each program (client and server) but you add an additional class to load either client or server according to user arguments (java -jar runme alone/server) ?

chrisbe: exactly, I have a class that is neither the logical server, database or client itself

this what i want to know.
i have created an additional independent class to load either the client or server program. is it ok? or this is unlegal?

chrisbe: sounds good to me!

And i jar client program, server program and the bootstrap class in runme.jar and i mentioned in the MANIFEST.MF file the mainclass=boostrap class
and in bootstrap class i write
e.g.:import suncertify.main.mainprogram; import suncertifyserv.main.mainprogram;

chrisbe: sounds all right. Though if you only have 3 classes in your jar now, you definitely have a problem with you OO design approach . Also, I assume the above are not actual package and class names, since they are way out of whack with the assignment requirements and Java naming conventions

if it is ok, my question here is when you jar the 2 programs and the additional class file in runme.jar how you tell the jar that those import classes is located inside the jar itself?

chrisbe: Why do you need to tell the jar? It's just an archive for java classes plus the manifest metadata. The class loader loads any of the classes within the jar when referenced. The first class being your bootstrap class as per manifest file, then any other ones referenced.


Thank You in advance

[ January 09, 2008: Message edited by: Chris Be ]
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9622
    
    2

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!
Joelle Ghazal
Greenhorn

Joined: Jan 08, 2008
Posts: 14
And i jar client program, server program and the bootstrap class in runme.jar and i mentioned in the MANIFEST.MF file the mainclass=boostrap class
and in bootstrap class i write
e.g.:import suncertify.main.mainprogram; import suncertifyserv.main.mainprogram;

chrisbe: sounds all right. Though if you only have 3 classes in your jar now, you definitely have a problem with you OO design approach . Also, I assume the above are not actual package and class names, since they are way out of whack with the assignment requirements and Java naming conventions [shocked]
--------------------------------------------------------------------------
let us make things clear
we have a programs one for client and one for server

client package is called suncertify
containing many subdirectory for handling classes (IO, GUI, Data,..)
server package is called suncertify
containing many subdirectory for handling classes (IO, GUI, Data,..)

the assignment requirement is to have runme.jar [mode] which load either client or server application
is it ok for now?


To handle this requirement, i create a new class out of the client and server packages . I called it runme.class.
inside runme.class i put:
import suncertify.program.mainprogram; //for client
import suncertify.program.mainprogram; //for server
in order to call them depending on user entry mode.


please tell me if it is right till now?
Chris Be
Ranch Hand

Joined: Sep 11, 2006
Posts: 36
neojewel,

I think you are on the right track.

P.S. pls review the ranch display name policy
[ January 09, 2008: Message edited by: Chris Be ]
Alex Belisle Turcot
Ranch Hand

Joined: Apr 26, 2005
Posts: 516
Originally posted by neojewel:

let us make things clear
we have a programs one for client and one for server

client package is called suncertify
containing many subdirectory for handling classes (IO, GUI, Data,..)
server package is called suncertify
containing many subdirectory for handling classes (IO, GUI, Data,..)



Just to make sure... it's the same "application" handling both client and server mode, there's only a single application (with multiple modes) to develop.

Regards,
Alex
Alex Belisle Turcot
Ranch Hand

Joined: Apr 26, 2005
Posts: 516
by the way, congrats Crisbe!
Joelle Ghazal
Greenhorn

Joined: Jan 08, 2008
Posts: 14
Alex Belisle Turcot

how it could be the same application?

the server should run additional features which are the listener to client, concurrency of client request. where client does not establish.

Please tell me if i am wrong.
i end with 3 programs : - Client (Alone and Networked)
- Server
- bootstrap class
Joelle Ghazal
Greenhorn

Joined: Jan 08, 2008
Posts: 14
Chris be

Thank you for notifying me, sorry again

My question is after having those 3 programs i should jar them into one jar file. and execute this jar to run either client-alonemode, client- netwrokedmode or server.

i jared them and i specify in MANIFEST the main-class to bootstrap class but this previous class couldn't not see the other program within the jar

e.g.: prog.jar contains: prog1, prog2 and bootstrap


can i put another copy of programs as library directory outside this jar? so i can call them?
Alex Belisle Turcot
Ranch Hand

Joined: Apr 26, 2005
Posts: 516
Hi,

maybe we're just playing with words..

Overall, you should have a single main method. Based on the argument passed to your main, your application will run either in "standalone mode", network mode" or "server mode".

These 3 modes together is what I called "a single application".
At the end, your project will contain only 1 main class and will be packaged in a single jar.

To run the client and the server, you need to execute your application twice, passing different argument:
*Server: java -jar runme.jar server
*Client: java -jar runme.jar

Regards,
Alex
[ January 10, 2008: Message edited by: Alex Belisle Turcot ]
Joelle Ghazal
Greenhorn

Joined: Jan 08, 2008
Posts: 14
ok i got your point thank you.

I am sorry but i was confused with the way of package

what about "properties" file should be in the jar packaged application?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"neojewel",
Please check your private messages.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Chris Be
Ranch Hand

Joined: Sep 11, 2006
Posts: 36
My jar file contained only the 20 sth compiled Java *.class files (indcluding the RMI stub/skeletons), and the manifest.mf. The requirements will not allow the addition of a property file in the jar, as it must be in the same location as the jar.

I check for the presence of this file, and if not there create it and stuff some hard coded default values in. Check the File.createNewFile() method, it takes much of the work off your hands.


Chris Be
Chris Be
Ranch Hand

Joined: Sep 11, 2006
Posts: 36
Originally posted by neojewel:


i jared them and i specify in MANIFEST the main-class to bootstrap class but this previous class couldn't not see the other program within the jar

e.g.: prog.jar contains: prog1, prog2 and bootstrap


can i put another copy of programs as library directory outside this jar? so i can call them?


You may help by enlightening us exactly what your "prog1, prog2 and bootstrap" programs stand for. A single java file? a package in your jar? another jar file?
As referenced above, all .class files are loadable into the JVM. Unless there is some awkward class naming or packaging not according to specs, there is no reason why the class loader should not find all of the included class files in the jar archive.

The requirements state that there must be a single runme.jar only.
Joelle Ghazal
Greenhorn

Joined: Jan 08, 2008
Posts: 14
Thanks Chris,

there was a misunderstanding in my project requirements. and i fixed it now.

Thank You again Chris

and Thank You for all, Alex Belisle Turcot and Ben Souther
Naveen Narayanan
Ranch Hand

Joined: Sep 11, 2007
Posts: 114

Congratz


SCJP 5.0, SCJD, SCWCD
rohan tiwari
Ranch Hand

Joined: Sep 13, 2007
Posts: 82
Congrats..


SCJP 5, SCWCD 1.4, SCJD 5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: UrlyBird 1.2.1 passed 359/400