Hacker News new | ask | show | jobs
by skybrian 3315 days ago
Or perhaps neither? It's conventional wisdom these days that composition often works better than inheritance.
1 comments

It's even more conventional wisdom that these two things are absolutely not mutually exclusive and that it's actually recommended to use both.

By the way, "composition" is ambiguous:

- Composition of classes is usually a shortcut used to describe inheritance of interfaces and implementation through aggregation (there's only one mainstream language today that supports this natively: Kotlin).

- Composition of functions, which is pretty much mainstream in most popular languages today.