software-design/
Architecture, patterns, testing, refactoring and code review.
7 results
software-design/the-observer-pattern-how-a-shop-tells-many-functions-about-one-order-w.md
The observer pattern: how a shop tells many functions about one order without knowing them
A shop that must email a receipt, update stock and add loyalty points ends up with one function that knows about everything. Every new…
software-design/refactoring-how-to-tidy-working-code-without-breaking-it.md
Refactoring: how to tidy working code without breaking it
Refactoring means changing how code is built on the inside without changing what it does. It sounds risky, but there is a simple routine…
software-design/unit-tests-why-four-passing-tests-don-t-prove-a-function-works.md
Unit tests: why four passing tests don't prove a function works
Your function gave the right answer four times. Is it correct? Not necessarily: passing tests only show the bug isn't where you looked…
software-design/idempotency-why-clicking-pay-twice-should-charge-you-once.md
Idempotency: why clicking Pay twice should charge you once
You tap Pay, the screen shows an error, you tap again, and your card is charged twice. Networks drop messages, so a phone often cannot tell…
software-design/state-machines-why-an-order-can-t-be-delivered-before-it-s-paid.md
State machines: why an order can't be delivered before it's paid
An online order can be in the cart, paid, shipped, delivered or cancelled, but what stops the code from delivering an order nobody paid…
software-design/refactoring-tidy-messy-code-without-breaking-it-using-tests-as-a-net.md
Refactoring: tidy messy code without breaking it, using tests as a net
Refactoring means changing how code is written without changing what it does, so the next person (often you) can read it. It sounds risky…
software-design/your-first-unit-test-catch-the-leap-year-bug-a-quick-check-misses.md
Your first unit test: catch the leap-year bug a quick check misses
A unit test is a tiny piece of code that checks another piece of code: you pick an input, write down the answer you expect, and let the…