http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod
The first five principles are principles of class design. They are:
The next six principles are about packages. In this context a package is a binary deliverable like a .jar file, or a dll as opposed to a namespace like a java package or a C++ namespace.
The first three package principles are about package cohesion, they tell us what to put inside packages:
The last three principles are about the couplings between packages, and talk about metrics that evaluate the package structure of a system.
http://blog.sanaulla.info/2011/11/14/solid-object-oriented-design-principles/
Bad
https://scotch.io/bar-talk/s-o-l-i-d-the-first-five-principles-of-object-oriented-design
http://javarevisited.blogspot.com/2012/03/10-object-oriented-design-principles.html
DRY (Don't repeat yourself)
Encapsulate What Changes
Favor Composition over Inheritance
Composition allows to change behavior of a class at runtime by setting property during runtime and by using Interfaces to compose a class we use polymorphism which provides flexibility of to replace with better implementation any time.
Programming for Interface not implementation
Delegation principle - Don't do all stuff by yourself
The first five principles are principles of class design. They are:
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. |
ISP | The Interface Segregation Principle | Make fine grained interfaces that are client specific. |
DIP | The Dependency Inversion Principle | Depend on abstractions, not on concretions. |
The next six principles are about packages. In this context a package is a binary deliverable like a .jar file, or a dll as opposed to a namespace like a java package or a C++ namespace.
The first three package principles are about package cohesion, they tell us what to put inside packages:
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. |
The last three principles are about the couplings between packages, and talk about metrics that evaluate the package structure of a system.
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. |
http://blog.sanaulla.info/2011/11/14/solid-object-oriented-design-principles/
Bad
- Rigid – Difficult to add new features
- Fragile – Unable to identify the impact of the change
- Immobile – No reusability
- Viscous – Going with the flow of bad practices already being present in the code.
- Loosely coupled code – There shouldn’t be too much of dependency between the modules, even if there is a dependency it should be via the interfaces and should be minimal.
- Highly cohesive code- The code has to be very specific in its operations.
- Context independent code- So that it can be reused.
- DRY – Dont repeat yourself – Avoid copy-paste of code. Change in the code would have to be made in all the places where its been copied.
https://scotch.io/bar-talk/s-o-l-i-d-the-first-five-principles-of-object-oriented-design
http://javarevisited.blogspot.com/2012/03/10-object-oriented-design-principles.html
DRY (Don't repeat yourself)
Encapsulate What Changes
Favor Composition over Inheritance
Composition allows to change behavior of a class at runtime by setting property during runtime and by using Interfaces to compose a class we use polymorphism which provides flexibility of to replace with better implementation any time.
Programming for Interface not implementation
Delegation principle - Don't do all stuff by yourself