Part 9 of 9
Maintainability
- Code never rusts, but requirements change, the platforms and libraries under it change, and bugs need fixing.
- Most of the cost of software is ongoing maintenance, not first building it: fixing bugs, keeping it running, chasing failures, moving to new platforms, new uses, paying down technical debt, and adding features.
- Legacy systems are hard to work on: old tech few people know (such as mainframes and COBOL), lost knowledge of why things were built that way, and fixing other people's mistakes. This is a people problem as much as a technical one.
- Every useful long-lived system becomes legacy, so design for maintenance from the start.
- Three goals:
- Operability: easy for the organization to keep running smoothly. - Simplicity: easy for a new engineer to understand, using well-known, consistent patterns and no needless complexity. - Evolvability: easy to change later, even for uses nobody planned.
Operability
- How people work matters at least as much as the tools. Good operations can work around weak software, but good software cannot run well with poor operations.
- With thousands of machines, doing things by hand costs too much, so automation is a must.
- Automation cuts both ways. The rare cases it cannot handle are left to people, and those are the hardest ones. So more automation needs a more skilled operations team.
- A broken automated system can be harder to debug than a manual one. More automation is not always better; the right amount depends on your app and team.
- Good operability makes routine tasks easy, so operators can spend time on valuable work. A data system helps by offering:
- metrics to monitor, and tools to see what is happening inside, - no reliance on any single machine, so one can be taken down for maintenance while the rest keep running, - good docs and a simple mental model ("if I do this, that happens"), - good defaults that admins can override, - self-healing where sensible, with manual control of the system's state when needed, - predictable behavior with few surprises.
Simplicity
- Small projects can stay simple. Big ones tend to grow complex and hard to understand, which slows everyone and raises maintenance cost. A project stuck in this state is called a big ball of mud.
- Complexity causes late, over-budget projects and more bugs, because changes miss hidden assumptions, side effects, and surprising interactions.
- Cutting complexity greatly improves maintainability, so simplicity should be a key goal.
- What counts as simple is partly taste; there is no objective measure. Is a complex engine behind a tiny interface simpler than a plain engine that exposes more of its insides?
- Some split complexity into essential (from the problem itself) and accidental (only from the limits of our tools). But the line moves as tools improve, so the split is imperfect.
- Abstraction is one of the best tools. It hides a lot of detail behind a clean surface and can be reused by many apps. Reuse saves work and raises quality, because one fix helps everyone who uses it.
- Examples:
- A programming language hides machine code, CPU registers, and system calls. The machine code still runs; you just do not touch it directly. - SQL hides how data sits on disk and in memory, how many users share it at once, and how half-finished writes are cleaned up after a crash.
- App-level abstractions come from design patterns and domain-driven design (DDD). This course is about general building blocks, like transactions, indexes, and event logs, that apps are built on. DDD can sit on top of them.
Evolvability
- Requirements always change: new facts, new uses, new priorities, feature requests, new platforms, new laws, and growth that forces a new design.
- Agile methods give teams processes and tools for change, such as test-driven development and refactoring. This course looks for the same agility across a whole system of many apps and services.
- How easy change is depends on simplicity and good abstractions. Simple, loosely coupled systems are easier to change than tangled, tightly coupled ones.
- Evolvability is the word for this agility at the level of a data system.
- Steps you cannot undo make change scary. A database move with no way back raises the stakes. Take one-way steps carefully, and keep as much as you can reversible.
Key takeaways
- Nonfunctional requirements (performance, reliability, scalability, maintainability) decide whether an app is usable at all.
- Precomputing results, like fanning posts out to stored timelines, makes reads cheap at the cost of more write work, and extreme users need special handling.
- Describe speed with response time percentiles measured at the client, not averages, and combine percentiles by adding histograms.
- Tail latency grows with every backend call, so SLOs set percentile targets and SLAs add consequences.
- A fault is one part breaking; a failure is the whole system missing its promise; fault tolerance covers only chosen faults and should be tested on purpose.
- Software and human faults cause more outages than hardware; respond with many small defenses and blameless postmortems.
- Scalability is about options for a specific kind of growth; stay simple, measure load, and rethink at every 10x.
- Most cost is maintenance, so build for operability, simplicity through good abstractions, and easy change.