Hacker News new | ask | show | jobs
by twh270 2293 days ago
OOP as realized by the languages in common use is a bit of a disaster.

What was originally conceived as message passing[1] is actually implemented by OO languages as passing around pointers to objects that have mutable state, so in effect, every object is potentially part of global shared state.

Inheritance is a confused mess of "is-a" semantics, type system behavior, and code/state sharing in a set of subclasses.

I'm often somewhat amazed that we can build working large-scale systems at all in these languages given their weaknesses and the knowledge/skill level of the average programmer.

One source for what OOP was meant to be is https://wiki.c2.com/?AlanKaysDefinitionOfObjectOriented. That article links to others, and you can follow quite a rabbit trail of "what OOP is" threads.

2 comments

please, current software - not event thinking about Electron-like things, just the software that comes with operating systems, be it Finder, explorer.exe, even fucking photo viewers and music players or terminals - are already slow and frustrating enough as is, it's not like message passing is going to make shit happen faster.

I saw a Pharo (smalltalk) demo recently, the damn thing was so slow to react I thought it was a bad joke. Can't even begin to imagine what actual message passing would look like - oh wait, I do actually know due to spending 6 hours last weekend finding why a software had uncomfortable mouse interaction, actually caused by fucking objc_msgSend making everything async and slow on that wretched Apple OS.

It isn't the languages themselves it is the structures and software architecture that people think will scale while not realizing how tangled their program is.

Inheritance by its nature introduces dependencies but accomplishes little to nothing that couldn't be accomplished better with a different technique.

Likewise putting any sort of transformation from one type to another inside a class introduces a dependency on that type, which may be doing the same thing, thus depending on other types, etc.

On the other hand message passing in the form of pointers, interprocess communication, copying within a program, etc. Can be done in C++. Unfortunately most people go where the language leads them because few people really have a great idea of how to structure complex software.