

Virtual Structs Part 2: Classes Strike Back - adamnemecek
http://smallcultfollowing.com/babysteps/blog/2015/05/29/classes-strike-back/

======
kyllo
One of my favorite long-form blog posts about OOP[1] explains why data type
inheritance is generally quite useful, but the entire concept of inheritance
has been unfairly maligned because in OOP languages, inheritance of data types
is tied to inheritance of function implementations, resulting in the fragile
superclass problem, breaking encapsulation, etc. We've thrown the baby out
with the bathwater.

[1][http://www.smashcompany.com/technology/object-oriented-
progr...](http://www.smashcompany.com/technology/object-oriented-programming-
is-an-expensive-disaster-which-must-end)

~~~
frik
You may want prototype based inheritance like in Javascript/ES6:

[http://en.wikipedia.org/wiki/Prototype-
based_programming](http://en.wikipedia.org/wiki/Prototype-based_programming)

~~~
wtetzner
Prototype-based inheritance seems to be the opposite of what he's arguing for.
He's saying it's useful to have data-type hierarchies, but not implementation
inheritance.

~~~
frik
I don't think so.

"Prototype-based programming is a style of object-oriented programming in
which behavior reuse (known as inheritance) is performed via a process of
cloning existing objects that serve as prototypes. This model can also be
known as prototypal, prototype-oriented, classless, or instance-based
programming."

In class based programming you have the fragile base-class problem, as the OP
mentioned. Prototype based programming is more powerful and you could emulate
class based programming in it (as is done in ES6 with the new "class"
syntactic sugar).

~~~
wtetzner
I don't see how prototype-based programming solves the fragile base-class
problem. Instead you just have the fragile "base-object" problem.

