Rapid code comprehension using a text editor + a simple find tool
Today I was asked to spend a couple of hours to understand the source code for a legacy project. I didn't have much time so I decided not to set up the source tree in my IDE (despite the coolness of the Eclipse Creole visualization plug-in, which currently is not working for me for some reason).
At first I tried using a treemap tool to visualize the source files by their sizes (Panopticon has asked me to evaluate their treemap disk viewer -- pretty slick in some places, but pretty rough in others). This is always an interesting exercise.
But all these fancy visualization tools didn't provide me with nearly the same bang-for-your-buck as that tried and tested method of simply reading the source code in a good text editor. Actually the main requirement of the text editor for this purpose is being able to find things quickly. My favourite editor (XEmacs) has incremental find, and it works great.
Besides a text editor with good searching capability, you'll also need a tool to find files by (1) name and (2) content. I just used Windows Find for this purpose. It has two text boxes: one for finding by filename, and one for finding words within a file. Surprisingly, this simple technique felt a *lot* like using Eclipse's treasured Browse Types By Name and Find References functions -- maybe not as accurate, but you don't need accuracy when doing quick code comprehension.
In summary, rapid code comprehension can be achieved with two tools: any text editor with a good Find function, and any tool for finding files by name or by content (the stock Windows Find will suffice). You get the IDE-like flow, with zero setup. Surprisingly it can be a more effective approach for code comprehension than fancy graphical tools.
Sometimes it's the simple ideas that get the most mileage.
0 Comments:
Post a Comment
<< Home