Design Patterns in Python

Discover the modern implementation of design patterns in Python

Course Overview

What you’ll learn

  • Recognize and apply design patterns.
  • Refactor existing designs to use design patterns.
  • Reason about applicability and usability of design patterns.

Course Content

  • Introduction –> 1 lecture • 7min.
  • The SOLID Design Principles –> 7 lectures • 1hr 1min.
  • Builder –> 6 lectures • 33min.
  • Factories –> 5 lectures • 33min.
  • Prototype –> 4 lectures • 18min.
  • Singleton –> 7 lectures • 30min.
  • Adapter –> 4 lectures • 15min.
  • Bridge –> 3 lectures • 11min.
  • Composite –> 4 lectures • 20min.
  • Decorator –> 5 lectures • 26min.
  • Façade –> 3 lectures • 11min.
  • Flyweight –> 4 lectures • 21min.
  • Proxy –> 5 lectures • 15min.
  • Chain of Responsibility –> 5 lectures • 28min.
  • Command –> 4 lectures • 35min.
  • Interpreter –> 4 lectures • 21min.
  • Iterator –> 4 lectures • 24min.
  • Mediator –> 4 lectures • 18min.
  • Memento –> 4 lectures • 12min.
  • Observer –> 5 lectures • 21min.
  • State –> 5 lectures • 23min.
  • Strategy –> 3 lectures • 13min.
  • Template Method –> 3 lectures • 10min.
  • Visitor –> 6 lectures • 32min.
  • Summary and Extras –> 2 lectures • 12min.

Design Patterns in Python

Requirements

  • Good understanding of Python.
  • Familiarity with latest Python language features.
  • Good understanding of object-oriented design principles.
  • A computer with the latest Python release and (hopefully) an IDE.

Course Overview

This course provides a comprehensive overview of Design Patterns in Python from a practical perspective. This course in particular covers patterns with the use of:

  • The latest versions of the Python programming language
  • Use of modern programming approaches: dependency injection, reactive programming and more
  • Use of modern developer tools such as JetBrains PyCharm
  • Discussions of pattern variations and alternative approaches

This course provides an overview of all the Gang of Four (GoF) design patterns as outlined in their seminal book, together with modern-day variations, adjustments, discussions of intrinsic use of patterns in the language.

What are Design Patterns?

Design Patterns are reusable solutions to common programming problems. They were popularized with the 1994 book Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, John Vlissides, Ralph Johnson and Richard Helm (who are commonly known as a Gang of Four, hence the GoF acronym).

The original book was written using C++ and Smalltalk as examples, but since then, design patterns have been adapted to every programming language imaginable: C#, Java, Python and even programming languages that aren’t strictly object-oriented, such as JavaScript.

The appeal of design patterns is immortal: we see them in libraries, some of them are intrinsic in programming languages, and you probably use them on a daily basis even if you don’t realize they are there.

What Patterns Does This Course Cover?

This course covers all the GoF design patterns. In fact, here’s the full list of what is covered:

  • SOLID Design Principles: Single Responsibility Principle, Open-Closed Principle, Liskov Substitution Principle, Interface Segregation Principle and Dependency Inversion Principle
  • Creational Design Patterns: Builder, Factories (Factory Method and Abstract Factory), Prototype and Singleton
  • Structrural Design Patterns: Adapter, Bridge, Composite, Decorator, Façade, Flyweight and Proxy
  • Behavioral Design Patterns: Chain of Responsibility, Command, Interpreter, Iterator, Mediator, Memento, Observer, State, Strategy, Template Method and Visitor

Who Is the Course For?

This course is for Python developers who want to see not just textbook examples of design patterns, but also the different variations and tricks that can be applied to implement design patterns in a modern way. For example, the use of decorators and metaclasses allows us to prepackage certain patterns for easy re-use.

Presentation Style

This course is presented as a (very large) series of live demonstrations being done in JetBrains PyCharm and presented using the Kinetica rendering engine. Kinetica removes the visual clutter of the IDE, making you focus on code, which is rendered perfectly, whether you are watching the course on a big screen or a mobile phone.

Most demos are single-file, so you can download the file attached to the lesson and run it in PyCharm, IDLE or another IDE of your choice.

This course does not use UML class diagrams; all of demos are done via live coding.

Get Tutorial