Lately there is a lot of talk about “Clean Code”. This is in part due to Robert Martin’s recent book by the same name. I’ve heard people come up with idealistic reasons to embrace clean code practices. That all well and good, but when you’re face with a team who does not share your conviction, this can be difficult. Why should I invest in clean up code if I cannot keep the whole of the code pristine? Well I continue to write clean code and to re-pass the broom over the same floors I have previously swept because if I dont it will deteriorate into a real bordello. I continue to clean up because every effort I make to figure some tangled mess out is an effort I do not want to repeat later. The two hours I spend trying to figure out the purpose of a dozen poorly-named classes are hours I do not want to re-live. The next time I pass through this code I want my previous insights to jump out at me, not hide behind the same mess I dug through last time. I continue to clean up along my path because I hope that the next person (however clean-conscience they may or may not be) does not get slowed down by the previous mess. This person is my team-mate, and the success of my current commitments is dependent on them. Anything I can do to save them wasted time benefits me. I continue to write clean code and clean up the problems that cross my path because that same team-mate may waste my precious time asking me questions that I could otherwise have answered directly in the code. This seemingly futile exercise in clean up is all geared at saving me wasted time on a daily basis. Why do I chose to invest in clean code? Because I’m lazy.

gabriel bélanger

Billet précédent

Agile du point de vue d'un PMP

Billet suivant

Randori pendant l'inter-contrat