aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Design choices and Synchronization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Design choices and Synchronization" Watch "Design choices and Synchronization" New topic
Author

Design choices and Synchronization

Ravikiran Vishnuvajhala
Ranch Hand

Joined: Jan 11, 2006
Posts: 30
Hi,

I am working on the SCJD assignment URLyBird 1.3.3. I have the following question about the design choice for implementing mandatory features in the UI -

While going through the SCJD book by Andrew Monkhouse and Terry Camerlengo, I noticed that all the methods provided in the DBClient Interface are not exposed as actions in the UI (For Example: Adding a DVD or removing a DVD, NOT return or rent). Does that mean if instructions don't specifically mandate us to expose all the methods present in the Interface provided by Sun as actions in the UI, we can use our discretion. Would that be a candidate for design choice?

Also, I have another question regarding the synchronization from the SCJD book.

In the book, you are synchronizing the database object (RandomAccessFile) in the persistDVD method. I noticed that database object is a static variable. I understand that only one user will have the lock on this at any given time as long as all the users accessing the Application using the same JVM, but if I invoke the application in the "alone" from my machine twice. Then, I assume they are running in two different JVMs. If I am able to somehow update the same record from both the sessions (let us assume this is possible - may be two users sharing the same server), will there not be a problem. Or, am I not understanding something here.

Thank you for your inputs.

Thanks
Ravi
[ February 11, 2007: Message edited by: Ravikiran Vishnuvajhala ]
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11432
    
  85

Hi Ravikiran,
... if instructions don't specifically mandate us
Check your instructions for text like "You will not receive extra credit points for work beyond the requirements of the specification." If you have this, then you do not have to do anything that is not mandated.
Would that be a candidate for design choice?
... but if I invoke the application in the "alone" from my machine twice. ...
Check your instructions from Sun for text along the lines of "You may assume that at any moment, at most one program is accessing the database file". If you have that text, then you do not need to worry about the case where someone starts two instances of the client or two instances of the server.

Regards, Andrew


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

Joined: Jan 11, 2006
Posts: 30


"You may assume that at any moment, at most one program is accessing the database file"


It was my mistake in interpreting this!!!.

Thank you for your answers Andrew.

- Ravi
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Design choices and Synchronization