Tag Archives: Design Pattern

Iterator design pattern in Java

By | June 18, 2025

Iterator design pattern is a Behavioral design pattern that provides a way to access the elements of a collection without exposing the underlying implementation of the collection. In other words, it gives a way to traverse the elements of the collection without exposing the internal implementation of the collection. In the above figure, we can… Read More »

Observer design pattern in Java

By | June 18, 2025

The Observer design pattern is a Behavioral design pattern that defines a one-to-many dependency between objects so that when one object changes state, all its dependent objects (observers) are notified and updated automatically. This pattern is also known as the Publish-Subscribe pattern. Observer design pattern real world example Let’s understand the observer design pattern with… Read More »

Prototype design pattern in Java

By | June 18, 2025

The prototype design pattern is a Creational design pattern that deals with object creation. The main idea behind the prototype design pattern is to create an object by copying an existing object, known as a prototype, instead of creating a new object from scratch. When to use Prototype design pattern? Example Let us understand the… Read More »

Builder design pattern in Java

By | June 18, 2025

The Builder design pattern is a creational design pattern that is used to create the objects (complex objects) step by step and then finally return the final object with the required attribute values. It allows us to create different types of objects using different attributes, depending on our requirements. Why to use Builder design pattern… Read More »

What is Design pattern?

By | June 18, 2025

A Design pattern is a generic and reusable solution to a common software design problem. In other words, it is a template that provides a proven way to solve a particular type of problem in software design and its development. Design patterns help us create more flexible, maintainable, and efficient code for software development. Types… Read More »

Abstract factory design pattern in Java

By | June 18, 2025

The Abstract Factory design pattern in Java is a creational pattern that provides an interface (Abstract Factory) to create families of related objects without specifying their concrete classes. Concrete factory classes implement the interface to create specific object families. This pattern allows the client code to create objects without knowing their exact implementations, promoting flexibility… Read More »

Factory design pattern in Java

By | August 30, 2023

Factory Design Pattern is a way of creating objects without directly specifying their exact class. Instead of creating objects using the new keyword, we hand over the object creation process to a separate factory class. This factory class is responsible for creating instances of different sub-classes or classes based on certain conditions. It helps us… Read More »