Reading source code.
I've always wondered this: How does an experienced developer dive into the code of a project he's never looked at before? I mean, do you look at the makefile, see where the main is, and try to follow the execution of the program? Or do you first look at the file layout to try to get an idea of how the app is structured? Do you just open a file that looks interesting and start reading, following the chain of included files around until you get an idea of what some important files are? How do you start building a mental model of the structure of an application while you still have incomplete information as you're reading the source, when you didn't have any documentation in the first place?
You get the idea. I bet people who are accustomed to reading other people's source on a regular basis have a definite process they go through, and the experience they have helps them grasp the structure of a program quicker than others would be able to. Are there any secrets?
[Keith's Weblog]
I find that javadoc is the best way to get a feel for the code and how its organised. Javadoc rocks. It takes a very short amount of time to build up a mental model of how the code is structured by just a few mouse clicks.
Then looking at the JUnit test cases is usually the next area to look at to get a feel for how to use the API. Only after I've taken a look at those two areas do I delve into the actual source code.
11:01:32 AM
|