7 Best (Worst) Practices of Writing Clean Code

Baris Gökcan
2 min readDec 25, 2022

--

Writing clean code has been one of the biggest struggles of software developers in some period of their life with the cost of hair loss, sleepless nights, couple of broken keyboards and mice…

Let us explore the 7 best or the worst practices of writing clean code:

1. Use overly complex and obscure names

Confuse your colleagues and future self with names like “quantumSuperpositionFunction()” and “interdimensionalVariable”. The more confusing, the better.

2. Ignore all formatting rules

Indent when you feel like it, use random amounts of whitespace, and mix and match naming conventions. This will make your code truly one-of-a-kind.

3. Complicate everything

Why use a simple for loop when you can use a recursive function with multiple nested ternary operators? The more convoluted, the more impressive.

4. Write long, convoluted functions

The longer and more confusing the function, the more impressive it will be. Bonus points if you can cram multiple unrelated tasks into one function.

5. Skip the comments

Who needs self-documenting code when you can just leave your colleagues to figure it out for themselves? It’ll keep them on their toes.

src: r/ProgrammerHumor

6. Skip the testing

Who has time for that anyway? Live life on the edge and just hope for the best.

7. Don’t bother refactoring

If it ain’t broke, don’t fix it. And even if it is broke, leave it be. It’s not like anyone will be able to understand it anyway.

Just kidding! In all seriousness, following best practices for writing clean code will save you time and effort in the long run, and make it easier for others to work with and maintain your code. So please, for the sake of your sanity and that of your colleagues, do the opposite of everything listed above. Your code (and your team) will thank you.

--

--