# Software Design Principle: SOLID


<!--more-->

## Single Responsibility Principle

* What: A class should only have one job.

* Why:

  * If more than one then it would be coupled.

  * Easier to maintain and write the test

## Open Closed Principle

* What: A class should be open for extension but closed for modification.
  
* Why: More extensible and guarantees that modified without changing the existing behavior.

## Liskov Substitution Principle

* What: 

  * The object should be replaceable by its subclass without causing any error.

  * The object of the subclass should be the subset of its parent class.

* Why: The hierarchy rules let our code easy to maintain and extend.

## Interface Segregation Principle

* What: A client should not be forced to depend on methods it does not use.

## Dependency Inversion Principle

* What: The module should depend on the abstraction rather than the concrete class. The abstraction should not depend on the details or entities.

* Why: Easier to make the change without affecting the existing code and easier to perform mock testing.
