/solid

This repository aims to help those who are willing to understand a little bit better how SOLID principles work.

Primary LanguageC#MIT LicenseMIT

SOLID Principles

SOLID is an acronym for the first five object-oriented design principles:

S – Single Responsibility Principle - SRP

  • Single Responsibility Principle states that every module or class should have responsibility over a single part of the functionality provided by the software.

O – Open/Closed Principle - OCP

  • Open/Closed principle states that software entities (classes, modules, functions, etc.) should be open for extensions, but closed for modification.

L – Liskov Substitution Principle - LSP

  • Liskov substitution principle states that if S is a subtype of T, then objects of type T may be replaced (or substituted) with objects of type S.
  • In other words, it states that objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.

I – Interface Segregation Principle - ISP

  • Interface segregation principle states that no client should be forced to depend on methods it does not use.

D – Dependency Inversion Principle - DIP

  • High-level modules should not depend on low-level modules. Both should depend on abstractions.
  • Abstractions should not depend on details. Details should depend on abstractions.

Benefits of using SOLID

  • Cleaner code
  • Easier to test
  • Easier to maintain
  • Reusable
  • Readable
  • Extensible