wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Can I Defend this Design? Help Peter, Mark 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 "Can I Defend this Design? Help Peter, Mark" Watch "Can I Defend this Design? Help Peter, Mark" New topic
Author

Can I Defend this Design? Help Peter, Mark

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hello All,
After thinking about the design, the following is what I came up with. Please comment on this, I will really appreciate your comments. Peter, Mark, Eugene & Michael Morris(where is he by the way?) please help me out.
* public interface DataInterface has all the methods of Data. The methods over here throws DatabaseException and IOException
* public interface RemoteDataInterface extends Remote, DataInterface
* public class LocalData implements DataInterface. This is a Facade to Data
* public class RemoteData implements RemoteDataInterface and extends UnicastRemoteObject. The methods in here throw RemoteException and DatabaseException.
* public class RemoteDataFactoryInterface extends Remote
* public class RemoteDataFactory implements RemoteDataFactoryInterface and extends UnicastRemoteObject
* public class FBNServer starts the registry on a particular port.

Please comment on this design and let me know if I am headed in the wrong direction.
Thanks
-Amish
[ February 05, 2003: Message edited by: Amish Patel ]
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

On a quick glance it seems fine to me.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Thanks Mark! Now I am going to look at the MVC that you had proposed and the "hook" methods.
Peter please comment on the design!
-Amish
Jochen van Waasen
Ranch Hand

Joined: Jan 19, 2002
Posts: 33
Originally posted by Amish Patel:

* public class FBNServer starts the registry on a particular port.



Is it acceptable to start the rmiregistry manually?
Jochen
[ February 06, 2003: Message edited by: Jochen van Waasen ]
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Looks fine to me too. What purpose does the facade serve?
- Peter
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Peter,
I know that unnecessary code should be avoided and there is no need for LocalData, but I think that by providing this I am abstracting my client from the real Data object. If tommorow something changes in Data, LocalData will hide this from the client. Also I do not like client accessing Data directly. And lets say for some reason they want to synchronize client access at the Local level, then LocalData is well position to do that.
Please comment Peter. I know ultimately you will persuade me to remove LocalData. But please give me your honest opinion.
Thank You Very much.
Amish
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Jochen,
I am not starting rmiregistry manually, I am starting it through the FBNServer program. I think it is acceptable.
-Amish
Originally posted by Jochen van Waasen:


Is it acceptable to start the rmiregistry manually?
Jochen
[ February 06, 2003: Message edited by: Jochen van Waasen ]
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Originally posted by Amish Patel:
I know that unnecessary code should be avoided and there is no need for LocalData, but I think that by providing this I am abstracting my client from the real Data object. If tommorow something changes in Data, LocalData will hide this from the client. [...]
If tomorrow something changes in Data, and you can absorb this change in a wrapper class, that's great. That is the right moment to introduce the class. No earlier. Provided your design is clean, omitting it now will not at all prevent you from adding it in the future. All you'd have to change is the factory method that gives you your DataInterface object. But, chances are, it won't ever get that far.
These are very much the XP mantras. Do the simplest thing that could possibly work. KISS (Keep It Simple, Stupid -- but remember that KISS != HACK). YAGNI (You Aren't Gonna Need It).
Also I do not like client accessing Data directly.
That smells of superstition. You've got this requirement of having a client-side object that uses the Data interface; make the best of it. It's just an API. If and when it becomes necessary to wrap it, you can.
And lets say for some reason they want to synchronize client access at the Local level, then LocalData is well position to do that.
I sound like a broken record -- if for some reason that happens, great, go for it. Until then, YAGNI.
Please comment Peter. I know ultimately you will persuade me to remove LocalData. But please give me your honest opinion.
But then again, I might not. My mission here is not to turn everyone's design into a clone of my own -- G-d forbid. But IMHO the SCJD assignment is one of your great learning opportunities, a point where you can really think a design through and grow tremendously as a developer in a short space of time. And ultimately the design you come up with is one you will have to be able to defend; if you can successfully defend it against a "sparring partner" writing convincing design documentation is going to be a lot easier. If you can't defend it, on the other hand, your design is likely to have weak spots.
Don't get me wrong though. Your design as it stands is a fine one which will see you through the exam with flying colours. You can simply ignore me. But if you can convince yourself that I'm wrong, it's even better. Only in the unlikely event that you think I'm actually right you should drop that class.
- Peter
[ February 07, 2003: Message edited by: Peter den Haan ]
Qusay Jaafar
Ranch Hand

Joined: May 06, 2002
Posts: 127
Originally posted by Amish Patel:

* public class RemoteDataFactoryInterface extends Remote

I think you want to say:
* public interface RemoteDataFactoryInterface extends Remote
Do you???


Qusay
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Provided your design is clean, omitting it now will not at all prevent you from adding it in the future

I agree with this. I was just thinking about the future that for the future it will be good. But I agree with what you say.
You've got this requirement of having a client-side object that uses the Data interface; make the best of it. It's just an API. If and when it becomes necessary to wrap it, you can.

I completely forgot about that, No matter what my local client will be dealing with DataInterface and not LocalData. Whatever object is instantiated the client will use the DataInterface it will not be concerned about whether LocalData or Data in instantiated.

I sound like a broken record -- if for some reason that happens, great, go for it. Until then, YAGN

As for as syncronization is concerned, I kindda disagree. But then again I do not know whether I should be thinking so much far ahead. And it is not like I am creating a suite of objects for this. It is just one class with very minimal impact on the overall design.


My mission here is not to turn everyone's design into a clone of my own -- G-d forbid

I know Peter. I was just joking. I apologize for this. Only if it sounds good and I am convinced and I can defend, will I take it out.

Thanks for all your help Peter!
-Amish
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Originally posted by Qusay Jaafar:

I think you want to say:
* public interface RemoteDataFactoryInterface extends Remote
Do you???


Yes
-Amish
 
 
subject: Can I Defend this Design? Help Peter, Mark