Pretending OOP never happened
I ran across someone recently who says the way to move past object oriented programming (OOP) is to go back to simply telling the computer what to do, to clear OOP from your mind like it never happened. I don't think that's a good idea, but I also don't think it's possible.
Object oriented programming, for all its later excesses, was a big step forward in software engineering. It made it possible to develop much larger programs than before, maybe 10x larger. Someone might counter by saying that programs had to be 10x larger because of all the overhead of OOP, but that's not the case. OOP does add some overhead, and the amount of overhead grew over time as tools and frameworks became more complicated, but OOP made it possible to write programs that could not have been written before.
OOP provides a way for programmers to organize their code. It may not be the best way, depending on the problem, but the way to move past OOP is to replace it with another discipline. And I imagine most people who have learned and then rejected OOP do just that, whether they realize it or not. Maybe they retain some organizational patterns that they learned in the context of OOP.
That has been my experience. I hardly ever write classes anymore; I write functions. But I don't write functions quite the way I did before I spent years writing classes.
And while I don't often write classes, I do often use classes that come from libraries. Sometimes these objects seem like they'd be better off as bare functions, but I imagine the same libraries would be harder to use if no functions were wrapped in objects.
There are many alternatives to OOP for organizing code. I generally like functional programming, but in my experience there's a hockey stick effort curve as you try to push the purity to 100%. James Hague said it well:
100% pure functional programing doesn't work. Even 98% pure functional programming doesn't work. But if the slider between functional purity and 1980s BASIC-style imperative messiness is kicked down a few notches - say to 85% - then it really does work. You get all the advantages of functional programming, but without the extreme mental effort and unmaintainability that increases as you get closer and closer to perfectly pure.
It's possible, and a good idea, to develop large parts of a system in purely functional code. But someone has to write the messy parts that interact with the outside world.
More programming posts