Ioc Containers and dynamic languages (take 2)

I've been reading up a lot on Dependency Injection, Inversion of Control, and IoC containers. I also primarily program in dynamic languages (PHP at work, Python at home). Here are the things I'm finding, but this leaves a lot of gaps for me to fill as I piece it all together:

So what I'm reading is: IoC containers are a much bigger deal in static languages, because it's so much easier to perform DI in dynamic languages. But they also provide benefits far beyond DI, like managing dependencies for you and saving you from having to string together a dozen objects by hand. And, incidentally, they are complicated, so don't try to do them yourself (but no good ones exist for PHP).

I feel like this information leaves me kind of... stuck. What do I do with it? I work in a very large codebase, with very complicated dependencies (and probably a strong need for refactoring, but that's another parallel issue). We've done very poorly at implementing DI up till now, and I'm really trying to turn us in the right direction. There just seems to be nothing out there in regards to dynamic languages and IoC (or at least IoC containers).

Am I better off "hand-stringing" dependencies together for the time being, and worry about automating it in a container later, after I get a better handle on the principles? Is it worth implementing my own simple IoC container? Or is the benefit just not ultimately worth the cost in PHP?

5
задан Community 23 May 2017 в 12:06
поделиться