Chinaunix首页 | 论坛 | 博客
  • 博客访问: 30425
  • 博文数量: 19
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 237
  • 用 户 组: 普通用户
  • 注册时间: 2013-06-08 23:24
文章分类

全部博文(19)

文章存档

2014年(16)

2013年(3)

我的朋友

分类: 项目管理

2014-08-08 09:13:05

Key Idea 1:

There is one metric(公尺)  for readability  called The Fundamental Theorem  of Readability.
Code shoulde be written to minimize the time it would take for someone else to understand it.(代码应该尽可能写的容易理解)
标准:你可以将代码给别人看,并估算别人理解你的代码所花的时间,让这个时间缩短就是你的目标,并且别人可以很轻松的对你的代码进行修改,debug,理解其行为。
通常来讲,实现功能的代码越少,则方案越优,但并非越少的代码就一定越好,你需要在可读性与精简之间做出平衡。


常问自己:Is this code easy to read?

使用以下更有意义的词汇作为命名:


使用带单位的参数: P20


使用描述了变量状态的名称:



阅读(440) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~