Taken from Robert C. Martin's book "Agile Software Development - Principles, Patterns, and Practices"
Class Design Principles
- (SRP) The Single Responsibility Principle
- A class should have only one reason to change.
- (OCP) The Open-Closed Principle
- Software entities (classes, modules, functions, etc.) should be
open for extension, but closed for modification.
- (LSP) The Liskov Substitution Principle
- Subtypes must be substitutable for their base types.
- (DIP) The Dependency Inversion Principle
- Abstractions should not depend upon details. Details should
depend upon abstractions.
- (ISP) The Interface Segregation Principle
- Clients should not be forced to depend upon methods that they
do not use. Interfaces belong to clients, not to hierarchies.
Principles of Package Cohesion
- (REP) The Reuse/Release Equivalency Principle
- The granule of reuse is the granule of release.
- (CCP) The Common Closure Principle
- The classes in a package should be closed together against
the same kinds of changes. A change that affects a closed package
affects all the classes in that package and no other packages.
- (CRP) The Common Reuse Principle
- The classes in a package are reused together. If you reuse
one of the classes in the package, you reuse them all.
Principles of Package Coupling
- (ADP) The Acyclic Dependencies Principle
- Allow no cycles in the package dependency graph.
- (SDP) The Stable Dependencies Principle
- Depend in the direction of stability.
- (SAP) The Stable Abstraction Principle
- A package should be as abstract as it is stable.