Skip to main content
AmigoFish

Stop Checking for None Everywhere

From ArjanCodes · · 20 min

The player loads from YouTube only when you click. It uses YouTube's privacy-enhanced mode.

If the video does not play, the owner may have turned off embedding. Watch it on YouTube instead.

Watch on YouTube

Not rated yet

Description

🧱 Build software that lasts. Join the Software Design Mastery waiting list → https://arjan.codes/mastery.

'None' seems harmless at first. But once it starts spreading through your codebase, every function needs more checks, more validation, and more defensive programming.

In this video, I show several ways to avoid overusing 'None', including better defaults, fail-fast validation, explicit state modeling, and the Null Object pattern. The goal isn't to eliminate 'None' completely, but to keep uncertainty at the edges of your system and make the core of your code simpler and more reliable.

🔥 GitHub Repository: https://git.arjan.codes/2026/none.

🎓 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:08 Why None Spreads 2:49 Option 1: Use Better Defaults 4:06 Option 2: Push Validation Earlier 8:21 Option 3: Rely on exceptions 10:26 Option 4: Model Different States Explicitly 12:59 Option 5: Use a Null Object 15:50 Option 6: The Less Common Options 18:34 Fail Fast vs Defensive Programming 19:59 Final Thoughts

#arjancodes #softwaredesign #python

Back to ArjanCodes · Report a problem