Chapter 16: The Factory Pattern

Design patterns are reusable programming solutions that have been used in various real-world contexts and have proved to produce the expected results. In this chapter, we will learn about one of the most common design patterns: the factory design pattern. As we will see later, this pattern makes it easier to track which objects are created within a program, thus separating the code that creates an object from the code that uses it. We will study the factory design pattern's two forms: the factory method and the abstract method.

In this chapter, we will cover the following topics:

  • Understanding design patterns
  • Implementing the factory method
  • Applying the abstract factory

By the end of this chapter, we will have ...

Get Advanced Python Programming - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.