In this chapter, we will showcase the Facade Pattern, a structural design pattern that tries to define a uniform way regarding how developers should create abstractions in their code. Initially, we will use this pattern to wrap complex APIs and expose simpler ones that focus on the needs of our application. We will see how jQuery embraces the concepts of this pattern in its implementation, how it achieves encapsulating complex implementations that are integral parts of the web developer's tool-belt into easy-to-use API's, and how this plays a critical role for its wide adoption.
In this chapter, we will:
Introduce the Facade Pattern
Document its key concepts and benefits
See how jQuery uses it in its implementation
Write an example implementation where Facades are used to completely abstract and decouple a third-party library