Skip to content

Observer Pattern Tutorial: I NEVER knew events were THIS powerful ๐Ÿš€

2021 15 min ArjanCodes en YouTube

๐Ÿ’ก Learn how to design great software in 7 steps: https://arjan.codes/designguide. This tutorial on the observer pattern is the fourth part of my series on how to write better Python code, I show you how to use events to write code that's really easy to change and extend. Events are a variant of the observer / listener design pattern. This video is inspired by a real-life example I recently encountered, where implementing an event-based approach provided a great solution to a design problem I had. Next to showing how to use events in your code, you'll also see what the effect is on the cohesion and coupling of the functions you write. GitHub repository: https://github.com/arjancodes/betterpython. ๐ŸŽ“ ArjanCodes Courses: https://www.arjancodes.com/courses. ๐Ÿ’ฌ Join my Discord server: https://discord.arjan.codes. โŒจ๏ธ Keyboard Iโ€™m using: https://amzn.to/49YM97v. ๐Ÿ”– Chapters: 0:00 Intro 1:24 Explaining the code example 3:16 Analysis 4:45 Creating a simple event handler 7:19 Moving to an event-based approach 10:40 The complete solution 12:44 The power of an event-based system 14:12 Final thoughts

Chapters

  1. 0:00 Intro
  2. 1:24 Explaining the code example
  3. 3:16 Analysis
  4. 4:45 Creating a simple event handler
  5. 7:19 Moving to an event-based approach
  6. 10:40 The complete solution
  7. 12:44 The power of an event-based system
  8. 14:12 Final thoughts
Channel
ArjanCodes
Views
223

More like this