• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Some tips ...

 
Romeo Dickason
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've received a lot of help from this forum and would like to return the favour in my own little way ...

Well, I just got my results and passed with the following marks, with which I'm both happy and disappointed, but I passed and that's what counts: :roll:

General Considerations (maximum = 100): 100
Documentation (maximum = 70): 70
O-O Design (maximum = 30): 30
GUI (maximum = 40): 28
What happened here?? Was pretty chaffed with my GUI??
Locking (maximum = 80): 44
Expected this, looks like 90% of people get this, the rest of us still
looking for the golden solution

Data store (maximum = 40): 40
Network server (maximum = 40): 40

This is how I approached the assignment:

  • The first thing I did was to implement the data class with some private helper methods to read all the records (including deleted), read the first deleted record, read all live records etc. I tested all the implemented and private methods until I was happy it works the way it should.
  • I wanted my GUI to be independent from remote or local client calls. So I wrote an adapter class to decide if the database should be called directly (local) or via the remote server (remote). When the application starts up I had an application initializer class (Singleton) that would be used throughout the application to indicate the mode the app was started in.

  • The client never calls the database or server methods directly, the adapter class makes this decision.
  • Like I said, the GUI itself never knows if it is local/remote. The GUI calls the adapter class and it will then decide using the application init class if it is a local or remote client.
  • I created a serializable Booking class that was populated by the data class with the search results, added to a Bookings collection class, and this was passed around between the client, database etc.


  • The above pointers helped me to separate all the layers and made it quite simple for me to locate and fix problems.

    A word of advice, KEEP IT SIMPLE BUT EFFECTIVE. If you encounter a problem, refer to your literature, this wonderful website (thanks guys!! ),
    and then decide what you're going to do and stick with that! Otherwise you'll be busy with this forever. I've found a lot of different ways to resolve an issue on this website and the literature I used, I read it, took note, decided which will suite my domain best, implemented that, AND THEN MOVED ON ...

    I really hope this helps a bit!

    All the best and good luck!!!


     
    Yupp Cook
    Ranch Hand
    Posts: 49
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Congrats Romeo

    Can you describe a little your locking approach? Since you didn't get full points in this part, would be interested to find out what there is to do to get full score.
    Yupp
    [ March 05, 2006: Message edited by: Yupp Cook ]
     
    Andrew Monkhouse
    author and jackaroo
    Marshal Commander
    Pie
    Posts: 12007
    215
    C++ Firefox Browser IntelliJ IDE Java Mac Oracle
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Congratulations on passing Romeo, and thanks for posting your tips.

    Regards, Andrew
     
    Romeo Dickason
    Greenhorn
    Posts: 7
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Can you describe a little your locking approach? Since you didn't get full points in this part, would be interested to find out what there is to do to get full score.
    Yupp

    Well, basically my locking worked like this, I'm not sure what needs to be done to obtain full marks, I've read about several approaches to locking.
  • I had methods in the adapter class with several searchXXX()'s, createBooking(), updateBooking(), deleteBooking() etc. These methods will call the relevant methods in the data class directly (local) or via the server (remote).
  • If any of the above methods called a method in the data class that required a lockCookie, I would first lock the record via the lock() in the data class.
  • Only the update() and delete() methods required a lockCookie as a method param, and I would only lock a record for these methods.
  • The above mentioned methods that requires a lockCookie would unlock the record itself, I did not leave it up to the calling method to do so.
  • I DID NOT check if the record still exists (not subsequently deleted) while locked before executing the relevant operation, I initially did but took it out before submitting the assignment as this made more sense. It was well documented in my javadoc.
  • I had a collection with all the records numbers and cookies for the locked records.
  • All access to this collection was synchronized.


  • That's basically that. I thought that my solutions was good and did not try to overcomplicate the issue, but looks like I was wrong ...
    :roll:

    May Andrew can have a look at my above points and give you some improvements on my approach.

    All the best!

    Romeo
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic