OOP is not that bad, actually

submited by
Style Pass
2024-10-09 12:00:05

OOP is certainly not my favorite paradigm, but I think mainstream statically-typed OOP does a few things right that are very important for programming with many people, over long periods of time.

In this post I want to explain what I think is the most important one of these things that the mainstream statically-typed OOP languages do well.

I will then compare the OOP code with Haskell, to try to make the point that OOP is not as bad in everything as some functional programmers seem to think.

This set of features allows a simple and convenient way of developing composable libraries, and extending the libraries with new functionality in a backwards compatible way.

As is usually the case, things that make network connections, change shared state etc. need to be mocked, faked, or stubbed to be able to test applications. We may also want to extend the libraries with new functionality. With the features that we have, we don’t have to see this coming and prepare the types based on this.

In the first iteration we might just add a concrete class that is just the copy of the current class, and make the current class abstract:

Leave a Comment