10 The Adapter and Façade Design Patterns
This chapter covers
- The Adapter Design Pattern
- The Façade Design Pattern
In this chapter, we tackle an all-too-common problem: working with legacy software. This code can be from a library that we can’t modify, or other external code that don’t have access to or otherwise cannot modify.
The Adapter Design Pattern provides a model for a software architecture that needs to integrate external code, such as from a library, with code in an existing application. However, the external and application codes weren’t originally designed to work together and we cannot change either of them. The pattern can also help to isolate an application from interface changes in the external code that may be outside of our control. Our example application must generate a report about the attendance and venue of various school sports, but the sports report that data differently.

The Façade Design Pattern provides a simpler higher-level interface that makes complex code that we can’t modify easier to use. Our example application must interact with multiple organizations to raise funds for school sports.
Learning about design patterns
Be sure to read the introduction to Part 4 for important information about design patterns in general and to learn how this and subsequent chapters teach each pattern.