The moose likes OO, Patterns, UML and Refactoring and the fly likes Pattern for object creation & usage thru a parameter Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Reply Bookmark "Pattern for object creation & usage thru a parameter" Watch "Pattern for object creation & usage thru a parameter" New topic
Author

Pattern for object creation & usage thru a parameter

Nico Van Brandt
Ranch Hand

Joined: Mar 31, 2011
Posts: 66

Hello,

I have this case;

For the moment I have a DataAccess class (let's call it DA 1) that communicates with an Oracle database.
Now I need a second DataAccess (DA 2) which does all the same stuff except with a User Archives database (PCS7)

Based on a parameter in a config file I will create an instance of DA 1 or DA 2.

I know how to do this technically (with an interface) but I was wondering .. isn't there a Design Pattern for this?

thank you!


Oracle Java SE6 Certified Programmer
Oracle Java EE5 Certified Web Component Developer
Nico Van Brandt
Ranch Hand

Joined: Mar 31, 2011
Posts: 66

Never mind, it was the Simple Factory Pattern that I was searching
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2207

Yes. Thanks for posting the solution.
Rudy Gireyev
Ranch Hand

Joined: May 03, 2011
Posts: 37
Nico Van Belle wrote:
I know how to do this technically (with an interface) but I was wondering .. isn't there a Design Pattern for this?

thank you!
I'm curious to ask, if I may, why do you feel that you need a design pattern for something like this? Realistically speaking does it offer something to you that your own solution does not?

 
 
subject: Pattern for object creation & usage thru a parameter
 
Threads others viewed
DataAccessRemote Beta 1.4
a question about RMI implementation's concept
How to test the implemention of Singleton pattern?
My design works perfectly but is it ok...?
Please comment my design
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture