Is it time for us to dump the OOP paradigm? If yes, what can replace it?

There are two key goals in designing a programming language: decreasing coupling while increasing cohesion. That is, you're trying to split the problem "at the joints", where the parts that are naturally connected to each other stay connected, while the parts that can be swapped out are connected only at well-defined interfaces.

Answer by Joshua Engel:

There are two key goals in designing a programming language: decreasing coupling while increasing cohesion. That is, you're trying to split the problem "at the joints", where the parts that are naturally connected to each other stay connected, while the parts that can be swapped out are connected only at well-defined interfaces.

The fundamental unit of programming is the function, e.g.:

foo(a,b,c) -> d

A function wraps up some chunk of functionality and assigns it a name. Hopefully, you don't have to peer inside of it: you can deduce as much as possible about it from the name and its signature: "It takes as, bs, and cs, and foos them to make a d". 

What you find with many functions is that the first argument is special. You end up reading it as "You take an a, and you foo it with a b and a c, to make a d".

This is the fundamental concept behind object-oriented programming: you declare that the first argument is special and say, "I'm going to split the world at that joint. I'll even make a special syntax for it":

a.foo(b,c) -> d

If you've split the world correctly, you can find other functions that also have more "a"-ness to them, and put them together. If your language is stateful, you can let these functions unpack that state for each other, which forces them to be tightly coupled but at least controls the scope of that coupling.

Note that what we're talking about here is really psychology rather than computer science. The joint-splitting happens because it's how people naturally perceive the world. The human mind is fundamentally object-oriented, though people don't always realize that their objects and other people's objects aren't always the same ones. There's nearly always more than one way to look at the world, both the natural one and the artificial one that computers created for themselves (windows, file systems, etc.)

And, as the question observes, sometimes you really don't find a natural joint-splitting at all. You end up perceiving it in terms of functions. However, the larger the problem is, the more necessary it will be to find some way to split it. Even if the joints don't correspond to natural divisions of the world, they may correspond to the natural divisions of progammers working on the same project. One may have expertise in back ends, others in computation, others in display. You will still need to follow the properties of coherence and coupling, and object-oriented languages provide you a way to do that based on the natural human metaphor of putting things into boxes and hiding the details from the outside.

There is also mental baggage that comes from that, which is why small, one-shot programs tend to find the object-oriented paradigm cumbersome. Object-oriented paradigms tend to assume (without even realizing it) a natural flow-of-control, which can interfere when you try to adapt it to some other control mechanism (which is becoming increasingly common, as frameworks demand that you adhere to their flow of control rather than a library which follows your flow of control.)

I don't think OOP is going away any time soon. A more prominent trend, I believe, is going to be for transactionalism to begin to take center-stage. I'd like to see the distinction between short-term and long-term memory smudged (eliminating the embarrassing impedance mismatch problem of talking to long-term storage in a different language from your in-memory processing).

Is it time for us to dump the OOP paradigm? If yes, what can replace it?

Advertisements

Leave a comment

Filed under Life

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s