aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes My results, my Thanks and my Warning 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 "My results, my Thanks and my Warning" Watch "My results, my Thanks and my Warning" New topic
Author

My results, my Thanks and my Warning

Robert Konigsberg
Ranch Hand

Joined: Jun 23, 2004
Posts: 172
This report shows the total number of points awarded for each section. The maximum number of points is 400, to pass you need a score of 320.
Section Summary:
  • General Con: 92 (out of 100)
  • Documentation: 70 (out of 70)
  • OOD: 30 (out of 30)
  • GUI: 31 (out of 40)
  • Locking: 80 (out of 80)
  • Data Store: 40 (out of 40)
  • Network Server: 33 (out of 40)
  • Total: 376 (out of 40)


  • Now the warning: I got my results 9 days ago, and it was FAIL. It was for reasons that I was warned about on this list and I thought I was right.

    Now it turns out I *was* right, because my appeal was granted and
    I was rescored, but who wants the heartache of having to appeal? I
    suspect they converted my appeal into some of the point deductions
    you see above, but, of course, I'll never know.

    Read the letter I wrote to them, and it should all make some sense.

    Thank you for contacting me about my score results.

    Yes, I'm going to ask you to reconsider my automatic failure, but I promise to be BRIEF AND POLITE!!

    I was given an automatic failure for "Port number is invalid. Run the client to reconfigure."

    Here, I will explain. My design will not run out-of-the-box. You MUST run the GUI to preconfigure the application, by setting the port, IP and database locations. It does not assume what those values might be.


    Here is my justification:

    1. I have reread the user documentation and have not found which "MUST" I violated.
    2. I have clearly stated in both the user documentation and design documentation the need for preconfiguration.
    3. Preconfiguration is performed via the GUI, which matches your requirments.

    IF I VIOLATED AN EXPLICIT "MUST"
    Please tell me which one I violated.

    IF I VIOLATED AN IMPLICIT "MUST"
    (Meaning one which is not clear in the documentation) I would ask you to please reconsider my exam as correct to that point, and then regrade it.

    Alternatively I will be willing to consider a resubmission if I am given correct direction.

    Thank you, Rob


    Finally, thank you all for all your help. I appreciate it. If you would like to know some of the details around my full-credit portions, let me know.

    -Rob

    PS: Quick, reply before this thread gets moved to the Results forum!
    [ August 19, 2004: Message edited by: Robert Konigsberg ]

    SCJP 1.4 (91%)<br />SCJD 1.4 (376/400, 94%)
    T. Anthony Chen
    Ranch Hand

    Joined: Jul 28, 2004
    Posts: 38
    Congratulations, Bob!

    Nice job there. Sorry that you had to go through the appeal.

    Could you share some of your design ideas in data access and locking? You've got full credits there. I am interested in things like if you cache all the records, do you use NIO, and what locking approach do you use, etc. Thanks.


    T. Anthony Chen<br />---------------<br />SCJP, SCJD, SCBCD, SCWCD, SCEA
    Philippe Maquet
    Bartender

    Joined: Jun 02, 2003
    Posts: 1872
    Congratulations, Robert!

    Phil.
    [ August 19, 2004: Message edited by: Philippe Maquet ]
    Robert Konigsberg
    Ranch Hand

    Joined: Jun 23, 2004
    Posts: 172
    Data Access and Locking

    My object heirarchy for the data access and locking were like so:

    1. I had a separate tier to manage data access.
    2. Locking went across all three tiers, all the way to the client. The client software managed cookies themselves.
    3. I had a package for database access called suncertify.db, and another for actual i/o operations (suncertify.db.io)

    On the lowest level I had three classes for suncertify.db.io:

    FileIo.java:
    This class did not implement the suncertify DB interface, but rather, only managed the ability to read and write in the database format documented in the requirments. In this way I had an interface that was cleaner than the messy one that is supplied by Sun. It doesn't manage cookies, and is single-threaded. I used a RandomAccessFile to implement, and stayed away from NIO.

    MetaData.java
    ..This class contained the metadata from the database. When FileIo opens the database, it reads the entire metadata section so it's all pre-loaded.


    FieldSchema.java
    ..This class encapsulates a single Metadata field.

    As for the actual database implementation:
    Data.java
    ..This is the implementation of DB.java. It encapsulates the FileIo class, but wraps all appropriate calls with row locking and thread safety. It contains a FileIO object and a LockMechanism object.

    LockMechanism.java
    ..Contians a long value that increments for each cookie.
    ..Contains a map that correlates between the a row and cookie. An entry in the map indicates a locked record.

    Here is a simplified version of a piece of code that all my methods within LockMechanism use. It is used to validate that a supplied cookie is for a specific row.

    (Slightly modified and simplified so the posting isn't deleted.)


    Summary:

    Implementation details:

    1. I did not use NIO, I used a RandomAccessFile
    2. I did not cache any data
    3. None of this information is singleton and none of it is static. The static data comes in the middle-tier which has a single instance of the Data object.
    Philippe Maquet
    Bartender

    Joined: Jun 02, 2003
    Posts: 1872
    Thank you for the information, Robert!

    Phil.
    T. Anthony Chen
    Ranch Hand

    Joined: Jul 28, 2004
    Posts: 38
    Thanks a lot for sharing your ideas, Rob. I appreciated it.
    Andrew Monkhouse
    author and jackaroo
    Marshal Commander

    Joined: Mar 28, 2003
    Posts: 11424
        
      85

    Congratulations Robert


    The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
    Richard Jackson
    Ranch Hand

    Joined: Jun 25, 2003
    Posts: 128
    Robert, Congratulations!

    Thanks for your sharing experiences.

    The client software managed cookies themselves.

    1)The cookies are just taken by methods in Data class?How to manage these cookies?

    When FileIo opens the database, it reads the entire metadata section so it's all pre-loaded.

    2)In your assignment,Metadata contains what? When opening .db file,does the class return metadata object?

    3)In part of network function,what do you consider to implement that with RMI?


    Regards, Richard
    Robert Konigsberg
    Ranch Hand

    Joined: Jun 23, 2004
    Posts: 172
    To manage the cookies I did a few things:

    1. I didn't use RMI because I didn't know RMI and didn't want to learn RMI.
    2. The client was responsible for calling lock() and unlock(). This meant adding lock() and unlock() method calls to my network interface.
    3. The middle tier kept track of all lock() and unlock() requests from the client. In that way, the true accountability of unlocking fell on the middle-tier. This was because...
    4. When the network connection was severed, the middle-tier thread that managed the connection, WHICH KNEW WHAT RECORDS WERE LOCKED BY THAT CLIENT, immediately unlocked those records.

    About the metadata:
    5. Metadata, in conjunction with FieldSchema contained the name, offset and length of each field. Name wasn't used, but offset and length were critical for knowing how to parse and write records.
    6. The Metadata is not returned outside the Data class. In fact, it lives wholly within FileIo. My point of doing it was to just encapsulate it. I'm a big fan of small components that don't do much. When the database is opened, the Data class ... well ... here's a summary of the code:


    I removed a lot of code, once again, so the posting hopefully isn't deleted. Note how field offsets are not passed to addToSchema(). I'll leave that to you to figure out.
    [ August 19, 2004: Message edited by: Robert Konigsberg ]
    Richard Jackson
    Ranch Hand

    Joined: Jun 25, 2003
    Posts: 128
    Robert, thank you again!

    You are so friendly to this forum.

    1) When the main program running,we need use command line to start GUI, IMO.
    Would you mind using different mode flags to do that?Does that mean the first client begin running?

    2) Other than cookie in file header should be save in the property file,there are still argument (or fixed constants) like file location/server name/port number should be stored in it?

    3) In design phase, data access layer has any bad effect on implement multithreading( In other words,we must notice what?)?
    Richard Jackson
    Ranch Hand

    Joined: Jun 25, 2003
    Posts: 128
    Hi, Robert

    There is a point that I confused.
    FileIo.java:
    This class did not implement the suncertify DB interface, but rather, only managed the ability to read and write in the database format documented in the requirments.


    Now that the class do I/O operations, it can contain open/close functions. But how does it do to implement "read and write in the database format"?

    Robert Konigsberg
    Ranch Hand

    Joined: Jun 23, 2004
    Posts: 172

    When the main program running,we need use command line to start GUI, IMO.
    Would you mind using different mode flags to do that?Does that mean the first client begin running?


    Yeah, I'm not going to go into much detail about that. Your project may have different requirements than I.

    Other than cookie in file header should be save in the property file,there are still argument (or fixed constants) like file location/server name/port number should be stored in it?

    The fixed constants (file location, server name, port number) were stored in another object that managed global application properties. I had those configured in a dialog box on the GUI. Be careful, though, I didn't get full credit for my GUI, so you might not want to listen to me.

    In design phase, data access layer has any bad effect on implement multithreading( In other words,we must notice what?)?

    I don't understand your question. I believe you have to make your data access layer thread safe because in network mode, multiple users may access the database simultaneously. And my Data class was thread safe. Within the Data class is a single FileIo object which does not consider thread safety, and that's OK because Data, which wraps it, is.


    "This class did not implement the suncertify DB interface, but rather, only managed the ability to read and write in the database format documented in the requirments."

    Now that the class do I/O operations, it can contain open/close functions. But how does it do to implement "read and write in the database format"?


    That sort of stuff has been well covered in this forum. This is best put in another thread.
    Ed Green
    Greenhorn

    Joined: Jun 15, 2004
    Posts: 11
    Hi Robert,
    Congrats!

    A question on making data thread safe, assuming that data is not a singleton. 1. Did you manage mutual exclusion between readers and writers explicitely (keeping track of how many readers, how many writers, etc), or did you just use lock/unlock?
    2. did you make any methods in data synchronized, or did you exclusively rely on the external mechanism in (1)?

    tnx.
    Robert Konigsberg
    Ranch Hand

    Joined: Jun 23, 2004
    Posts: 172

    A question on making data thread safe, assuming that data is not a singleton. 1. Did you manage mutual exclusion between readers and writers explicitely (keeping track of how many readers, how many writers, etc), or did you just use lock/unlock?

    2. did you make any methods in data synchronized, or did you exclusively rely on the external mechanism in (1)?


    All external methods in Data were synchronized.* Synchronization means that everyone, whether they read, lock, update, or delete, are going to be put in a line, and each database request is handled one-at-a-time. So that, alone, eliminates any risk of someone reading while someone else is updating.

    The lock/unlock mechanism is only used so that a client can lock a record -- assuring that nobody will update that record for as long as the client wants to hold on to it.

    I didn't keep track of #readers vs #writers.

    To recap:
    1. To ensure that the database is integrous, synchronzied methods takes care of that.
    2. To ensure that nobody will update a record for a certain period of time, lock/unlock handles that.

    * Actually not all, but if I explained why it would only cause confusion. Please ignore this statement.
    Richard Jackson
    Ranch Hand

    Joined: Jun 25, 2003
    Posts: 128
    Hi,Robert
    The fixed constants (file location, server name, port number) were stored in another object that managed global application properties. I had those configured in a dialog box on the GUI. Be careful, though, I didn't get full credit for my GUI, so you might not want to listen to me.

    According to your meaning, there is a seperate class to manage all properties.The properties could be add/modify or delete in GUI?
    I will try it.

    quote:
    --------------------------------------------------------------------------------

    In design phase, data access layer has any bad effect on implement multithreading( In other words,we must notice what?)?

    --------------------------------------------------------------------------------


    I don't understand your question. I believe you have to make your data access layer thread safe because in network mode,


    My problem is very simple. That is, I wanna know what ways is effective to do in data access layer. In other words, we must notice what to make data access consistent?

    1. To ensure that the database is integrous, synchronzied methods takes care of that.

    As you mean, synchronized methods is enough to make threads safe. Then synchronized object has any place to be used?
    Robert Konigsberg
    Ranch Hand

    Joined: Jun 23, 2004
    Posts: 172

    As you mean, synchronized methods is enough to make threads safe. Then synchronized object has any place to be used?


    It depends on your implementation details. I can't answer that for you, only you can answer that for yourself.

    Here's the thing: don't think in terms of "How do my ideas fit into someone else's design?" (Not that you necessarily are.) Think more in terms of "What do I need to solve the problem?" Otherwise you risk being stuck on the essay exam.

    Good luck!
    [ August 20, 2004: Message edited by: Robert Konigsberg ]
    Stephen Anson
    Greenhorn

    Joined: Aug 11, 2004
    Posts: 12
    HI Richard,
    how did you go about solving dropped client / releasing locks
    e.g. timeout, weak references
    cheers Steve
    Anton Golovin
    Ranch Hand

    Joined: Jul 02, 2004
    Posts: 476
    Originally posted by Stephen Anson:
    HI Richard,
    how did you go about solving dropped client / releasing locks
    e.g. timeout, weak references
    cheers Steve


    Sorry to interrupt the discussion. There should not be a condition when a client hangs before unlocking a record.

    If one has a business-logic class that calls book(), for instance, the book() method will call
    lock()
    update()
    unlock()

    Once it returns, it may throw RemoteException, but it has unlocked the record. Please correct me, but I don't think crushed clients are a problem with thin client design.


    Anton Golovin (anton.golovin@gmail.com) SCJP, SCJD, SCBCD, SCWCD, OCEJWSD, SCEA/OCMJEA [JEE certs from Sun/Oracle]
    Andrew Monkhouse
    author and jackaroo
    Marshal Commander

    Joined: Mar 28, 2003
    Posts: 11424
        
      85

    Hi Anton,

    Originally posted by Anton Golovin:
    I don't think crushed clients are a problem with thin client design.


    Ahhh, but not everyone agrees that thin client design is the way to go. Take a look at the "Should lock methods be callable from the client" topic for one example of arguments for and against thin client designs.

    Regards, Andrew
    Anton Golovin
    Ranch Hand

    Joined: Jul 02, 2004
    Posts: 476
    I don't have enough expertise to judge it either way, I am afraid For me, the main requirement of the assignment is that it be as simple as possible as to be understood by junior programmers. I read it as saying the graders who get the assignment want something they can grade in the space of an hour or so. I had a grand design which was very extensible and decoupled and very sound for a large system. Then I took a look and decided my data-management system would be simple. It would have a thin client because it eliminated the problem of crushed clients., which otherwise would create a lot of headache to implement. That's just my personal opinion, it is probably not very sound to someone with more experience, but I am just striving for simplicity
    mike acre
    Ranch Hand

    Joined: Sep 23, 2003
    Posts: 197
    Originally posted by Andrew Monkhouse:

    Ahhh, but not everyone agrees that thin client design is the way to go. Take a look at the "Should lock methods be callable from the client" topic for one example of arguments for and against thin client designs.

    Regards, Andrew


    Yes but if we are worried about 44/80 for locking or our concurrency head is not what it should be, it sure makes a safer bet

    I reckon a short description of our locking mechanism and a nod to the can't happen in thin client classic deadlock should about seal it.

    I have a lock manager but all it is a HashMap and 3 short lock, unlock, isLocked methods.

    Someone (phil?) kept saying think simple, so that's what I've done.


    SCJP 1.4, SCJD
    Robert Konigsberg
    Ranch Hand

    Joined: Jun 23, 2004
    Posts: 172
    > I have a lock manager but all it is a HashMap and 3 short lock, unlock, isLocked methods.
    >
    > Someone (phil?) kept saying think simple, so that's what I've done.

    That's what I presumed as well... I didn't understand the locking mechanism from the get-go, but it clarified over time, and with every clarification, I continued splitting functionality into smaller and smaller classes. That helped me test easily, too.

    Just my opinion.
    mike acre
    Ranch Hand

    Joined: Sep 23, 2003
    Posts: 197
    Originally posted by Robert Konigsberg:

    That's what I presumed as well...


    Are you saying you've ended up with something more elaborate?

    I know you've gone with locking on the client so I imagine it is a little more complex.

    I've only got about 50 lines of actual code in my lock class.

    I've tested concurrent access, each thread with its own lock, read, update, unlock cycle, and it seems okay, but I'm far from confident, being a bit of a rookie with concurrency.

    80 marks for 50 lines of code seems a bit unlikely!
    Robert Konigsberg
    Ranch Hand

    Joined: Jun 23, 2004
    Posts: 172
    Basically what I'm saying is that I separated the locking mechanism from the database IO, and merged them together with a third class. This meant I could test separate functionality and ensure I have confidently made each small piece (and subsequently, the larger ones) work.

    My LockMechanism class is 100 lines. Without code comments, it's 52 lines, the most complicated part is the validate method listed near the top of this posting.

    If you want to test database locking, and you had the B&S assignment, look for my old posting that contained sample code testing the database, including locking and concurrent row access. Look here:

    http://www.coderanch.com/t/185948/java-developer-SCJD/certification/Test-Code-DB-Locking

    RK
    Itapaj� Takeguma
    Ranch Hand

    Joined: Jul 21, 2004
    Posts: 41
    MUST run the GUI to preconfigure the application, by setting the port, IP and database locations


    Sorry, but I really did not understand that.
    You recomend that we have a kind of java.properties that says who is the remote host or where is the database file or what else, or you recomend that it should be configured in the GUI, for instance:
    1 - one type: java -jar... server
    2 - a frame asks for the database file, remote object name, and port
    3 - the user pressess start server
    4 - that's it

    Oh, by the way, how we configure the port number? I tried many times, but I just can't. (something like: Naming.rebindind("localhost:8080/Object", remoteReference))

    thanks,
    Itapaj�
    Robert Konigsberg
    Ranch Hand

    Joined: Jun 23, 2004
    Posts: 172

    quote: MUST run the GUI to preconfigure the application, by setting the port, IP and database locations

    Sorry, but I really did not understand that.
    You recomend that we have a kind of java.properties that says who is the remote host or where is the database file or what else, or you recomend that it should be configured in the GUI, for instance:
    1 - one type: java -jar... server
    2 - a frame asks for the database file, remote object name, and port
    3 - the user pressess start server
    4 - that's it


    I don't recommend a java properties file, it was in my requirements. Which project do you have? Mine is the Boggit & Scrapper contracting project.
    Itapaj� Takeguma
    Ranch Hand

    Joined: Jul 21, 2004
    Posts: 41
    My assignment is Bodgitt and Scarper, LLC. Oh, sorry for this long time without an answer.

    So you say that it is better if the user has to type in a GUI the remote object name and host name and so forth.. I seens nice to me. But I think I could still use a property file (thats what I am doing for now) so, when the user starts the program, a default value is inside the textFields.

    By the way, could You tell me how to change the server object listening port? When I try:
    [code]
    Naming.rebind("rmi://localhost:8080/remote_obj", remoteObj)
    [code]

    I allways get a connection refused, I think.

    thanks,
    Itapaj�.
    Clivant Yeo
    Ranch Hand

    Joined: May 22, 2004
    Posts: 124
    Hi Robert,

    How do you justify your use of Sockets instead of RMI? Did you admit that you don't know RMI? I also don't know RMI and don't wish to learn, how do I put it down in my design considerations?

    Rgds
    Clivant


    Clivant Yeo
    My Personal Website
    Paul Bourdeaux
    Ranch Hand

    Joined: May 24, 2004
    Posts: 783
    Wonderful score Robert - especially in the locking! Thank you very much for your insight and explanations!
    How do you justify your use of Sockets instead of RMI?
    Did you even need to justify this? My instructions state I can use either...


    “Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: My results, my Thanks and my Warning