File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes 2 Questions (lock, general) 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 "2 Questions (lock, general)" Watch "2 Questions (lock, general)" New topic

2 Questions (lock, general)

Matt Ghiold
Ranch Hand

Joined: Feb 24, 2002
Posts: 213
Hey All,
I just downloaded my exam the other day, and have been working on my design and I have two questions if you all do not mind.
Lock/Unlock: I was thinking of a static hashtable that holds the record number as a key and the gui id that has that lock as the value. Am I making this to simple?? Or, is that what most others have done?? ( Yes, I have read a lot of the other posts, but I have this icky feeling that my solutions is to simple, so it's probably wrong?)
This is more of a general question, when the gui boots on the PC we need to allow the user to choose a network mode, or a local access mode. Can you make the user specify this at run time?
ie. java etc and if they don't include a localhost/port then they get the not networked version? I am curious how best to design this.
Any thoughts would be greatly appreciated.
Thank's in advance for any advice.

-Matt<br /> SCJP2<br /> SCJD
Richard denSeig
Ranch Hand

Joined: Apr 06, 2002
Posts: 32
Hi Matt,
You're in the right place to get *really* good help. I am just finishing up my project and I don't think it would have gone as well as it has...but; I've not been graded yet, so...we'll see.
To answer your questions:
1) you are on the right track with the lock and only suggestion would be to use something like a HashSet or HashMap... depending on how you design this part...the HashSet is problably a better performer though; but, I have heard of designs where the key, value aspect of the Map was paramount over HashSet performance.
2) Good question...I did mine and allowed the user to enter commandline args to client and server. The args indicate the mode of operation; however, I know others here have used gui's to prompt the user when the program is loading...and I think I remember someone said they change mode dynamically from a menu, and still others who allow the parameters to be entered as java properties -Dargs at JVM startup.
There really is no single correct way to do anything in this assignment...except you can't go wrong to complete it and use this as a learning experience!
All the rest, depends on how much time you have or are willing to put into the project.
As far as simplicity...go for it!!
When in doubt always defer to the simplest route which covers all the requirements of the specification...that is what you must code to.
One thing I found is that as you begin to code, your mind is thinking in one you progress, your mind sees new paths...this is good and bad as you must focus on one path and not wonder about. This is also a program marking point: the evaluator looks for consistency in, read the posts here, ask questions, as you are doing.
I hope this $.02 worth is helpful...good luck!
Matt Ghiold
Ranch Hand

Joined: Feb 24, 2002
Posts: 213
Thank's alot for help, it was of great use to me. I did a lot more reading of the forum in my daze last night, and came across a post about implementing a connection factory, so I am going to investigage that as well.
Thanks again for responding so quickly!
I agree. Here's the link:
subject: 2 Questions (lock, general)
It's not a secret anymore!