Chapter 6. The Builder and Factory Patterns
In this chapter, we will showcase the Builder and Factory Patterns, two of the most commonly used Creational Design Patterns. These two design patterns have some similarities with each other, share some common goals, and are dedicated to easing the creation of complex results. We will analyze the benefits that their adoption can bring to our implementations and also the ways in which they differ. Finally, we will learn how to use them properly and choose the most appropriate one for the different use cases of our implementations.
In this chapter, we will:
- Introduce the Factory Pattern
- See how the Factory Pattern is used by jQuery
- Have an example of the Factory Patten in a jQuery application
- Introduce the Builder Pattern
- Compare the Builder and Factory Patterns
- See how the Builder Pattern is used by jQuery
- Have an example of the Builder Patten in a jQuery application