Stop Passing Primitives Everywhere (Use Value Objects)
Machine-readable: Markdown · JSON API · Site index
Описание видео
🧱 Build software that lasts. Join the Software Design Mastery waiting list → https://arjan.codes/mastery.
In this video, I show how to use the Value Object pattern in Python to model prices, percentages, and email addresses properly. I’ll enforce invariants once, eliminate ambiguity (is 0.2 equal to 20%?), and make invalid states hard to represent, without adding unnecessary complexity.
🔥 GitHub Repository: https://git.arjan.codes/2026/value.
🎓 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:44 Primitive Obsession (The Actual Problem)
2:30 The “Before” Example (Looks Fine, Isn’t)
3:10 What a Value Object Actually Is
3:47 Price as a Value Object (Behaves Like a Float)
5:39 Percentage as a Value Object (Kills Ambiguity)
7:27 Keep Business Logic as a Function
10:27 Second Example: EmailAddress as a Dataclass Value Object
12:03 Quick Mention: Pydantic
12:33 Why Enums Aren’t Value Objects
13:08 Final Thoughts
#arjancodes #softwaredesign #python