Architecture & practice·topic 2 of 10
Complexity and how it accumulates
Nobody decides to build a mess. It arrives one reasonable decision at a time, and the vocabulary here exists to make a single one of those decisions arguable while it is still being made rather than two years later.
Read in order · tick what you already know
- 01
the rules really are that fiddly, because tax law is that fiddly, and no rewrite will make them simpler.
Essential complexity
- 02
half the file is there to work around a framework decision that has nothing to do with the feature.
Accidental complexity
- 03
you asked where the pricing logic lives and were told it depends which of five places you mean.
Big ball of mud
- 04
one class is four thousand lines and every feature branch touches it.
God object
- 05
nothing is broken, but the way the parameters keep getting passed through five functions feels wrong.
Code smell
- 06
there is a dead flag, three commented-out blocks and a helper nobody has called since 2022.
Cruft
- 07
you built the plugin system for the second provider, and two years later there is still only one provider.
YAGNI
- 08
there is an interface, a factory and a strategy, and exactly one implementation of each.
Speculative generality
- 09
you copied the block a second time and left it alone, and only pulled it out on the third.
Rule of three
- 10
the VAT rate changed and you had to find it in eleven places, and missed one.
Don't repeat yourself
- 11
two functions looked identical, you merged them, and a month later you added a boolean flag to tell them apart.
Incidental duplication
- 12
you hand-rolled a cache for a function that turned out to run twice a day.
Premature optimisation
- 13
the design handles ten thousand requests a second and the product has forty users.
Over-engineering
- 14
the ticket was done on Tuesday and you spent Thursday adding polish nobody asked for.
Gold plating
- 15
the rewrite is going to fix every compromise in version one, all at once, and it is nine months late.
Second-system effect
- 16
the answer was Kafka again, and the problem this time was a nightly report over four thousand rows.
Golden hammer
- 17
you went in to fix one bug and renamed the two variables that made the bug hard to see.
Boy scout rule
- 18
the first person skipped the test, and within a month nobody in the directory was writing them.
Broken window theory