Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Switching modes for local/network client

 
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.
 
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 ]
 
My, my, aren't you a big fella. Here, have a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic