Link to home
Start Free TrialLog in
Avatar of Eindoofus
Eindoofus

asked on

How does one usually make a Factory choose between multiple Impl classes?

I need to make a Factory choose between multiple Impl classes and I would like to know what the best practice is for this? How does one typically pass the data from a class to the ImplFactory in order to choose the appropriate Impl for that class while still maintaining good design principles?

--
I would prefer a thoughtful conceptual answer. No quick posting or links please.
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If that seems like overkill (could be for just one class) then the following is good
java -Dimpl.class=foo.bar.SomeImpl YourApp

Open in new window

Avatar of Eindoofus
Eindoofus

ASKER

Could you please elaborate a bit more on "b" and "c"? I'm having a hard time understanding them. If you have any code as an example I would greatly appreciate it.
I'm going to abandon my first suggestion if favour of my second - unless you have several classes that have to be selected
1:
java -Dimpl.class=foo.bar.SomeImpl YourApp

Open in new window


I'm not sure if we are on the same page. Can you please take a look at my other question to see what I am doing:

http://www.experts-exchange.com/Programming/Misc/Q_27390758.html


:)