Senior full-stack engineer Ilya Suzdalnitski recently published a lively 6,000-word essay calling object-oriented programming “a trillion dollar disaster.”
Precious time and brainpower are being spent thinking about “abstractions” and “design patterns” instead of solving real-world problems… Object-Oriented Programming (OOP) has been created with one goal in mind — to manage the complexity of procedural codebases. In other words, it was supposed to improve code organization. There’s no objective and open evidence that OOP is better than plain procedural programming… Instead of reducing complexity, it encourages promiscuous sharing of mutable state and introduces additional complexity with its numerous design patterns. OOP makes common development practices, like refactoring and testing, needlessly hard…
Using OOP is seemingly innocent in the short-term, especially on greenfield projects. But what are the long-term consequences of using OOP? OOP is a time bomb, set to explode sometime in the future when the codebase gets big enough. Projects get delayed, deadlines get missed, developers get burned-out, adding in new features becomes next to impossible. The organization labels the codebase as the “legacy codebase”, and the development team plans a rewrite…. OOP provides developers too many tools and choices, without imposing the right kinds of limitations. Even though OOP promises to address modularity and improve reusability, it fails to deliver on its promises…
I’m not criticizing Alan Kay’s OOP — he is a genius. I wish OOP was implemented the way he designed it. I’m criticizing the modern Java/C# approach to OOP… I think that it is plain wrong that OOP is considered the de-facto standard for code organization by many people, including those in very senior technical positions. It is also wrong that many mainstream languages don’t offer any other alternatives to code organization other than OOP.
The essay ultimately blames Java for the popularity of OOP, citing Alan Kay’s comment that Java “is the most distressing thing to happen to computing since MS-DOS.” It also quotes Linus Torvalds’s observation that “limiting your project to C means that people don’t screw things up with any idiotic ‘object model’.”
And it ultimately suggests Functional Programming as a superior alternative, making the following assertions about OOP:
“OOP code encourages the use of shared mutable state, which has been proven to be unsafe time and time again… [E]ncapsulation, in fact, is glorified global state.””OOP typically requires a lot of boilerplate code (low signal-to-noise ratio).””Some might disagree, but OOP code is notoriously difficult to unit test… [R]efactoring OOP code is really hard without dedicated tools like Resharper.””It is impossible to write good and maintainable Object-Oriented code.”