The PHP 7 Revolution: Return Types and Removed Artifacts

Continuing the discussion from The PHP 7 Revolution: Return Types and Removed Artifacts:

haha wow. That article is so full of false equivalences and things that hint at poor separation of concerns. This line is a brilliant example of a fundamental lack of understanding of basic OOP principals:

If you’re not using an object that was passed in then your class is doing too much[1] and you need to redesign the class or move some responsibilities around.

However, this actually gives us an insight into tony’s position. He’s building on top of a fundamental lack of understanding, so for the problems he’s trying to solve (that exist because he is building on top of shaky foundations) his solutions to the (wrong) problems he presents are technically along the right lines: when you have cornered yourself by making a class that does too much, then in this example, it is better to load the dependency if it’s needed. Of course that’s only true if you take his premise as true that the problem is that dependency may not be used, rather than the original class is doing too much.

If you build your water pipes out of lead then a water filter in every house sounds like a good idea. Of course most people would choose to build their pipes out of something less harmful saving them time and money.

[1] http://misko.hevery.com/code-reviewers-guide/flaw-class-does-too-much/