Showing all posts from multiple categories

2025-04-17 06:22:28

SOLID Principles in c#

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) 

2025-04-17 06:56:07

Single Responsibility Principle - SOLID Principles in c#

Single Responsibility Principle states that classes should change for one reason. Thus, a class should have one duty. Multiple responsibilities make a class difficult to manage and test. Splitting the class into smaller, responsible classes is best. However, interface or abstract class is usually called single responsibility principle.

2025-04-17 11:22:01

Open/Closed Principle - SOLID Principles in c#

A class should be open for extension but closed for modification,  when new requirements are generated under the Open/Closed Principle. In other words, we should be able to extend class behaviour without changing it. This is possible with inheritance and interfaces.