Design Patterns Archive

What is the Liskov Substitution Principle: An Explanation with Examples in Java

In this post, we will understand the Liskov substitution principle and illustrate how it works with an extended example in Java. The Liskov substitution principle states that an object of a superclass should be replaceable with an object of any of its subclasses. It is one of the SOLID design principles in object-oriented software

What is the Open/Closed Principle: An Explanation with Examples in Java

The open-closed principle states that classes and modules in a software system should be open for extension but closed for modification. It is one of the SOLID principles for software design.In this post, we will build a step-by-step understanding of the open/closed principle using examples in Java. Why Should You Apply the Open/Closed Principle?

The Single Responsibility Principle

What is the Single Responsibility Principle? The SRP is often misinterpreted to stipulate that a module should only do one thing. While designing functions only to have one purpose is good software engineering practice, it is not what the single responsibility principle states. In a nutshell, the single responsibility principle is one of the