Clean Code
Later equals never.
The Total Cost of Owning a Mess
Messy code is harder to understand and even modified by others, hurting the productivity of the team a lot.
Attitude
Tell managers the truth. It is your responsibility to keep the code clean. Just like a doctor, do the right thing for your patients even if they don't like it. Because we are all professionals.
The Primal Conundrum
-
Previous messes slow us down.
-
We make mess in order to meet deadlines.
The only way to go fast is to keep the code as clean as possible at all times.
What is Clean Code
Clean code does one thing well.
Clean code reads like a well-written prose.
Clean code can be read and enhanced by a developer other than its original author.
Clean code always looks like it was written by someone who cares.
You know you are working on clean code when each routine you read turns out to be pretty much what you expected.
Clean code should
-
be elegant and pleasing to read.
-
be simple and efficient.
-
provide only one way to do one thing.
-
have unit tests.
-
have minimal dependencies.
-
contain no duplication.
The Broken Windows Metaphor
A building with broken windows is like messy code. It looks like nobody cares about it, so people stop caring. Eventually the code just breaks.
The Boy Scout Rule
Leave the campground cleaner than you found it.