WHAT'S IN THIS CHAPTER?
An introduction to the intent of the façade pattern
A brief discussion of the benei ts that the pattern brings
Three ways that the pattern can be implemented: POJO, stateless,
and stateful session bean façade
The important differences between the stateful and the stateless
session bean façade
When and where to use this pattern
Warnings about its use and potential pitfalls
WROX.COM CODE DOWNLOADS FOR THIS CHAPTER
The wrox.com code downloads for this chapter are found at www.wrox.com/go/
download and individually named according to the names throughout the chapter.
The façade pattern is one of the structural design patterns described in the GoF 1 book. The
intent behind it is to encapsulate complicated business logic in a higher‐level interface that
makes access to a subsystem easier to use. This is often done by grouping related method calls
and invoking them sequentially from one method.
From a higher‐level view, every API can be considered an implementation of the façade pattern
since they provide a simple interface which hides its complexity. Any call to an API's method
results in the invocation of many other methods from a subsystem hidden behind it. An
example of a façade would be the javax.servlet.http.HttpSession interface. This hides the
complicated logic associated with maintaining the session while exposing its functionality via
a handful of simple‐to‐use methods.