Design
Principal
|
Comments
|
- Encapsulate
what varies
|
e.g. the Strategy
pattern.
|
- Favour
composition over inheritance
|
e.g. the
Decorator pattern.
|
- Program to
interfaces, not implementations
|
|
- Strive for
loosely coupled designs between objects that interact
|
e.g. the
Observer pattern
|
- Classes
should be open for extension but closed for modification
|
e.g. the
Decorator pattern.
|
- Depend on
abstractions. Do not depend on concrete classes
|
e.g. the Factory
pattern.
|
- Only talk
to your friends
|
A given
object should assume as little as possible about the structure or
properties of anything else (including its subcomponents). more
|
- Superclasses
should call subclasses. Not the other way around.
|
e.g. the Template
pattern
|