Showing posts from June, 2016

SOLID Design Principles

In this article, i will try to summarize the SOLID principles of object-oriented design.
The concept of SOLID principles were described first by Robert C. Martin in his paper Design Principles and Design Patterns.
Later on, the SOLID acronym was introduced by Michael Feathers for these principles.

And here is the SOLID principles that we will outline in this article: 

Single ResponsibilityOpen-ClosedLiskov SubstitutionInterface SegregationDependency Inversion
1. Single Responsibility Principles (SRP)
The key points that this principle says:
- A class should have only one responsibility
- A class should only have one reason to change
- If the class belongs to domain model, it should represent only the relevant business entity.

- Testing: Less responsibility means fewer test cases
- Loose coupling: Less responsibility means fewer dependencies

2. Open-Closed Principle (OCP)
The key points that this principle says:
- Open for extension
A class should be written in a way that is open for impleme…