SOLID Principles in C#

Introduction

The abbreviation SOLID stands for the five design principles that Robert C. Martin proposed in object-oriented programming. These guidelines are used to create software that is tested and maintained.

SOLID is short for:

S

O

L

I

D

Single

Responsibility

Principle

Open/Closed

Principle

 Liskov

Substitution

Principle

Interface

Segregation

Principle

Dependency

Inversion

Principle

  • Single Responsibility Principle

    The Single Responsibility Principle (SRP) states that every object in an object-oriented programme (OOP) should be designed to do just one particular task.

  • Open/Closed Principle

    Code should be “Open for expansion” and “Closed for change,” according to the Open-Closed philosophy. The word is rather ambiguous, but it basically indicates that you should be able to apply a supported modification without having to update the code in a lot of different locations.

  • Liskov Substitution Principle

    The Liskov Substitution Principle (LSP) states that an application should run properly when objects from a superclass are swapped out for those from its subclasses.

  • Interface Segregation Principle

    Using the principle of interface segregation, we may solve the issue of the vehicle interface by dividing it into many role interfaces, each of which is designed for a certain type of activity.

  • Dependency Inversion Principle

    High-Level Modules/Classes should not depend on Low-Level Modules/Classes, according to the Dependency Inversion Principle (DIP). Both ought to rely on abstractions. Moreover, Abstractions shouldn’t be dependent on Details. Abstractions should drive details.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe

Select Categories