• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can I Defend this Design? Help Peter, Mark

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On a quick glance it seems fine to me.
Mark
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ]
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks fine to me too. What purpose does the facade serve?
- Peter
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ]
 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Amish Patel:

* public class RemoteDataFactoryInterface extends Remote


I think you want to say:
* public interface RemoteDataFactoryInterface extends Remote
Do you???
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Qusay Jaafar:

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



Yes
-Amish
 
I'm just a poor boy, I need no sympathy, because I'm easy come, easy go, little high, little low, little ad
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic