Wednesday, June 01, 2005

Understanding Programs Written By Others

All programmers will at some point find themselves having to depend on other peoples programs for various things

  1. Maintenance
  2. To use as an extension
  3. To use as a starting point

You could find yourself in a situation where somebody else is working on your code.

Believe me, code does not get thrown away that easily.

I have been thinking of ways and means of understanding third party code easily. Here are my first thoughts

If you are the author of new code

  1. Comment it well (its obvious), but revisit your comments and documents you have written
  2. Read the Practice of Programming before you write code
  3. Learn about Literate Programming and try to use it if possible

If you are burdened with somebody else's code

  1. Read the documentation that comes with the code, too bad if it does not come with any documentation. If you do not understand the document, read it several times
  2. Read the test plan document first and see if you understand the test cases
  3. Use a reverse engineering tool like
    • cflow
    • Any commercial tool available
    • codeviz

  4. Get the overall goals of the software - Don't dig into algorithms right away, just understand what the algorithm is trying to achieve
  5. Search on google for understanding the technology and the jargon
Post a Comment