This Angular tutorial helps you get started with Angular quickly and effectively through many practical examples.

SOLID principles Introduction


In this article we are going to discuss SOLID principles in C#. There are many blogs, articles are available on the internet regarding SOLID principles but in this particular article I will try to explain to you with as much as simple.

SOLID principles Introduction

The SOLID principles are a set of five design principles intended to make software designs more understandable, flexible, and maintainable. They were introduced by Robert C.Martin(Uncle Bob) and are widely regarded as best practices for object-oriented software design.

SOLID Principals in C#

SOLID is an acronym for the following:

  1. S stands for SRP (Single responsibility principle
  2. O stands for OCP (Open closed principle)
  3. L stands for LSP (Liskov substitution principle)
  4. I stands for ISP (Interface segregation principle)
  5. D stands for DIP (Dependency inversion principle)

Why need SOLID Principals?

Developers build applications with good and tidy designs using their knowledge and experience. But over time, applications might develop bugs. The application design must be altered for every change request or new feature request. After some time, we might need to put in a lot of effort, even for simple tasks, and it might require a full working knowledge of the entire system. But we can't blame change or new feature requests. They are part of software development. We can't stop them or refuse them either. So who is the culprit here? It is the design of the application.

So we need to Choose the correct Design Patterns to build the software based on its specifications. We go through the Design Principles like SOLID Pricipals.

Advantage of SOLID Principals

  1. It reduces the dependencies so that a block of code can be changed without affecting the other code blocks.
  2. The principles intended to make design easier, understandable.
  3. By using the principles, the system is maintainable, testable, scalable, and reusable.
  4. It avoids the bad design of the software.

Disadvantages of SOLID Principles in C#

  1. SOLID principles can result in a more complex codebase because they demand breaking code into smaller, more focused classes and interfaces.
  2. Following SOLID principles may result in the creation of more classes and interfaces, making the codebase more difficult to browse.
  3. It could take some time for developers to understand and successfully apply the concepts.

Prev Next