FactoryPattern

From Wiki RB4
Revision as of 13:21, 2 February 2010 by UweHeuer (talk | contribs) (→‎Factory Pattern)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Factory Pattern[edit]

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

Advantages[edit]

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

  • testing
  • different environments

Disadvantages[edit]

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

Alternatives[edit]

  • explicit injection by parameter of the ctor