Skip to main content
Loading page…
Python Mastery
Chapter 20
Lesson 3 of 4
Behavioral Patterns
Contents
Notes
Tutor
Concept
Behavioral Patterns: Algorithms and Communication
Loading activity…
Previous
1 / 10
Continue
Contents
Notes
Discussion
Tutor
30 min
10 activities
0 of 10 done
In this lesson
1
Behavioral Patterns: Algorithms and Communication
2
Strategy: Just Pass a Function
3
Observer / Pub-Sub
4
Command: Encapsulating Requests for Undo
5
State Pattern
6
Iterator and Template Method
7
Practice: Event Bus with Subscribe and Publish
8
Practice: Strategy-Based Discount Calculator
9
First-Class Functions and Collapsed GoF Patterns
10
Gotcha: Modifying the Handler List During Dispatch
Objectives
Implement the Strategy pattern using first-class functions
Build an Observer/pub-sub event system
Apply the Command pattern with undo support
Implement a State machine explicitly and recognize when Python's first-class functions replace GoF patterns
Chapter 20 · Design Patterns in Python
Creational Patterns
Structural Patterns
Behavioral Patterns
Pythonic Patterns & Anti-Patterns
Previous: Structural Patterns
Next: Pythonic Patterns & Anti-Patterns