- Reduced Coupling: Using composition over inheritance reduces coupling between classes, making the codebase easier to maintain and understand.
- Explicit Dependencies: It's clear what dependencies are required by a class.
- Increased Flexibility: Composition allows dynamic behavior swapping, unlike inheritance which is static.
- Ease of Testing: Testing composed objects is often simpler because you can isolate components.
# Good: Using Composition