Why I care so much about quality
Good software is a set of clean Lego pieces you snap together. Bad software is a board soldered into a knot. Here's why I build the first kind.
I think software engineering is beautiful. Straight up. To me, designing software is like getting to design a set of super clean, perfectly fitting Lego pieces, then getting to snap them together into a product. Each piece does one thing, it does it well, and it fits with the others in exactly one obvious way. Want a different product? Rearrange the pieces. Want a better piece? Swap it out, and nothing around it notices.
That’s the dream, and it’s very achievable. It’s also not what most software looks like.
The soldered board
You’ve probably seen the other kind. I definitely have. Instead of a Lego set, it’s a circuit board with wires soldered all over the place:
- There are five similar but slightly different versions of the same thing. A
Song, aSongRecord, aSongInfo, aTrackRow, and whatever the third-party library hands back, each with its own idea of what a song’s title is called. - Some of those come straight from a vendor’s library and get used directly in the core business logic, so the library is now load-bearing in places it was never meant to be.
- There are three functions that do almost the same thing, each written for a different variation of that same model.
- To change one behavior, you touch eight files, and you’re never quite sure you found all of them.
Nobody sets out to build that. It happens one shortcut at a time, and every shortcut makes sense in the moment. Then a year later, a change that should take an hour takes a week, and everyone’s afraid to touch anything. That’s the soul-crushing maintenance code people talk about, and I hate it.
What quality actually buys you
Quality isn’t about being precious or academic. It’s practical. It’s the difference between software you can keep changing and software you have to work around.
When the pieces are clean:
- A change happens in one place. Changing how songs are stored means changing the storage piece. Nothing else knows or cares.
- Nothing is locked in. A vendor raises their prices or drops support? Swap the one piece that talks to them.
- Testing is easy. Every piece takes its dependencies from outside, so a test hands it a fake and checks what it does.
- New people can find their way around. The code reads like a description of the problem, in the problem’s own words.
It also matters for the people who use the software. A product built from clean pieces is a product that can be maintained for years without rotting, and that’s a promise I make to everyone who buys from me. I can only keep it if the code underneath deserves it.
The two things I care about most
If I had to boil all of this down, it’s cohesion and coupling. Everything else in these notes comes back to them.
- Cohesion: each piece has one job, and everything about that job lives inside it.
- Coupling: pieces connect through small, clean interfaces, and know as little about each other as possible.
High cohesion, low coupling. That’s the Lego brick: everything about the brick is inside the brick, and the only thing the next brick knows about it is the studs on top.
What’s in these notes
These aren’t a coding tutorial. They’re the principles I actually design by, with real examples of how I’d solve things, so anyone who’s interested can take what’s useful. I’ll keep tweaking them over time.
- Nouns: your program’s dictionary. One name, one model, for each concept, used everywhere.
- Cohesion, coupling, and changing one thing in one place. What a clean module boundary looks like.
- Interfaces with no surprises. Pure functions, honest names, and no hidden state.
- Wrap every vendor. Adapters, and why no third-party type should ever reach your core logic.
- Make Python fail when a boundary is crossed. Real config that turns these rules into build failures.
- Dependency injection and the AppContext. One place that builds everything, so any piece can be swapped.
The examples throughout use the same small, made-up Python app, gigbook: it keeps a gigging guitarist’s songs, builds setlists, and looks up chord charts from a web service. It’s small enough to follow and real enough to have the problems these notes are about. Every snippet comes from a version of it that actually runs, passes its tests, and passes its boundary checks.