wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Connection Design Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Connection Design" Watch "Connection Design" New topic
Author

Connection Design

Brian Blignaut
Ranch Hand

Joined: Jan 08, 2003
Posts: 61
Hi,
My design is as follows :
On the client side I have the following
Connection - Interface which defines all the methods of the data class.
RemoteConnection - Implements Connection and provides remote data access
LocalConenction - Implements Connection and provides local data access.
On the server side I have the following
RemoteConnectionFactory - Interface for a factory that creates connections
RemoteConnectionFactoryImp - Implements RemoteConnectionFactory and creates connections
ClientConnection - Interface which defines all the methods of the data class.
ClientConnectionImp - Implements the ClientConnection interface. Each client that connects will receive it's own instance of this class

My question is, should the ClientConnection interface extend the Connection interface instead of defining it's own methods, this way I could get rid of the RemoteConnection class
Any suggestions would be greatly appreciated
Brian
Brian Blignaut
Ranch Hand

Joined: Jan 08, 2003
Posts: 61
Anyone?
Max Habibi
town drunk
( and author)
Sheriff

Joined: Jun 27, 2002
Posts: 4118
Hi Brian,
How does a local client get a connection? Does your GUI have to be smart enough to know that it's using a local connection, or do you want provide a general Connection Factory: one that decides if it, in turn, needs a LocalConnection or a RemoteConnection? I'm not suggesting that one way or another is correct: I'd just like to hear your approach.
All best,
M, author
The Sun Certified Java Developer Exam with J2SE 1.4


Java Regular Expressions
Brian Blignaut
Ranch Hand

Joined: Jan 08, 2003
Posts: 61
The user would select what type of connection they wish to establish. And yes, I do have a connection factory is responsible for creating the actual connection.
Brian Blignaut
Ranch Hand

Joined: Jan 08, 2003
Posts: 61
Sorry to answer the other question, the the GUI does not need to have any concept of what type of connection it is working with, that is totally transparent, all the GUI knows is that it has a connection (Connection Interface)
Qusay Jaafar
Ranch Hand

Joined: May 06, 2002
Posts: 127
In my design, using MVC in GUI. Controller connects to Abstract Factory pattern which returns ConnectionFactory (Local or Remote). LocalConnection class connects to DataAdapter class which connects to Data class. RemoteConnection class connects to RMI using proxy and adapter pattern.
I didn't finish yet from coding but I think the design is alright.
Max,
I read your book. A beautiful design there. Although Nobody lost points for not implementing ClientID, I will use ClientID in my design, that's why I used Abstract Factory, proxy and adapter patterns. I think you know many members takling about unlock() method documentaiton, so it is a chance to learn something here.
Regards


Qusay
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Connection Design