A very well-known writing exercise is to put a timer on for 10 minutes and just start writing whatever comes to mind. No editing. No erasing. This can produce some very interesting work, not always perfect (or even good), but always an educational experience of some sort (for yourself, if not for the readers). In the last month I found the same technique can be used to improve your product code-base readability.
Look at it as an exercise in self hygiene – you wash up at least once a day and brush your teeth at least twice, don’t you? that takes at least 10 minutes of your day. Your code will love you if you give it the same TLC you give your hair (if you still have some).
Pick a random piece of small code – a single function, a small file, maybe even a specific directory in your project tree. And set the timer on like so. Now, start cleaning, deleting, commenting, tabbing or whatever very small jobs you think can improve the readability (no new features!) of this specific code segment. Don’t add any new code, don’t think too hard. If you’re done with this segment and you still have some time, good job(!) you are done for today.
When your 10 min are up, run your test suit (you have one, right?) and commit to your version control(you have one, right?), preferably with a message that goes something like “daily 10min code cleanup” so you will have a record of your achievement.
I know your gut tells you that ten minuets a day can make little if any difference. However, that sums up to be almost an hour of readability improvements a week, that’s waaaaay more than you do now, right?