Programming Fundamentals
Clean Code
Code optimised for the reader rather than the writer: intention-revealing names, small single-purpose functions, few arguments, and comments that explain why rather than what. Since code is read far more often than written, clarity compounds across a team. The discipline is resisting cleverness in favour of the boringly obvious.
Purpose
Clean code is code optimised for the reader: intention-revealing names, small single-purpose functions, minimal arguments, and comments that explain why, not what. It matters because code is read many times more often than it is written — clarity compounds across a team and across years.
When to Use It
It applies everywhere, but it earns the most in code that lives long and changes often: core domain logic, shared utilities, public APIs. It is also what makes code review effective — reviewers catch real defects when they are not fighting through noise.
Trade-offs
Taken dogmatically it can over-fragment code into dozens of two-line functions that are individually 'clean' but collectively hard to follow. The judgement is optimising for comprehension, not for rule compliance — sometimes a slightly longer function that reads top-to-bottom is the clearest form.
Implementation
Name things for what they mean (daysUntilExpiry, not d); keep functions at one level of abstraction; delete dead code rather than commenting it out; make the happy path obvious and handle errors explicitly. Enforce the mechanical parts — formatting, lint rules — with tooling so humans argue only about substance.