- Code Example
Composition Over Inheritance
Classes should achieve polymorphic behavior and code reuse by containing instances of other classes that implement the desired functionality, rather than inheriting from a base or parent class.
design patterns in general only exist to patch up shortcomings in the language. And if another language can solve the same problem trivially, that other language won’t have need of a design pattern for it.