Summary
Keywords
Full Transcript
๐ก 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
