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

Client-side DataServerFactory

 
Aaron Dressin
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. Initially I was using the Factory pattern to create the appropriate DataServer<interface> implementation... Remote or Local, depending on the connection preferences of the user. These 2 implementations wrap the remote RMI Data reference, or the local Data respectively. I have also read many posts regarding this solution to the client side connection.
I have abstracted most of the functionality for these 2 implementations into an Abstract class. In fact, the only code that ends up in the 2 subclasses is the constructor, which intializes the appropriate Data member (either to the remote reference or the local Data).
My concern is that it seems a bit overboard for me to have these 2 subclasses when all they do is have a constructor, while I could simply add 2 constructors to the abstract class and change it to be concrete.
Any ideas or comments?
Thanks,
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your Factory at the client, instead of creating the implementation of DataServer for local or remote, create/find the instance of the Data (local/remote) and pass the Data instance to the only constructor in DataServer implementation class. I would also name the client side DataServer implementation as DataProxy.
Client Facade -> ClientDataFactory(creates or finds the Data instance) -> DataProxy (holds a reference to Data) ->Data
[ May 20, 2002: Message edited by: Sai Prasad ]
 
Aaron Dressin
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ahhh. Thanks for the direction! Funny... I originally had the factory focused on the Data rather than the "server/proxy"... but I lost that focus somewhere.
Cheers!
 
Aaron Dressin
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ahhh. Thanks for the direction! Funny... I originally had the factory focused on the Data rather than the "server/proxy"... but I lost that focus somewhere.
Cheers!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic