Chapter 25: The Command Pattern

In this chapter, we will cover the command pattern. Using this design pattern, we can encapsulate an operation, such as copy and paste, as an object. The command pattern is also great for grouping multiple commands. It's useful for implementing macros, multilevel undoing, and transactions. Throughout our discussions, we will learn about the idea of treating an operation as an object and use this command mindset to handle application transactions.

We will discuss the following:

  • Understanding the command pattern
  • Real-world examples
  • Use cases
  • Implementation

Technical requirements

The code files for this chapter can be accessed through this link: https://github.com/PacktPublishing/Advanced-Python-Programming-Second-Edition/tree/main/Chapter25 ...

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.