This content originally appeared on DEV Community and was authored by medunes
I have always been obsessed with understanding the deepest meanings and “metaphysics” of clean-code, or coding best practices in general. Then, I started to literally hate and reject most of what comes from that “movement”, because some people and entities turned it into religions, hypes, brainwash, my way or the highway, ending up with it as a product to print on tee-shirts to wear in conferences.
Took a breath and stepped back and said: honestly, out of all that noise, are there facts I can convince my self with, as a pragmatic programmer, and argue with others based on them?
I ended up with the following seven “principles”:
1- “ANY production code you write WILL have to change”
2- “Changing code costs way more than writing new code.”
3- “Writing new code is not same as REWRITING old code to new code, the latter is also a type of code change”
4- “Clean Code is a set of empirically proven methods which reduce the cost of code change: the cleanest code is changeable with the lowest cost.”
5- “Writing clean code costs more than writing dirty code. But modifying dirty code costs more than modifying clean code”
6- “There is no ONE RULE explaining when to write clean code: it is a matter of value for money decision.”
7- “Clean code is not always optional: the cost of changing code can sometimes be infinite, under certain deadline restrictions. In this case a company can go bankrupt, or a government can be under permanent security threat.”
This content originally appeared on DEV Community and was authored by medunes