Taking a walk around the code
I have started on a practice that I have tentatively dubbed “taking a walk around the codebase”. It’s a silly name, but it describes the activity quite well.
This idea came up once on a plane where I was unable to work on most of my usual tasks. But I had all the code in front of me, so why not just read through a bunch of it?
I have found that it is very much a worthwhile practice to simply read through various parts of a codebase that I have not touched for a while. Without any clear goal for browsing, I will just read whatever I haven’t looked at for a long time.
More often than not, I will come across something that can be cleaned up or simply removed because it is no longer in use.
Even without finding anything actionable, it is still a nice way to remind myself of code that I’ve written years back. How would I improve it today?
Reading code is obviously not a new idea. All the gurus advocate reading a ton of code as a learning exercise. I’m not sure why, but I have never been good at this dicipline when it comes to arbitrary projects written by strangers. I know that there is a lot to be learned, but it’s quite a steep learning curve. Maybe just because I’ve not practiced enough.
However my own old code feels quite familiar even thought I’ve forgotten writing much of it. And I find it very motivating that I can often improve the code right away. By spending an hour, I can refresh my memory, remind myself of how I have improved as a programmer and also make a positive contribution to the project itself.