Why are IOC containers unnecessary with dynamic languages

后端 未结 9 1458
慢半拍i
慢半拍i 2020-12-04 12:13

Someone on the Herding Code podcast No. 68, http://herdingcode.com/herding-code-68-new-year-shenanigans/, stated that IOC containers had no place with Python or Javascript,

9条回答
  •  星月不相逢
    2020-12-04 13:01

    IoC provides a mechanism to break the coupling you get when an object calls 'new' on another class.

    It's naive view on IoC. Usually IoC also solves:

    • dependency resolving
    • automatic component lookup and initialization (if you use 'require' with IoC, there's something wrong)
    • works not only with singletons but also with dynamic scope
    • 99.9% of time it's invisible for developer
    • eliminates need of app.config

    full article You underestimate the power of IoC

提交回复
热议问题