I Hate Long If-Elif Chains: This Design Pattern Solved It Once and For All

ArjanCodes October 17, 2025
Video Thumbnail

About

No channel description available.

Video Description

💡 Learn how to design great software in 7 steps: https://arjan.codes/designguide. If your code is littered with endless if-elif chains just to handle different formats, behaviors, or commands, there’s a better way. In this video, I’ll show you how the Registry Pattern can help you clean up your logic, make your code extensible, and even power a dynamic CLI with plugin support. We’ll start with a simple example and then build a real-world textutils CLI using Python and Typer, complete with Rich-powered output and zero hardcoded logic. 🔥 GitHub Repository: https://git.arjan.codes/2025/registry. 🎓 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 0:48 What Is the Registry Pattern? 1:20 Quick Example: The Exporter Problem 8:22 Full Example: CLI text utils 9:50 Registry Implementation. Overview 11:25 Wiring It Up with Typer 12:33 Extending the CLI 13:56 Benefits of This Pattern (Now That You’ve Seen It in Action) 14:18 Pitfalls to Watch Out For 14:48 Final Thoughts #arjancodes #softwaredesign #python