make it work, make it right, make it fast
expressionprogramming
Kent Beck's ordering of concerns: first correctness, then design, then - and only then - speed.
The discipline is in the sequence: resisting cleverness before the thing works, and resisting optimization before the design is honest. Most premature-optimization sins are a violation of step three's position in the queue.
Make it work, make it right, make it fast is Kent Beck's ordering, and the sequence is the substance. Working first establishes that the approach is viable at all and produces something to test against. Right means clean, understood and structured, done once the shape of the problem is actually known. Fast comes last, when there is something to measure and a reason to believe the performance matters.
Inverting the order is where projects go wrong, and each inversion fails differently. Optimizing before it works produces fast code that solves the wrong problem. Perfecting the structure before it works produces an elegant abstraction over a misunderstood requirement. Both spend effort on assumptions that the working version would have corrected for free.
The failure mode of the sequence itself is stopping after step one, which is how most technical debt accumulates: it works, the deadline arrives, and right never happens. That is why the ordering only functions as a discipline if the second step is scheduled rather than intended, and the honest version of this advice includes that make it right is a commitment with a date, not an aspiration.