Object Oriented Programming

SOLID OOP, Liskov Substitution Principle

Liskov Substitution Principle The Liskov Substitution Principle [1] (LSP) is applied to inheritance hierarchies. LSP specifies that classes should be designed such that client dependencies can be substituted with subclasses without the client “knowing”. How to apply the Liskov Substitution Principle To adhere to Liskov Substitution Principle, subclasses must function in the same way as… Read more SOLID OOP, Liskov Substitution Principle

SOLID OOP, OPEN/CLOSE PRINCIPLE (OCP)

Open/Close Principle (OCP) The Open/Close Principle means that software entities should be open for extension but closed for modification [1]. Open to extension “Open to extension” means that classes are designed with the possibility of new functionality in mind. Down the road, one can extend functionality as new requirements come up. Closed for modification “Closed… Read more SOLID OOP, OPEN/CLOSE PRINCIPLE (OCP)

SOLID OOP, Single Responsibility Principle

Single Responsibility Principle (SRP): Single responsibility principle [1] means that any one class should not have more than one reason to change. For this to be true, a class will only have one single responsibility. Avoid creating a god class [2]. Objects that are controlling way too many other objects in a system and often… Read more SOLID OOP, Single Responsibility Principle