
This Design Pattern Replaces an Entire Class Hierarchy
Show description
🧱 Build software that lasts. Join the Software Design Mastery program → arjan.codes/mastery. What should you do when objects differ by type: create subclasses, store an enum like plan_type, or represent each variation as an object? In this video, I use a realistic Python subscription system to compare all three approaches and introduce the Type Object pattern. 🔥 GitHub Repository: git.arjan.codes/2026/type. 💬 Join my Discord server: discord.arjan.codes. ⌨️ Keyboard I’m using: amzn.to/49YM97v. 🔖 Chapters: 0:00 Intro 2:22 Approach 1: Model the Variation With Subclasses 3:47 Approach 2: Just Store the Type 5:47 Approach 3: Make the Type an Object 8:51 Why Not Just Use the Enum? 9:45 Where Do the Type Objects Live? 14:09 Choosing Between the Three 15:05 Final Thoughts #arjancodes #softwaredesign #python
Open on YouTube ↗