The Principles of OOD
What is object oriented design? What is it all about? What are it’s benefits? What are its costs? An article on objectmentor.com.
Article by Robert C. Martin about “Design Principles and Design Patterns“.
Principles of Class Design:
- SRP – The Single Responsibility Principle
A class should have one, and only one, reason to change. - OCP – The Open Closed Principle
You should be able to extend a classes behavior, without modifying it. - LSP – The Liskov Substitution Principle
Derived classes must be substitutable for their base classes. - DIP – The Dependency Inversion Principle
Depend on abstractions, not on concretions. - ISP – The Interface Segregation Principle
Make fine grained interfaces that are client specific.
Principles about package cohesion:
- REP – The Release Reuse Equivalency Principle
The granule of reuse is the granule of release. - CCP – The Common Closure Principle
Classes that change together are packaged together. - CRP – The Common Reuse Principle
Classes that are used together are packaged together.
Principles about couplings between packages:
- ADP – The Acyclic Dependencies Principle
The dependency graph of packages must have no cycles. - SDP – The Stable Dependencies Principle
Depend in the direction of stability. - SAP – The Stable Abstractions Principle
Abstractness increases with stability.
Other principles:
- LoD – Law of Demeter
- DBC – Design by Contract
- SoC – Separation of Concerns
- DRY – Don’t Repeat Yourself (Once and Only Once)
Wellknown authors:
- Martin Fowler
- Robert C. Martin (Unlce Bob)
- Grady Booch
- Bertrand Meyer
- Tom DeMarco
- Kent Beck
- Ward Cunningham
- Alistair Cockburn
Methodology:
Comments Off on The Principles of OOD