Join Jungwoo Ryoo for an in-depth discussion in this video Command, part of Python: Advanced Design Patterns.
- [Instructor] There are situations when it's necessary…to wrap a request in an object.…In an object oriented language like Python,…the request comes in the form of a method.…The command pattern addresses this need…and provides guidance on how to best build an object…whose sole purpose is to package a method…that can be easily passed around.…The structure of the command pattern is straight forward.…
It features a parent class called command,…which provides an interface…that allows you to execute a method.…Users of the command pattern write their own…concrete commands, which inherit from the command class.…One of the reasons you need to encapsulate a method…is to delay or queue the execution of an action…on a receiver object.…This capability is especially useful when you need…to dynamically compose…a sequence of behavior or undo actions.…
By the way, the word encapsulate here…is a fancy way of saying wrapping.…To reiterate, the concrete commands are our mechanism…for invoking an action on a receiver object.…It implements the execute interface of the command class.…
- Architectural vs. design patterns
- Why use design patterns?
- Design best practices
- Domain-specific patterns and security patterns
- Gang of Four design patterns
- Command, Mediator, and State
- Template method
Skill Level Advanced
1. Understanding Design Patterns: Review
2. Design Best Practices
3. Gang of Four (GoF) Patterns, Part 1
4. Gang of Four (GoF) Patterns, Part 2
Next steps1m 26s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.