Define Facade design Pattern and write an example in java
![](https://codelido.com/assets/files/2022-12-07/1670392668-919318-image.png)
Facade Design Pattern comes under Structural Design Pattern and is used to hide the complexity and logic of the system from the client and only provides an interface for a client to access the system.
package p1;
public interface Shape
{
public void draw();
}
package p1;
public class Rectangle implements Shape
{
public void draw()
{
System.out.println("Draw Rectangle");
}
}
package p1;
public class Square implements Shape
{
public void draw()
{
System.out.println("Draw Square");
}
}
package p1;
public class Circle implements Shape
{
public void draw()
{
System.out.println("Draw Circle");
}
}
package p1;
public class ShapeMaker
{
private Shape circle;
private Shape rectangle;
private Shape square;
public ShapeMaker()
{
circle=new Circle();
rectangle=new Rectangle();
square=new Square();
}
public void drawCircle()
{
circle.draw();
}
public void drawRectangle()
{
rectangle.draw();
}
public void drawSquare()
{
square.draw();
}
}
package p1;
public class FacadePattern
{
public static void main(String[] args)
{
ShapeMaker ob=new ShapeMaker();
ob.drawCircle();
ob.drawRectangle();
ob.drawSquare();
}
}