4 ms·
The article is overly dramatic about DI. Parts of it sound like a mere "get off my lawn!" rant against OOP in general (godwinning just few paragraphs in). Ther
by pornel 12y ago
The article is overly dramatic about DI. Parts of it sound like a mere "get off my lawn!" rant against OOP in general (godwinning just few paragraphs in).
There's praise for the Singleton antipattern, variables with an "obj" prefix as if objects were an odd thing to watch out for. There's an example of polymorphism achieved by setting a global variable before including a script. PHP (v4!) written like that would be icky even in 2011.
There is some good advice in there too, but overall design it advocates for seems to reduce OOP to mere namespacing of global variables and functions. I'm assuming the author doesn't use unit tests either (given that TDD is "poppycock!"). It's not surprising that DI doesn't fit that way of building programs, but I don't think that makes DI evil. It's just a tool for a different job.