Inheritance locks you into a rigid structure and forces your to predict the future. You make large overarching structural decisions at the beginning of the project which cause untold pain and suffering further down the line.
Composition on the other hand allows you to pick and choose what you need when you need it, letting you build the perfect little things for each situation.
It’s more flexible, it’s more powerful, and it’s really easy to do
— Mattias Johansson
- Composition over Inheritance