码迷,mamicode.com
首页 > 编程语言 > 详细

JavaScript Patterns 2.11 Writing Comments

时间:2014-05-27 18:05:25      阅读:355      评论:0      收藏:0      [点我收藏+]

标签:des   style   c   class   code   java   

Document all functions, their arguments and return values, and also any interesting or unusual algorithm or technique. Think of the comments as hints to the future readers of the code; the readers need to understand what your code does without reading much more than just the comments and the function and property names. When you have, for example, five or six lines of code performing a specific task, the reader can skip the code details if you provide a one-line description describing the purpose of the code and why it’s there. There’s no hard and fast rule or ratio of comments-to-code; some pieces of code (think regular expressions) may actually require more comments than code. 

The most important habit, yet hardest to follow, is to keep the comments up to date.

JavaScript Patterns 2.11 Writing Comments,布布扣,bubuko.com

JavaScript Patterns 2.11 Writing Comments

标签:des   style   c   class   code   java   

原文地址:http://www.cnblogs.com/haokaibo/p/3752930.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!