F
Frank Rizzo
Don't mean to start a flame as it always does, however, I've implemented a
small project using IoC and I am beginning to question whether it really
adds flexibility to the application or just adds another useless layer of
indirection.
Case and point. There is a class called OrderProcessor that takes IOrder
and IOrderRules in the constructor. Of course, both IOrder and IOrderRules
are defined in the IoC container. Now at this point, and forever going
forward, there is only 1 implementation of IOrder (StandardOrder) and
exactly 1 implementation of IOrderRules (CompanyRules). That's all there
will ever be, or otherwise the entire IoC setup breaks apart.
Sure, OrderProcessor does not have a dependency on the hardwired
StandardOrder and CompanyRules classes, but, all the same, it has a
dependency on IOrder and IOrderRules. I simply don't see what this level of
indirection gives me other than more complicated debugging, having to
explain to newbies the whole IoC paradigm (and why it's useful), more files
in the solution, etc...
If anyone has experience implementing a successful IoC based application,
please enlighten me as to what was gained (or not) by adding IoC into the
app.
Regards
small project using IoC and I am beginning to question whether it really
adds flexibility to the application or just adds another useless layer of
indirection.
Case and point. There is a class called OrderProcessor that takes IOrder
and IOrderRules in the constructor. Of course, both IOrder and IOrderRules
are defined in the IoC container. Now at this point, and forever going
forward, there is only 1 implementation of IOrder (StandardOrder) and
exactly 1 implementation of IOrderRules (CompanyRules). That's all there
will ever be, or otherwise the entire IoC setup breaks apart.
Sure, OrderProcessor does not have a dependency on the hardwired
StandardOrder and CompanyRules classes, but, all the same, it has a
dependency on IOrder and IOrderRules. I simply don't see what this level of
indirection gives me other than more complicated debugging, having to
explain to newbies the whole IoC paradigm (and why it's useful), more files
in the solution, etc...
If anyone has experience implementing a successful IoC based application,
please enlighten me as to what was gained (or not) by adding IoC into the
app.
Regards