Implementing the Factory Method Pattern in Python

This video course explores the Factory Method design pattern and its implementation in Python. Design patterns became a popular topic in late 90s after the so-called Gang of Four (GoF: Gamma, Helm, Johson, and Vlissides) published their book Design Patterns: Elements of Reusable Object-Oriented Software.

The book describes design patterns as a core design solution to reoccurring problems in software and classifies each design pattern into categories according to the nature of the problem. Each pattern is given a name, a problem description, a design solution, and an explanation of the consequences of using it.

The GoF book describes Factory Method as a creational design pattern. Creational design patterns are related to the creation of objects, and Factory Method is a design pattern that creates objects with a common interface.

This is a recurrent problem that makes Factory Method one of the most widely used design patterns, and it’s very important to understand how it works and know how to apply it.

By the end of this video course, you’ll:

  • Understand the components of Factory Method
  • Recognize opportunities to use Factory Method in your applications
  • Know how to modify existing code and improve its design by using the pattern
  • Be able to identify opportunities where Factory Method is the appropriate design pattern
  • Know how to choose an appropriate implementation of Factory Method
  • Understand how to implement a reusable, general purpose solution of Factory Method

What’s Included:

Downloadable Resources:

Related Learning Paths:

About Steven Loyens

Steven is an Actuary, Economist and Engineer who found his passion for coding messing about with his Commodore 64 in the eighties. He loves understanding how things work and sharing that knowledge. He's an experienced coach and mentor.

» More about Steven

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

← Browse All Courses