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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s