FactoryPattern: Difference between revisions

From Wiki RB4
 
Line 11: Line 11:
* lots of coding for factory classes
* lots of coding for factory classes
* compile time depency leads to high build times
* compile time depency leads to high build times
==Alternatives==
* explicit injection by parameter of the ctor

Latest revision as of 13:21, 2 February 2010

Factory Pattern

Instead of calling new X() in java code you use XFactory.get()

Advantages

You have a decoupling of the actual type, which is good for:

  • testing
  • different environments

Disadvantages

  • lots of coding for factory classes
  • compile time depency leads to high build times

Alternatives

  • explicit injection by parameter of the ctor