One of our community’s favorite arguments, right after Vim versus Emacs and static versus dynamic typing, is whether object oriented programming is boon or bane. Like those other arguments, there is more often heat than light in the discussions.
Brian Will has an excellent video and associated blog post that examines the question in a reasonable way and comes to a conclusion. Of course, some people—once they hear that conclusion, whatever it is—will immediately conclude that Will is a lunatic and disregard everything he says without actually considering his argument. For that reason, I’m tempted not to say what that conclusion is but Will is up front with his verdict by naming the video Object Oriented Programming is Bad and his blog post Object Oriented Programming: A Disaster Story.
But why does Will reach that judgment? OO, he says, is an attempt to manage shared state. It does that by encapsulating the state in objects and accessing it only through messages to the objects. In other words, what would otherwise be global variables are hidden away in objects and managed through the call graph.
The problem is that when you take this idea seriously you end up not with a graph of objects but with a strict hierarchy of objects. That would be okay but when you have a non-trivial amount of state it turns out to be impractical keep state manipulation in the same hierarchy so programmers end up passing around references to the state obviating the point of encapsulating it in objects.
Controlling state is the right end, Will says, but object oriented programming is the wrong solution. The right answer, he says, is to minimize state by using functional programming techniques.
The foregoing is just a prĂ©cis of Will’s argument, which is a bit more nuanced, so you should definitely watch the video (it’s about 45 minutes) or at least read the blog post if you have any interest in the subject matter. When you do, you’ll discover that Will doesn’t dismiss every aspect of OO and that objects can be useful in some circumstances. As I said, you should watch the video.