Java decorator design pattern

Java decorator design pattern comes under structural design patterns and it provides the facility to add additional responsibilities to an existing object without altering its structure. It uses composition to extend the facility to an existing objects. Main advantage of decorator is to increase the existing functionality of an object without making any changes in … Read more

Java bridge design pattern

Java bridge design pattern comes under structural design patterns and it is used to decouple an abstraction from its implementation so that the two can vary independently. It uses composition approach over inheritance. Example Color.java package com.w3schools;   public interface Color { public void fillColor(); }package com.w3schools; public interface Color { public void fillColor(); } … Read more

Java facade design pattern

Dictionary meaning of façade: The principal front of a building, that faces on to a street or open space. Java façade design pattern comes under structural design patterns and it is used to hide the complexity of the system by providing a unified and simplified interface to a set of interfaces in a subsystem. Main … Read more

Java flyweight design pattern

Java flyweight design pattern comes under structural design patterns and it is used to reduce number of object creation by reusing the existing similar objects. Only create a new object if there is no matching object. Main advantage of flyweight design pattern is that, it reduces memory consumption by controlling the amount object creation. Let’s … Read more

Java proxy design pattern

Dictionary meaning of proxy: the authority to represent someone else. Java proxy design pattern comes under the structural design pattern category. In proxy design pattern we use a surrogate or placeholder to control the access of original object. Main advantage of java proxy design pattern is that it provides the protection to the original object … Read more

Java composite design pattern

In programming languages, composite normally used with tree structures. Java composite design pattern comes under structural design patterns and it provides the facility to compose objects into tree structures to represent part-whole hierarchies i.e. individual and composite objects will be treated uniformly. A composite design pattern consists of following objects: Base Component: It will represents … Read more

Java adapter design pattern

Dictionary meaning of Adapter: A device for connecting pieces of equipment that cannot be connected directly. Java adapter design pattern comes under structural design patterns and it provides the facility of communication between two incompatible objects. Main use of adapter design pattern is in the situations when we need an existing functionality but with some … Read more

Java structural design patterns

Structural design patterns are those design patterns which ease the design by identifying a simple way to realize relationships between entities. Structural design patterns Java structural design patterns Java adapter design pattern Java composite design pattern Java proxy design pattern Java flyweight design pattern Java facade design pattern Java bridge design pattern Java decorator design … Read more

Java prototype design pattern

Dictionary meaning of Prototype: A first or preliminary version of a device or vehicle from which other forms are developed. Java prototype design pattern comes under the Creational Design Pattern category and it is used in the situations when a new object creation is costly. Java prototype design pattern states that if a new object … Read more

Java builder design pattern

Java builder design pattern comes under the Creational Design Pattern category and it is used to build complex object from simple objects using step-by-step approach. Main advantage of builder design pattern is that it provides better control over object construction process. Let’s, consider the example of fast-food restaurant. A burger and a cold drink could … Read more