Composition over Inheritance
Go design philosophy.
Go Design Philosophy
Go deliberately omits class inheritance. The idiomatic approach is composition: build behavior by combining small types and interfaces.
Why Not Inheritance
Deep inheritance trees are brittle: a change in a base class ripples unpredictably. Composition keeps relationships explicit and flexible.
All lessons in this course
- Struct Embedding
- Interface Embedding
- Method Promotion
- Composition over Inheritance