Encapsulate what varies.
Favor composition over inheritance.
Program to interfaces, not implementations.
Strive for loosely coupled designs between objects that interact.
Classes should be open for extension but closed for modification.
Decorator
-
Attach
additional
responsibilities
to
an
object
dynamically.
Decorators
provide
a
flexible
alternative
to
subclassing
for
extending
functionality.