Yesterday, talking to a colleague at work about rewriting some scripts, he told me that “polishing the code is something you only do when you don’t have any other pending work“.
I couldn’t disagree more.
When you work in a large company, you will always have pending work. You won’t have finished a project when a new one will be already starting. And unpolished code will remain like that forever because, well, at least, it works. And that unpolished code that you write today because you are in a hurry will pass on to the next developer, who will somehow hack it to make it work for his purposes. And the process will repeat itself over the years. Until your unpolished block of code will have organically grown too big, too complicated to maintain, fix or understand. And then, in order to progress, someone will have to rewrite it from scratch, consuming hundreds of valuable hours. All of it just because you didn’t polish your code in the first place.
So please, to all the developers out there, don’t leave your code unattended. Dedicate a few hours a month just to review what you have done, refactor, add comments, fix broken windows… Polish your code. There is awesome literature out there about how to write proper code (Clean Code by Robert C. Martin, The Pragmatic Programmer by Andrew Hunt). Invest some time reading those two books.
And write the code you would like to inherit from another programmer.