Some random information regarding commenting your code #15

Some random information regarding commenting your codeIs commenting required? or suggested?Simply yes. Always comment your code.Note: Commenting is always useful only when it is done right. Bad commenting is worse than not commenting.What should you write in the comment?--------------------------------------Write why the section of the code is required.write-What does the code section do.Write it in plain english. Don't use any language syntax.If you do not find what to write...then better check did you understand the requirements of the assignment/section? Also check, are you sure your design/logic will work? Also, why your design/code will work -- did you really understand. Do not write how the code works in comments but write why and what it does.Why commenting is useful?-------------------------Commenting will make your code more readable to others.Commenting will help others to find out the right section of code to edit/modify. Also, understand the purpose of the program as well as sequence of the logic.It will also help you to review/(work on) your own code laterIn many or most companies, you will hardly write codes from scratch, you have to work on others' code. So commenting is required.Random:--------Use a clear commenting style - easy to editComment as you go/code - do not leave commenting until the end of writing codeIf you are worried that commenting will reduce performance...rather comment and use tools to create release codes without commentscomment above the code -- not at the rightvariable declaration may have comment at the rightif you use any special trick that is not ovbious from the code -- write it in comments [a trick:we can do a right shift for divide by 2]Comments and Pseudocode Programming Practice (PPP)----------------------------------------------------Comments and Pseudocode Programming Practice (PPP) go hand in hand.what is Pseudocode Programming Practice (PPP)?1. Write your logic in plain english may be as a paragraph2. Decompose it step by step into as fine grained that it can not be decomposed further. (The paragraph will be converted to lines of steps)3. comment each line/step (use comment sign like //)4. After each line/comment write the corresponding code.

From: http://sitestree.com/?p=4786
Categories:15
Tags:
Post Data:2011-10-01 17:18:46

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>