Figure 8.7 This facade will dramatically reduce our round-tripping. We've consolidated the
interfaces of six different classes down to a single facade interface. Further, the individual
methods are much more coarse, so one method will perform many smaller operations. For
example, one method gets all of the discussions in a board with one single call, returning a vector.
This completes our facade implementation of our BBS . Figure 8.7 shows the
result. We have our base EJB model with home and remote interfaces. We use
a facade object to hide those interfaces and to present a local interface to our
EJB . The application will do less round-tripping for the EJB layer and provide
much better performance.
A good facade
Like any other interface, a good facade is an art form. We'd like to build a log-
ical grouping of methods into a single facade; it's foolish to build an interface
across too many separate facades. Instead, we should design a logical packag-
ing that will make sense to our users. Where transactional issues exist, the
facade should use the capabilities of the session beans to manage the transac-
tional logic. A good facade is not a haphazard implementation.