Sandi Metz tries to solve Object Oriented problems with composition

(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: lawrence@krubner.com

Kind of sad:

She says “We love dependency injection”.

First she acknowledges that the “proper” Object Oriented approach leads to more code for the same behavior:

but then she says the solution is to use composition, which offers all kinds of flexibility:

She says it is wonderful because in the end we get “pluggable behavior”.

But if it is a good idea to pull certain methods out of an object, and make them independent, in an object that can then be injected in lots of different places, why not go all the way down that road, and remove all methods from all objects, and thus achieve complete independence of data and behavior, so we never again have to have these kinds of discussions? And then maybe the data can be immutable? That is, go for something like the modern Functional style?

Source