As you're stepping through the code, fixing bugs, reading new sections, try to keep your senses alert for things to explore and investigate.
That is, you want to be sensitive to code smells, a wonderful term that was coined by Martin Fowler and Kent Beck some years ago.
Over time, you'll find your ability to detect code smells will improve with practice, but there are also some easy tools which can help you "sniff" the code for possible problem areas:
- Turn on the warnings in your compiler, and pay attention to what the warnings are saying. Modern compilers detect a large variety of easy-to-address problems.
- Find a good static analysis tool and run it. For example, try FindBugs or PMD for Java code, or a classic tool like lint for C.
- Better still, integrate these tools into your build system, so that it runs the warnings and static analysis reports routinely, and places the current results somewhere that you can view them whenever you want.
- Augment your unit test runs with a code-coverage tool like Cobertura or Emma, and have a look at the reports to help understand what code is being tested, how thoroughly it is being tested, and what code isn't being tested at all.