
I am a software engineer with over 10 years of experience in a huge variety of projects and architectures, some simple others considerably complex.
Some of my main skills include Software Architecture, Web Development, ASP.NET Core, React.js, Entity Framework Core, Javascript, SQL and Web Services.
I consider myself passionate about coding as I really fell excited about learning technologies and using them to automate and improve processes.
Objective 🎯
Hide the complexity of the subsystems by providing a simplified interface to the client.
Type ✅
❌Behavioral: Describes how objects interact/communicate between themselves.
❌Creational: Describes how to instantiate an object without large and complex.
✔️Structural: Describes how objects/classes are composed to form larger structures.
UML 📐

Participants 🔗
• Facade:
- Provides simplified methods to be executed by subsystem objects
- Knows which subsystem classes are responsible for a request
• Subsystem Classes:
- Execute some specific funcionality
- Have no knowledge of the facade and keep no reference to it
Sample Code 🎮
Structural Example 🏛️

public static class FacadeStructural
{
public static void Execute()
{
Facade lFacade = new Facade();
lFacade.MethodA();
lFacade.MethodB();
}
}
public class Facade
{
private SubSystemOne _SubSystemOne;
private SubSystemTwo _SubSystemTwo;
private SubSystemThree _SubSystemThree;
private SubSystemFour _SubSystemFour;
public Facade()
{
_SubSystemOne = new SubSystemOne();
_SubSystemTwo = new SubSystemTwo();
_SubSystemThree = new SubSystemThree();
_SubSystemFour = new SubSystemFour();
}
public void MethodA()
{
Console.WriteLine("Facade - Executing Method A");
_SubSystemOne.MethodOne();
_SubSystemFour.MethodFour();
}
public void MethodB()
{
Console.WriteLine("Facade - Executing Method B");
_SubSystemTwo.MethodTwo();
_SubSystemThree.MethodThree();
}
}
public class SubSystemOne
{
public void MethodOne()
{
Console.WriteLine("SubSystemOne - Executing Method One");
}
}
public class SubSystemTwo
{
public void MethodTwo()
{
Console.WriteLine("SubSystemTwo - Executing Method Two");
}
}
public class SubSystemThree
{
public void MethodThree()
{
Console.WriteLine("SubSystemThree - Executing Method Three");
}
}
public class SubSystemFour
{
public void MethodFour()
{
Console.WriteLine("SubSystemFour - Executing Method Four");
}
}
Output

Real-world Example 🔥

public static class FacadePractical
{
public static void Execute()
{
OrderFacade lOrderFacade = new OrderFacade();
lOrderFacade.OrderFood();
}
}
public class OrderFacade
{
private Waiter _Waiter;
private Kitchen _Kitchen;
public OrderFacade()
{
_Waiter = new Waiter();
_Kitchen = new Kitchen();
}
public void OrderFood()
{
_Waiter.WriteOrder();
_Waiter.SendToKitchen();
_Kitchen.PrepareFood();
_Kitchen.CallWaiter();
_Waiter.ServerCustomer();
_Kitchen.WashDishes();
}
}
public class Waiter
{
public void WriteOrder()
{
Console.WriteLine("Waiter - Writting Order...");
}
public void SendToKitchen()
{
Console.WriteLine("Waiter - Sending To Kitchen...");
}
public void ServerCustomer()
{
Console.WriteLine("Waiter - Serving Customer...");
}
}
public class Kitchen
{
public void PrepareFood()
{
Console.WriteLine("Kitchen - Preparing Food...");
}
public void CallWaiter()
{
Console.WriteLine("Kitchen - Calling Waiter...");
}
public void WashDishes()
{
Console.WriteLine("Kitchen - Washing Dishes...");
}
}
Output

Source Code 🎲
https://github.com/VictorLins/DesignPatterns






