• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About the non-network mode

 
Ye Lee
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to the instruction, the non-network should " not use the network server code at all". Does that mean if I implement the network by RMI, I should write two versions of the model and view components? One for RMI and one for non-rmi? I feel awful about the pattern since most of the codes for RMI and non-RMI components in this case are the same and I think that's a violation of code reusability.

So, what the hell is the meaning of "must not use the network server code at all"?

Thanks! BTW, this is B&S 2.2.3
[ September 23, 2008: Message edited by: Ye Lee ]
 
Justin Rundle
Ranch Hand
Posts: 123
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly what it says, i mean lets think about the biggest different between using object locally (same JVM) and remotely... objects that can be invoked remotely implement Remote and extend UnicastRemoteObject... right?

Well a good start would not to use these objects...

However in saying that it the spec doesnt mention anything about the server code not using the local code.... hmmm ever heard of the decorate design pattern...?

Good luck!
 
Jeffry Kristianto Yanuar
Ranch Hand
Posts: 759
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's my solution, I have Data class with encasulated by server in "networked-mode" but in the "alone" mode, the client GUI use it directly.

Hope that's help

Jeffry Kristianto Yanuar "Java Instructor"
SCJP 5.0, SCJA, SCJD (Working on UrlyBird 1.3.2) --> preparing to upload
 
Adrian Engler
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that is the main point: to be able to use the server/db functionality either over the network or locally and to do so with as little code duplication as possible (so, you should not have the same functionality twice with and without RMI, but be able to bypass RMI).
 
Justin Rundle
Ranch Hand
Posts: 123
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As everyone suggests the Decorate pattern, develop a local implementaton then develop the remote implementation that wraps the local implementation, code reusage, ie.:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic