Write clean code… Through dirty code.

Saad El Oulladi
2 min readMar 13, 2020

You might be wondering, how writing ugly code can help you getting your core cleaner.

It’s of course weird to achieve something through the opposite…

Perhaps the most intuitive way to write a good and clean code is to this about the most efficient and writable algorithm. and once it’s all clear in your mind, then you start coding. fair enough ?

This might seem good in theory. However, in reality it’s difficult and energy consuming to plan in advance all the algorithm details before starting code.

Assuming you did plan everything in advance. nothing guarantee that there is no better way to do it. which you might figure out once you finished the implementation.

Note also that finding issues in your code when you test it all at once is very difficult. fixing issues could take more time than the implementation took in the first place.

Personally i use and other approach. At the beginning, i make sure to write something that works. no matter how dirty the code is. only one thing is important. it works !

Once it’s the case. i start reviewing my own code. and improving it little by little.

And after each modification, i test that the code is still working, and nothing has been broken.

--

--