Recent articles
Null vs Undefined: Stop Using the Wrong One
Dec 17, 2025
Pattern: Verifying Lambdas
Dec 16, 2025
Fixing Tailwind Culling in Monorepos
Dec 13, 2025

Pattern: Lambda Health Check
Dec 12, 2025

SwiftUI: Tips and Tricks
Nov 18, 2024
3D Printing at home
Jul 12, 2024
NestJS: benefits, cheatsheet and tips
Jul 12, 2024
mktouch = make directory + make file
Jun 28, 2024

Importing Rokoko character animations into Xcode using Blender
Jun 15, 2024

Importing Collada characters and animations from Mixamo into Xcode
Jun 13, 2024

Null vs Undefined: Stop Using the Wrong One
null and undefined are not interchangeable. Treating them as such blurs intent, weakens APIs, and forces defensive code everywhere.
Dec 17, 2025
The distinction between null and undefined is simple:
null → the property exists, and is explicitly empty
undefined → the property does not exist, or is unknown
Yet in practice, we default to undefined even when we clearly mean null.
If a field is known to exist (for example, it’s part of a type), then an empty value should be null, not undefined.
Payloads: Intent Matters
Consider an update payload:
This clearly states: clear the date of birth.
This states: nothing is known or being said about dob.
These are not the same instruction. One is an explicit command. The other is silence.
Queries: Absence vs Irrelevance
The same distinction applies to searching and filtering:
siteId = null → find entities that have no site relationship
siteId = undefined (or omitted entirely) → site should not affect the search
Again: one is a constraint, the other is the absence of a constraint.
The Cost of Ignoring This
Unfortunately, much of the ecosystem disagrees. Libraries, APIs, and even AIs routinely collapse these concepts. The result is code littered with defensive checks, ambiguous payloads, and brittle logic.
Worse still, coding defensively against incorrect type usage is painful—and usually avoidable.
Clear intent leads to simpler systems. And clear intent starts with using the right value.