All posts tagged Best Pratices

Best Pratices: Comments and ASDocs

You can think that this title is funny, because the subject seems to be simple and basic, but believe me, there is a lot of people that has doubts about how comment the code, a lot of people that don’t use (and them should) the comments, some people that doesn’t know what it is or never seen.
If you fit into one of the profiles above, or not, you can be interested on the utility that the code comments have to us, programmers.

Believe or not, we can consider the comments like one of our best friends when the subject is programming. A comment has the objective of documenting the wrote code, so that in the future you know what that code does, and why it does. And it helps on the code viewing too.
We can think that doesn’t has need to comment a code, because at the moment that we are writing the code, everything is clear and fresh on our mind. But the problem comes my friend, when after some months, you have to do “some updates” in the code.
What you see is a tangle of words, and it’s really complicated to find something there. And if you find what you want… you don’t know how it works, because the code is very large and you will expend hours trying to figure out where you have to edit, or because it doesn’t explains itself enough.

That is where our friend comes. If the code is well commented, the viewing will be better (because the code isn’t squeezed) and you will have an explanation of what that piece of code do.
There is three types of comments in most languages: line comment, multi-line comment, and the last, asdoc, similar to javadoc.

Read more…