F-Makhokha / SolidPrinciples

Implementing SOLID design principle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SOLID Principles

Examples of SOLID priciples violation and it's solution.

SOLID are five basic principles which help to create good software architecture

Exists 5 Design principles

  • S stands for SRP (Single responsibility principle)
  • O stands for OCP (Open closed principle)
  • L stands for LSP (Liskov substitution principle)
  • I stands for ISP (Interface segregation principle)
  • D stands for DIP (Dependency inversion principle)

1. SRP (Single responsibility principle)

A class that have a single responsibility and not muiltiple, the class can move in all the activities of the system.

2. OCP (Open closed principle)

In OOP the entities i.e. classes, functions, modules, etc. Should be open by extension and closed by modification. Extend the behavior and the source code is not modified.

3. LSP (Liskov substitution principle)

If S is a subtype of T, then objects of type T in a program may be replaced with objects of type S without altering any of the desirable properties of that program. Barbara Liskov - 1987.

4. ISP (Interface segregation principle)

The client should not be forced to depend on methods it does not use (Interface concept).

5. DIP (Dependency inversion principle)

It refers to a specific form of decoupling software modules.It states.

  • 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.

About

Implementing SOLID design principle


Languages

Language:C# 100.0%