Façade Pattern

Façade pattern hides the complexities of the system, and provides a simpler interface to clients. Façade wraps a complicated subsystem with a simpler interface, and decouples the subsystems from its clients.

Example:
In the class diagram below, we can see: When a client needs to retrieve user address information, or salaray information, it will talks to UserFacade class only. UserFacade will provide a simple interface to the client, and communicate with its sub systems: UserProfileManager, Salarymanager etc.

Façade pattern

Check List
Here is the check list to apply/implement Façade Pattern.

  • Define a simpler interface for the subsystems
  • Design a facade class that encapsulates the subsystem
  • The facade captures the complexity of the subsystem, and delegates to the appropriate methods
  • The client uses the Facade

Implementation

Step 1 – create subsystem interface

Step 2 – Create classes which implement the above interface

step 3 – create façade class

Step 3 – write a client to talk to façade

output:

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on RedditShare on StumbleUponEmail this to someoneShare on TumblrDigg this

One thought on “Façade Pattern

  1. Pingback: Software Design Patterns

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">