Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Switching modes for local/network client

 
Reshma Das
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iam confused with design for Switching modes for client.
I was planning to write Interface1. Then implement them in 2 different interfaces LocalInterface ,
RemoteInterface which throws Remote Exception
both of them will implement the public methods for Data class.
My serverclass will extend RemoteInterface.
In my client i will have
if( i==1)
interface1 = new Data();
else
interface1 = (RemoteInterface)Naming.lookup(url);
Will this approach work ?
pls reply asap.
 
Gennady Shapiro
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how about this...
AbstractClientData data = ConnectionFactory.getConnection(CONNECTION_MODE);
the questions to ask are:
1. why use a factory?
2. why use an abstract class instead of interface? or why not use both?
3. what type of exception should getConnction() throw?
This will help you with your docs too.
[ January 29, 2002: Message edited by: Gennady Shapiro ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic