首页 > 编程语言 > 详细

JavaScript Patterns 2.11 Writing Comments

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

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!