Dependency Injection Constructor Madness
Posted
by JP
on Stack Overflow
See other posts from Stack Overflow
or by JP
Published on 2010-03-10T20:08:14Z
Indexed on
2010/03/11
5:33 UTC
Read the original article
Hit count: 727
I find that my constructors are starting to look like this:
public MyClass(Container con, SomeClass1 obj1, SomeClass2, obj2.... )
with ever increasing parameter list. Since "Container" is my dependency injection container, why can't I just do this:
public MyClass(Container con)
for every class? What are the downsides? If I do this, it feels like I'm using a glorified static. Please share your thoughts on IoC and Dependency Injection madness.
Thanks in advance.
-JP
© Stack Overflow or respective owner