What I typically do is quickly scan through the package structure of the code, the class name and public methods. If the code structure is good, then I can get some rough idea about where the logic lies. However, I rely more on analyzing the run time behavior of the code to determine its logic flow.
A technique that I use frequently is to just run the system and determine the execution path. At the first step, I need to determine the entry points of the system.
Locate the entry points
Usually, the entry points are ...
- main() method where the system boots
- background maintenance tasks
- event-driven callbacks
After I get an idea about where the entry points are, the next step is to drill down into each execution point to study what it is doing.
Drill down into entry points
The first thing I usually do is to read through the code trying to understand what it is doing. Eclipse IDE is very effective to navigate through the code to see which method is calling which method. The most frequently used Eclipse feature is ...
- "open declaration" which jumps to the method being called
- "references" which list all the methods that is calling this methods
- "Calling hierachy" which is a tree of callers which calls this method
- "Type hierachy" which is a tree of Class hierachy
Document the understanding
Draw a UML diagram to describe my understanding. And also take notes about any observed issues and what can be improved.
No comments:
Post a Comment