共用方式為


Tips on how to read code?

Jeremy's asking:

So how do you teach people this “art” of digging deep very quickly into unfamilar code that you had no hand in writing? I myself, I come from a very traditional process of learning how to code.. by sitting down and writing it. I am struggling with how to tailor a delivery to focus on reading vs. writing source code. To me the only way you can be truely efficient in this process is by having written code yourself.

Comments

  • Anonymous
    January 01, 2003
    Familiar Ground
  • Anonymous
    June 14, 2004
    If the documentation for the code doesn't help you read it, find the person who originally wrote the code and fire him. If he's no longer w/ the company, track him down and puncture his tires.
  • Anonymous
    June 14, 2004
    The comment has been removed
  • Anonymous
    June 14, 2004
    Assuming the original developer and documentation are not available, I find that stepping through the code in a debugger is helpful, adding my own comments is helpful. Beyond that, depending on the code you are working with, using a UML modeling tool to generate a static structure can give you a better picture of the structure of the application and give you a better place to start than from nowhere. Finally, if you are trying to do something more than just 'understand' the code, there are some other tools that can be helpful, including calculating cyclomatic complexity to identify risky procedures, or timing tools (like True Time ..etc.. to identify bottlenecks.)