Table of Contents
How to Understand a New Code Base
You'll figure out an approach that works for you, and you will hone your skill. Here are some pointers to help you get started.
Throughout the process, keep updating your mental model of how the application works. (You can draw components if that helps.) If you don't know what does something, then you can just make it a black box. Eventually, you can replace the black box with the actual component. For example, you know there is a “compiler” black box for Java. You don't need to know what the details are for how it works, but as you learn more in CSCI210, you'll understand what the compiler is actually doing.
Peeling the Onion
Start from the high-level and work to the low-level.
- What are the directories in this project? What does each directory represent? (Gets at the “components” idea above.) Stick with the higher-level directories for awhile, then dig down into the subdirectories.
- What are the files in a given directory? How are they named? How does that relate to the “vocabulary” of the project?
- Pick a file in one of these directories. What is its outline? (Don't get into the details too much yet; stick with methods and larger blocks of information.)
Follow the Flow of Code
Start at the beginning and trace through the application. For example, start at the home page of the web application. What code created that page? Click a link or button to go to another page. How did you get there? What code was involved in that process?
You can use a debugger and put breakpoints in the code to follow the code.
What is the “vocabulary” of the project? What are the nouns that describe the data and the verbs that describe the functionality? What keywords should you use to search the code base for how this works?
Try to make some small changes to the code and see how they affect the application.