Comments are the irritating factor for many programmers. I have seen several programmers ( perhaps I was be one of them) who believes that comments are time killers and natter waste in programming.
1. "Boss I don't have enough time to put those nasty comments"
This is a usual comment from common programmers. They strictly believes that the comments will
take extra time which can be utilized for better programming. Be frank its a wrong idea.I have a question to all readers. "What is the position of comments in our programs. Before writing the code or after writing the code.?"
usually programmers say after writing the code. Normally programmers following this custom.
Write the comments based on the logic we have written is that custom. Be frank its a wrong idea.
comment has to written before writing the code components. dont agree with me..?
just imagine your are going to build a new house and your architect says that "I dont want a blue print to build this house" Then what will be status of the house. nasty isn't it? so we do have a plan before things get done. Like that we have to think about the things we want to code and document it. So this will lead us to better application development. The extra time it take to plan and document or comment will save lot more time than it really takes to write. trust me and try it you can see the difference.
2. "I will put comments Later"
This is the laziest dialogue a programmer ever talk. And in 90% cases this will not going to happen :-)
If we are not writing comments today ; we will never write it. So you have to write it today itself. Comments has to be write before coding so how do you put comments later.? This will be as vulgar like creating a plan after constructing a building.
3. "I can understand my code. Then why do i write comment"
comment is not a story about the code. actually a comment defines to be " what the code can't tell about itself ". We the programmers usually think i've written the code and what is the need of a documentation. I can understand my code better than anyone else. But some times we cant. We can't even understand for what purpose we have write that program. Why do i require these vairables;
is there any specific purpose. What these short codes in my program means for.is this variable mg means for message or management or marriage. total confusion.This will happens because programming languages are criptive in nature and they are developed for computers not for human beings. English is developed for humans but programming languages are not. So you have to write comment even if it was your code. This particularly from my personal experience.
4. "My team mate will understand what I have written.i dont want him to play with my code"
This is usually the selfish dialogue from a programmer. Some programmers believe that if they provide
proper documentation or comment then some one else in our team will understand our logic and method of programming. This is a ridiculous nature which is not at all suit for a programmer who is in a team. An important role as a team player is to support colleagues. If you do not support your colleague then you are not suit for any organization. So you have to write comments which will help others when they want to reuse or modify your code. This is an ethic in programming. So you have to follow. If you really think you are too big then you will have to regret if you see even bigger persons.