Design Patterns Facade Pattern - Design Patterns

What is Design Pattern Facade Pattern?

Facade pattern hides the complexities of the system and give an interface to the client using which the customer can access the system. This kind of design pattern comes under structural pattern as this pattern adds an interface to existing system to hide its difficulty.

This pattern involves a single class which provides simplify methods requisite by client and delegates calls to methods of existing system lessons.

Implementation

We are available to create a Shape interface and actual classes implement the Shape interface. A facade class Shape Maker is define as a next action.

Shape Maker class uses the concrete module to delegate user calls to these classes. FacadePatternDemo, our demo class, will use Shape Maker class to explain the marks.
facade_pattern_uml_diagram

Step 1

Create an interface.

Shape.java

Step 2

Generate concrete classes implementing the same line.

Rectangle.java

Square.java

Circle.java

Step 3

Create a facade class.

ShapeMaker.java

Step 4

Use the facade to draw different types of shapes.

FacadePatternDemo.java

Step 5

Verify the output.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Design Patterns Topics