DEV Community

Discussion on: What is your tale of lasagna code? (Code with too many layers)

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y •

Inheritance is my preferred option for things that model type hierarchies. For example, widgets in a UI, or literal types in a compiler.

One reason inheritance is over-used is because languages don't offer enough options to do composition correctly. It ends up becoming a lot of boilerplate code. Proper support for mixins would go a long way to reducing bad inheritance.