Can anyone explain to me, at length, how to use IOC containers?

后端 未结 7 1751
执笔经年
执笔经年 2021-02-05 15:47

I use dependency injection through parameters and constructors extensively. I understand the principle to this degree and am happy with it. On my large projects, I end up with t

7条回答
  •  春和景丽
    2021-02-05 16:44

    Jeremy Frey misses one of the biggest reasons for using an IOC container: it makes your code easier to mock and test.

    Encouraging the use of interfaces has lots of other nice benefits: better layering, easier to dynamically generate proxies for things like declarative transactions, aspect-oriented programming and remoting.

    If you think IOC is only good for replacing calls to "new", you don't get it.

提交回复
热议问题