Facade Pattern

  • They fall into structural pattern categories.
  • Façade pattern sits on the top of group of subsystems and allows them to communicate in a unified manner.
  • The façade takes care of orchestration part and present more simplified interface to the client.

Facade Pattern 1

 

Example:

In a typical online shopping cart when a customer places any order following things happens.

  • Get Product Details
  • Make Payment
  • Print Invoice

Facade Pattern 2

The above example can be implemented using Facade pattern as follows:

  1. The main class (clsOrder) is exposed to the client which internally takes care of calling other related classes  (clsProduct, clsPayment, clsInvoice).
  2. The clsOrder class acts as a facade class which takes care of orchestration by calling other related classes internally.

Façade Pattern

0 Comments

Leave a Comment