没有合适的资源?快使用搜索试试~ 我知道了~
the element of programing style
需积分: 11 7 下载量 168 浏览量
2009-11-15
13:24:54
上传
评论
收藏 40KB PDF 举报
温馨提示
试读
3页
作者: Brian W. Kernighan / P. J. Plauge 出版社: Computing Mcgraw-Hill 一本老书,写书的两个牛人. Brian W. Kernighan,熟悉unix/c语言的没有不知道他老人家的大名的,文字漂亮,技术厉害. P. J. Plauger,这位仁兄是为ms提供stl实现的公司头头(不过jjHou说那是可读性最差的一份stl实现,哈哈), 他很早就在c++里面混了,似乎是CUJ的高级编辑
资源推荐
资源详情
资源评论
The Elements of Programming Style
The following rules of programming style are excerpted from the book “The Elements of
Programming Style” by Kernighan and Plauger, published by McGraw Hill. Here is quote
from the book: “To paraphrase an observation in The Elements of Style by Strunk and
White, the rules of programming style, like those of English, are sometimes broken, even by
the best writers. When a rule is broken, however, you will usually find in the program some
compensating merit, attained at the cost of the violation. Unless you are certain of doing as
well, you will probably do best to follow the rules.”
1. Write clearly– don’t be too clever.
2. Say what you mean, simply and directly.
3. Use library functions whenever feasible.
4. Avoid too many temporary variables.
5. Write clearly – don’t sacrifice clarity for “efficiency.”
6. Let the machine do the dirty work.
7. Replace repetitive expressions by calls to common functions.
8. Parenthesize to avoid ambiguity.
9. Choose variable names that won’t be confused.
10. Avoid unnecessary branches.
11. If a logical expression is hard to understand, try transforming it.
12. Choose a data representation that makes the program simple.
13. Write first in easy-to-understand pseudo language; then translate into
whatever language you have to use.
14. Modularize. Use procedures and functions.
15. Avoid gotos completely if you can keep the program readable.
资源评论
createfly
- 粉丝: 2
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功