proxy pattern java

Proxy Pattern

Proxy Pattern   Proxy patterns creates a representative or placeholder object to another object. This helps in controlling access to a remote or expensive object.     Proxy example   First, we create Subject interface for both the Real Subject and Proxy. package com.topjavatutorial.patterns.proxy; public interface Subject {   void doSomething(); }   Next, lets create […]

Fa├žade Design Pattern in Java

In this article, we will discuss :   – What is Facade design pattern ? – How to implement Facade design pattern in java – Advantages of Facade pattern – How is Facade pattern different from Adapter pattern ?   Facade Design Pattern   A Facade is used when an easier or simpler interface to […]

Adapter pattern in Java

Adapter pattern is useful when one client class wants to use another client class with an incompatible interface.   Adapter pattern works as a bridge between two incompatible interfaces.     Here is an example of using Adapter pattern: Consider, we have a Rectangle class with properties height and width and a getArea() method that […]

Decorator Design Pattern in Java

In this article, we will go through Decorator design pattern. We will also see a sample implementation in Java.   Decorator Design Pattern   The Decorator pattern adds responsibilities to an object without modifying the object itself.   When we have need for additional functionalities for an existing object, we can consider using this pattern. […]

Abstract Factory Pattern in Java

In this article, we will discuss about Abstract factory design pattern and provide an implementation in Java.   Abstract Factory Pattern in Java   An abstract factory pattern provides an interface for creating families of related or dependent objects without specifying their concrete classes.     In Abstract Factory pattern, the client uses an abstract […]