THE FAÇADE PATTERN
Frequently, as your programs evolve and develop, they grow in
complexity. In fact, for all the excitement about using design patterns, these
patterns sometimes generate so many classes that it is difficult to understand
the program’s flow. Furthermore, there may be a number of complicated
subsystems, each of which has its own complex interface.
The Façade pattern allows you to simplify this complexity by
providing a simplified interface to these subsystems. This simplification may
in some cases reduce the flexibility of the underlying classes, but usually
provides all the function needed for all but the most sophisticated users.
These users can still, of course, access the underlying classes and methods.
Fortunately, we don’t have to write a complex system to provide an
example of where a Facade can be useful. Java provides a set of classes that
connect to databases using an interface called JDBC. You can connect to any
database for which the manufacturer has provided a JDBC connection class —
almost every database on he market. Some databases have direct connections
using JDBC and a few allow connection to ODBC driver using the JDBCODBC
bridge class.
Recent Comments