C#

SOLID Principles – Open Closed Principle [OCP]

SOLID stands for Single Responsibility Principle [SRP], Open Closed Principle [OCP], Liskov Substitution Principle [LSP], Interface Segregation Principle [ISP] and Dependency Inversion Principle [DIP]. In this article I will explain Open Closed Principle [OCP]. This pattern states that software component such as classes, functions etc should be open for extension, but closed for modification. This can be achieved by using inheritance. Software modules that satisfy the open-closed principle have two huge benefits. First, they are “open for extension”. (The behavior of the modules can be altered to satisfy the changing requirements.) Second, these modules are “closed for modification”. (The modules,…

SOLID Principles – Single Responsibility Principle [SRP]

SOLID stands for Single Responsibility Principle [SRP], Open Closed Principle [OCP], Liskov Substitution Principle [LSP], Interface Segregation Principle [ISP] and Dependency Inversion Principle [DIP]. In this article, I will explain Single Responsibility Principle [SRP]. This pattern states that an object should have one and only one responsibility and that responsibility should be completely encapsulated by the class. In other words, a class should have only one reason to change. The point of the Single Responsibility Principle isn’t just to write smaller classes and methods, but to ensure each class implements a cohesive set of related functions. An easy way to…

4 of 4
1234