Problem
A segment of the client community needs a simplified interface to the
overall functionality of a complex subsystem.
Discussion
Facade discusses encapsulating a complex subsystem within a single
interface object. This reduces the learning curve necessary to
successfully leverage the subsystem. It also promotes decoupling the
subsystem from its potentially many clients. On the other hand, if the
Facade is the only access point for the subsystem, it will limit the
features and flexibility that “power users” may need.
The Facade object should be a fairly simple advocate or facilitator. It
should not become an all-knowing oracle or “god” object.
Structure
Facade takes a “riddle wrapped in an enigma shrouded in mystery”,
and interjects a wrapper that tames the amorphous and inscrutable
mass of software.
- Facade:-
- The facade class abstracts Packages 1, 2, and 3 from the rest of the application.
- Clients:-
- The objects using the Facade Pattern to access resources from the Packages.
Example
The Facade defines a unified, higher level interface to a subsystem
that makes it easier to use. Consumers encounter a Facade when
ordering from a catalog. The consumer calls one number and speaks with
a customer service representative. The customer service representative
acts as a Facade, providing an interface to the order fulfillment
department, the billing department, and the shipping department.
No comments:
Post a Comment