Introduction SOLID design principle is one of the most popular set of design principles in object-oriented software development. It’s a mnemonic acronym for the following five design principles: S – Single Responsiblity Principle O – Open Closed Principle L – Liskov Substitution Principle I – Interface Segregation Principle D – Dependency Inversion Principle

Posted in Design Pattern Java

SOLID Design Principle Explained with Java

Introduction State pattern comes under behavior design pattern in JEE. The State design pattern allows an object to alter its behavior when its internal state changes. State pattern is used to provide a systematic and lose-coupled way to achieve this through Context and State implementations. Context is the class that has a state reference to…

Posted in Design Pattern Java

State Design Pattern in Java

Introduction The strategy pattern is a behavioral design pattern that enables an algorithm’s behavior to be selected at runtime without causing tight coupling. The strategy pattern defines a family of algorithms, encapsulates each algorithm, and makes algorithms interchangeable. Strategy pattern lets the algorithm vary independently from clients that use it. So you define a strategy…

Posted in Design Pattern Java

Strategy Design Pattern in Java

Observer Pattern is one of the behavioral patterns. Observer design pattern is useful when there is something need to be done with the state of an object and an object wants to get notified whenever there is any change in state. In observer pattern, the object that watches on the state of another object are…

Posted in Design Pattern Java

Observer Design Pattern in Java

Memento Pattern is one of the behavioral patterns. Memento pattern is a software design pattern that provides the ability to restore state of an object to its previous state. The memento pattern is implemented with three objects: the originator, a caretaker and a memento. The originator is an object that has an internal state. The…

Posted in Design Pattern Java

Memento Design Pattern in Java

Mediator Pattern is one of the behavioral patterns as it deals with the behavior of the program. Usually a program is made up of a large number of classes. So the logic and computation are distributed among these classes. As more classes are developed in a program, the number of classes are increased, thus arising…

Posted in Design Pattern Java

Mediator Design Pattern in Java

Iterator pattern falls under behavioral design pattern. Iterator pattern is very commonly used design pattern in Java. This pattern is used to iterate through a collection of objects without exposing its underlying representation. It is used to access the elements of an aggregate object sequentially. For example, Java’s collections like ArrayList and HashMap have implemented…

Posted in Design Pattern Java

Iterator Design Pattern in Java

The command pattern comes under behavioral design pattern. The Command pattern is used to create objects that represent actions and events in an application. In the command pattern, a command interface declares a method for executing a particular action. A command object encapsulates an action or event and contains all information required to understand the…

Posted in Design Pattern Java

Command Design Pattern in Java

The Chain of Responsibility is known as a behavioral pattern, as it is used to manage algorithms, relationships and responsibilities between objects. The Chain of Responsibility pattern consists of a series of processing objects where each object containing the type of commands it can handle. Each object in the series either does its own task…

Posted in Design Pattern Java

Chain of Responsibility Design Pattern in Java

The Proxy is known as a structural pattern, as it is used to form large object structures across many disparate objects. It functions as an interface to something else such as a network connection, a large object in memory, a file, or some other resource that is expensive or impossible to duplicate. For more information…

Posted in Design Pattern Java

Proxy Design Pattern in Java

This design pattern comes under structural pattern as this pattern adds an interface to the existing system to hide all its complexities. As the name suggests Facade means the face of the building block. The real life examples of this pattern can be explained as explained below : We know that Computer system starts up…

Posted in Design Pattern Java

Facade Design Pattern in Java

Flyweight Pattern is a structural pattern as it is used to form large object structures across many disparate objects. This pattern minimizes memory use by sharing as much data as possible with other similar objects. This pattern increases performance by avoid creating a large number of expensive objects and instead reusing the existing instances to…

Posted in Design Pattern Java

Flyweight Design Pattern in Java