mercredi 18 novembre 2015

Factory, dependency injection, or something else

What to do in situation of complex object creation like following:

A a = new A();
B b = new B(a);
C c = new C(b);

Should I try to create some kind of factory in this case, or to use dependency injection container, or perhaps some kind of builder?

To be concrete, I would like to achieve something like:

C c = factory.createC();

Aucun commentaire:

Enregistrer un commentaire