How do you go about understanding a complex piece of code?
timhahn 100000F0AC Visits (1547)
Anyone who writes software for a living has been in this position. You're asked to make an update to an existing application or to add a new feature to an application. And you've never seen the source code before. Or maybe you have, but that was 2 weeks ago and so many things have happened since then that you can't recall a thing about the application.
What do you do? If you're like most developers, you pick up a piece of the source code, look at it for awhile, get a feel for what's going on, and repeat until you have a good enough idea of the program structure that you feel confident in making some changes. Unfortunately, this is time consuming, really difficult to do, and you even run the risk of looking at a piece of code that is either rarely run through or might even be wrong. This situation gets astronomically more difficult when the source code base rises into the 10,000s or 100,000s of source modules and spans 1,000s of relational tables in a database.
There are tools available to help developers navigate through a large source code base, and they're much more useful for code understanding and analysis than the programmer's trusted friends: find, grep, and Perl. One such tool is Rational Asset Analyzer. This tool provides users the ability to search very quickly through large amounts of source code coupled with DB2 and IMS/DB database schema. While some basic source code metrics are available easily from the starting pages of its user interface, the real power of RAA comes out when its program structure diagrams, impact analysis, and dead-code display features are used. By indexing the source code by the variables and identifiers used in the source code, RAA can point out subtle dependencies between modules and database tables which would otherwise go un-noticed by developers unfamiliar with the source code base.
Leshek Feidorowicz has recently created a short video which shows some of RAA's features. I found it very informative and if you are in need of program understanding tools I think you'll find it interesting as well. You can find it here.