S.O.L.I.D

S.O.L.I.D

What is the S.O.L.I.D?

  • Single Reponsability
  • Open/Closed
  • Liskov Substutition
  • Interface segregration
  • Dependency Inversion

Single Responsibility

  • Testing - A class with one responsibility will have far fewer test cases.
  • Lower Coupling - Less functionality in a single class will have fewer dependencies
  • Organization - Smaller, well-organized classes are easier to search than monolithic ones.

Example

Bad Example

Solution Example

Open/Closed

Open for Extension, Closed for Modification

We stop ourselves from modifying  existing code and causing potential new bugs

Example

Example

Lisvok Substituion

S.O.L.I.D

By Luis Henrique Gomes Camilo