The Pragmatic Programmer #2 — A Pragmatic Approach
Part two of the series on The Pragmatic Programmer: ETC, DRY, orthogonality, reversibility, tracer bullets, domain languages and estimating
Part two of the series on The Pragmatic Programmer by Hunt and Thomas. If the first one was about attitude, this one is about design. And if I had to pick a single principle from the whole book, I’d pick the first one in this chapter.
1. ETC: Easier To Change
Good design is design that makes code easier to change. That’s it. It’s the principle underneath almost all the others: decoupling, single responsibility and good names all serve it.
ETC works as a question to ask at every decision: will this choice make the next change easier or harder? When you can’t answer, pick the path that leaves more doors open.
2. DRY — Don’t Repeat Yourself
Every piece of knowledge must have a single representation in the system. And here’s the most common misunderstanding: DRY isn’t just about copy-pasted code. It’s about duplicated knowledge, wherever it lives: documentation, data schemas, logic.
// Two different functions, same knowledge: "orders above €100 ship for free"
const showFreeShippingBadge = (order) => order.total > 100
const shippingCost = (order) => (order.total > 100 ? 0 : 7.9)
The day the threshold becomes €120, you’ll change only one of them. Conversely, two identical blocks of code that represent different rules are not a DRY violation: forcing them together is an equally common mistake.
3. Orthogonality
Components must be independent: changing one must not break the others. The practical test: if requirement X changes, how many modules do I have to touch? If the answer is “one”, the system is orthogonal. If it’s “it depends”, you have a problem.
4. Reversibility
There are no final decisions. The database “we’ll never change”, the cloud provider “chosen forever”, the “settled” architecture: sooner or later someone will change them. Design so that day is a job, not a tragedy.
5. Tracer bullets
Build a minimal but working skeleton right away, one that goes through the whole system (UI, API, database, deploy) and then flesh it out. Like tracer rounds at night: you immediately see where you’re hitting and adjust your aim.
The detail that often gets lost: a tracer bullet is not a prototype. You throw a prototype away after learning from it. You keep the tracer and grow it.
6. Domain languages
Bring the code closer to the language of the problem. If the domain talks about “policies”, “claims” and “deductibles”, the code shouldn’t talk about Item, Record and value2. When code and business use the same words, conversations get shorter and bugs get rarer.
7. Estimating
Learn to estimate and refine your estimates as the project moves forward. And use the right units: “about 3 weeks”, not “15 days”. The unit communicates precision: whoever hears “15 days” understands that on day sixteen you’re late.
The takeaway
Almost everything in this chapter is ETC in different shapes: don’t duplicate knowledge, keep pieces independent, don’t close doors, see right away where you’re going. Code that can’t be changed is already legacy, even if you wrote it yesterday.
In the next part: The Basic Tools, with plain text, the shell and the famous “select isn’t broken”.
Which of these principles do you see violated most often in your project?