• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pattern for object creation & usage thru a parameter

 
Nico Van Brandt
Ranch Hand
Posts: 70
IntelliJ IDE Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Nico Van Brandt
Ranch Hand
Posts: 70
IntelliJ IDE Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never mind, it was the Simple Factory Pattern that I was searching
 
Jan Cumps
Bartender
Posts: 2588
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. Thanks for posting the solution.
 
Rudy Gireyev
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic