Join Jungwoo Ryoo for an in-depth discussion in this video Mediator example, part of Python: Advanced Design Patterns.
- [Instructor] Mediator consists of the Mediator,…Concrete Mediator,…Colleague,…and Concrete Colleague classes.…The Concrete Colleague class inherits from…the Colleague class while…the Concrete Mediator class…inherits from the Mediator class.…Let's start by reviewing the Colleague class.…It has a constructor that allows a Colleague object…to store its own ID,…and the Mediator it is assigned to.…
So, the ID is stored here,…the Mediator is being stored there.…Next is a getter method,…right here,…used to retrieve an ID of a Colleague object.…The send…and receive methods…are skeleton methods…meant to be overridden…by the Concrete Colleague class.…
Let's move on to the Concrete Colleague class now.…As I told you already, it overrides the send…and receive methods.…Right here,…send and receive.…The send method prints a statement indicating…which colleague object is sending a message,…as you can see here.…Then, it should invoke a distribute method…on a Mediator associated with itself.…
The code for this is…self._mediator.distribute(self, msg)…
- 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
Learning Python and Django (2015)with Caleb Smith1h 11m Intermediate
Programming Foundations: Design Patternswith Elisabeth Robson2h 19m Intermediate
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.