SOLID Principles in c#

The SOLID Principles are five software design principals that facilitate the creation of high-quality, adaptable, manageable, reusable, testable, and comprehensible software.

The five SOLID principles are as follows: 

  • S: Single Responsibility Principle (SRP) 
  • O: Open-Closed Principle (OCP) 
  • L: Liskov Substitution Principle (LSP) 
  • I: Interface Segregation Principle (ISP) 
  • D: Dependency Inversion Principle (DIP) 

Why and When Solid Princliple required

Problem: Developers create applications with aesthetically pleasing and organised designs utilising their expertise and experience. However, with time, apps may encounter issues. 

The application design must be modified after each change request or new feature request. Eventually, After some time, we might need to put in a lot of effort, even for simple tasks, and it might, necessitating comprehensive understanding of the entire system. However, we cannot attribute blame to change or demands for new features. They constitute an element of software development. We are unable to stop or reject them. 

So who is the culprit here? It is the design of the application.

These are the main design mistakes that hurt software. Classes are under more stress because they have more work to do. (A lot of code that doesn't belong to a class.) The classes are being made to count on each other. A change in one class will have an effect on the other if they are closely coupled, which means they depend on each other. 

Solution : Choose the right design (MVC, 3-tier, layered, MVP, MVVP, etc.). Following the rules of design. Deciding on the right Design Patterns to follow when making software that meets its needs. 

 

 


Understanding Solid five principles is essential for working with object-oriented software.


SOLID principles will help you design elegant, maintainable, flexible, testable software and avoid many headaches.

Author
Full Stack Developer

Deepak Talwar

Technical Architect & Full Stack Developer with 18+ years of Professional Experience in Microsoft Technologies & PHP Platform. Hands on experience with C#, VB, ASP.NET, ASP.NET MVC, ASP.NET Core, ASP.NET Web API, Linq, ADO.NET, Entity Framework, Entity Framework Core, Sql Server, MYSQL, NoSql, Javascript, Angular, jQuery, AWS, Azure, React, Angular, Laravel, Codeingiter, Serenity, VBA, Cloud Computing, Microservices, Design Patterns, Software Architecture, Web Design and Development.

Related Post