aspose file tools*
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
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: 2499
    
    8

Yes. Thanks for posting the solution.


OCUP UML fundamental and ITIL foundation
youtube channel
Rudy Gireyev
Ranch Hand

Joined: May 03, 2011
Posts: 39
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?

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Pattern for object creation & usage thru a parameter