Tag Archives: Design Pattern

Observer design pattern in Java

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 »

Shallow Copy Vs Deep Copy

Shallow Copy A shallow copy is a type of copy made by cloning or copying the original object, but it does not contain copies of objects nested within the original object. Instead, it creates a new copy that references the same nested objects as the original object. Let’s understand with the following diagram: As we… Read More »

Abstract factory design pattern in Java

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 »