The Tragic Death of Inheritance

3 years ago by snaggen to c/rust

This is a story about how I gradually fell in love with composition

I thought this was an interesting article, that might be of interest in this community since rust is one of the new languages that uses Composition over Inheritance.

TL; DR by the author:

This is a story about how I felt forced to give up inheritance and object-oriented programming, and still missed it for a very long time. And why now, half a decade later, I believe that inheritance is an inferior choice in most cases.

sugar_in_your_tea 7 points 3 years ago

I still believe inheritance can be a good solution when modeling a real taxonomy-based problem.

As I'm fond of saying, the right choice given two extremes is usually in the middle.

I wish Rust had inheritance, if only to make modeling taxonomy-based structures (like GUIs) easier. But given the choice between a good composition system and a good inheritance system, without being able to have both, I'll take the good composition system

path: 0 788570, hotness: undefined, score: 7, children: 0
Tyr3al 5 points 3 years ago

Good read. Thanks for sharing!

path: 0 784339, hotness: undefined, score: 5, children: 0
rust
rust

@programming.dev

login for more options
8328
1423
339

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits
  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

go to feed...