Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is this good design?

 
Vaishali Paramane
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I just want to confirm that following is good design or has there any other choices?

In controller I wrote following -

private DBMain connection;

private RemoteInterface remoteConnection;

Mode mode;


find(){
if(mode=="netwrok")
remoteConnection.find();
else
connection.find()
}


checked mod same as all method .

is this correct? or as(DVD project) I have to use DBMain reference for both.

Thanks for help.

Vaishali
 
Chris Be
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vaishali,

I am not using the mode beyond the initial application initialization. I have created a wrapper interface around my DBAccess interface which exposes the business methods search(...) and book(...). Both methods throw IOExceptions. For local use catering for the data file access IO exceptions, for a remote call catering for IO AND remote exceptions (RemoteException extends IOException). This way I can pass the respectieve local or remote implementation (using adapter pattern) behind the same interface to the client/controller to search and book. This way there is almost no coding required for adapting local implementation to rmi implementation.

Together with Ken Krebs's stunning simplicity design, this article provides the theoretical insight.

Hope this helps.
 
Vaishali Paramane
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Chris Be

I am also created RemoteInterface interface and RemoteInterfaceImpl class
but in my sun provided DBMain interface hasnot throws IOException.
I am also tryed lots of way but its didnot work thats why I design like that.

Can you explain me more?

My class flow

controller
|
connector
|
DatabaseFactory
|
DatabaseFactoryImpl ----- DatabaseFactory
|
|
RemoteInterfaceImpl ----- RemoteInterface
|
Data --- DBMain
|

DBAccess LogicalLock

Again Thanks for help me

Vaishali
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic