- Maintenance
- To use as an extension
- 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
- Comment it well (its obvious), but revisit your comments and documents you have written
- Read the Practice of Programming before you write code
- Learn about Literate Programming and try to use it if possible
If you are burdened with somebody else's code
- 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
- Read the test plan document first and see if you understand the test cases
- Use a reverse engineering tool like
- cflow
- Any commercial tool available
- codeviz
- Get the overall goals of the software - Don't dig into algorithms right away, just understand what the algorithm is trying to achieve
- Search on google for understanding the technology and the jargon
6 comments:
I remember reading a book by Martin Fowler on Refactoring.Refactoring is a structured way of improving the code and it also enhances one's understanding of the code.
Refactoring is a great technique. It is useful for code maintenance and for organic code.
I like the way Javadoc makes it simple for a developer to insert code documentation. The reluctance to document is definitely the extra effort and anything that makes it easier is a developer's delite!
Yes, I found the following tools useful
1. Doxygen
2. Javadoc
3. Web/Cweb/Nweb, etc
But, if the developer decides not to document the code, we are in soup. Remember good comments can also suffice.
Doxygen can do some kind of reverse engineering, but I am not sure about Javadoc.
Actually, doxygen is more powerful than javadoc as it actually indexes the source code with comments, so you can actually browse code while reading the comments. I love it - it is easy, and works well with all styles of comments.
Thats really cool! I must start insisting on documentation with code in the future, lets see how much I can impose.
Post a Comment