composition-over-inheritance
Installation
SKILL.md
Composition Over Inheritance
Overview
Favor object composition over class inheritance.
Inheritance creates tight coupling and rigid hierarchies. Composition creates flexible, reusable components that can be mixed and matched.
When to Use
- Designing relationships between classes
- Tempted to use
extends - Class needs behavior from multiple sources
- Creating "is-a" relationships
- Building class hierarchies