This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Need you comment on my final review 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 "Need you comment on my final review" Watch "Need you comment on my final review" New topic
Author

Need you comment on my final review

Sam Stackly
Ranch Hand

Joined: May 04, 2002
Posts: 109
Hi Guys,
I am almost done with code and everything and really appreciate your comments about my design,
My design is very similar to Jim Bedenbaugh(I posted there, but nobody replied ), except in my Facade class (DataAccessor) which has an instance of DataInterface as a member variable (DataInterface include all public method for Data class), I changed Data class to implement this interface and my RemoteDataInterface implements this interface too.
Now in my DataAccessor I have two ctor for local and remote connection (to get connection factory first and then calling getDataServer method to get RemoteDataInterface) and two methods for search and book flight. DataInterface instance play a Data class no matter if is remote or local.
So it means I didn�t add criteriaFind method inside of Data Class neither lock and unlock method. In server side (DataServer class) I create an instance of LockManager to deal with lock and unlock (passing recordNumber and <this> as a reference to DataServer )
Again I appreciate your comments,
Sam
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Sam,

So it means I didn�t add criteriaFind method inside of Data Class neither lock and unlock method. In server side (DataServer class) I create an instance of LockManager to deal with lock and unlock (passing recordNumber and <this> as a reference to DataServer )

I did essentially the same thing. criteriaFind was a method in my DataAccess interface though, it's not clear from your post if that's your situation as well. I am proof that there is no requirement to implement lock, unlock and criteriaFind in Data, so don't concern yourself with that.
If you have read all the posts on Jim's design then I would say your good to go.
Hope this helps,
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Sam Stackly
Ranch Hand

Joined: May 04, 2002
Posts: 109
Thanks Michael, You are always here and supportive, I exactly did the same way you did
What's your opinion on implementing DataInterface in Data class?
I changed it to
public class Data implements IDataInterface

Thanks again
Sam
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Sam,

What's your opinion on implementing DataInterface in Data class?
I changed it to
public class Data implements IDataInterface

I did not because two of the main points of my design were to only do the bare minimum to Data and to keep it hidden as much as was possible. In my design, only scarce few classes even knew there was a Data class and all of those were in the db package. The only reason I could see to have Data implement IDataInterface (or DataAccess in my case) is that if you actually use a Data object in local mode as your IDataInterface reference for db calls. One further reason that I could not have Data implement DataAccess was that there was no criteriaFind method in Data in my design. I would have had to put an empty criteriaFind in Data to fulfill the interface contract.
Hope this helps,
Michael Morris
Sam Stackly
Ranch Hand

Joined: May 04, 2002
Posts: 109
Michael,

The only reason I could see to have Data implement IDataInterface (or DataAccess in my case) is that if you actually use a Data object in local mode as your IDataInterface reference for db calls

Well I use IDataInterface as a refrence in both server and local mode, coz my RemoteDataInterface extemds from IDataInterface and java.rmi.remote
so I can have one parent interface instance no matter if I am connecting localy or remotly
does it sound right?
Sam
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Sam,
What I'm getting at is, is the local mode IDataInterface reference that you make calls on in your Facade actually a Data object? For example do you do something like:

This is obviously contrived code, but the point is that MyDataFacade accepts an IDataInterface in its constructor on which all db calls will occur but in the case of local mode that IDataInterface is actually a Data object. If you are not having Data implement IDataInterface for this or a similar reason, then I think it is unnecessary and restrictive to future enhancements in that you have now forever forced Data into a contract that it need not be forced into.
Hope this helps,
Michael Morris
[ August 21, 2002: Message edited by: Michael Morris ]
Sam Stackly
Ranch Hand

Joined: May 04, 2002
Posts: 109
Michael ,
What I did in my Facade class is from two ctor (one for client side and one for server side) I call getDB method, Which create an instance of Data object and assign it's reference to member instance of my DataInterface Interface in local mode or call remotely to get DataFactory interface instance (as a first remote object) and then call getDataServer method of DataFactory to get an instance of my RemoteDataInterface and then assign it to DataInterface Interface,
In this scenario I'll deal with one interface which is represent Data class in local mode and RemoteDataServer(or remote Data class) in server mode, I did test it and it worked find , but I don't know if it's right form OO Design point of view.
Regards,
Sam
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need you comment on my final review