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

An object models and encapsulates invariants of a program. Its interface is a safe way to access and modify its state. When you inherit, you are always adding more constraints to what the superclass(es) have. You never loosen them:if you did, you would violate Liskov Subsistutability.
This is why we throw from constructors. If an object cannot be created in a valid state, it should not exist. This is why "data is private, methods protected" since a derived class should not be directly messing with the parents state.
This is the OO view found in Meyers seminal book "Object Oriented Software Construction."

Answer by Lance Diduck:

I think most of the issue is how its taught. Usually we get stuff like "a rectangle is a shape" and methods common to all shapes (like rotate) and obvious extensions to square and circle.
Or than an object reperesents some part of a system, with things like thermostats and room heaters, where we learn about interface and encapsulation.
That's all nice but doesn't get to the heart. An object models and encapsulates invariants of a program. Its interface is a safe way to access and modify its state. When you inherit, you are always adding more constraints to what the superclass(es) have. You never loosen them:if you did, you would violate Liskov Subsistutability.
This is why we throw from constructors. If an object cannot be created in a valid state, it should not exist. This is why "data is private, methods protected" since a derived class should not be directly messing with the parents state.
This is the OO view found in Meyers seminal book "Object Oriented Software Construction." The UML guys touch this a little with OCL but the rest of that "Rational" approach I abandoned years ago.

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