- If an instance of
B
should be used anywhere an instance ofA
, the use inheritance. If an instance ofB
should use an instance ofA
, use composition/delegation. - Use composition/delegation, unless you want substitutability.
- Be unemotional about designing your software.
- It is almost impossible to get it right the first time.
- Defer decisions that are possible to be deferred.
- A good design has high cohesion and low coupling.
- Simple keeps you focused.
- Simple is not necessarily familiar.
A good architecture allows major decisions to be deferred. "Bob Martin"
A good architecture maximizes the number of decisions NOT made. "Bob Martin"
OO is all about dependency management. "Bob Martin"
Architecture is the decisions that are hard to change. "Martin Fowler"
A good code should read like a story, not like a puzzle. "Dr. Venkat Subramaniam"
Good code is like a good joke, wrting comments is like explaining it. "Dr. Venkat Subramaniam"
Write (in comments) why you are doing that, not what you are doing.
If code is hard to understand, refactor it, not comment it.
Variable names represent abstractions.