The Art of Readable Code
来源:互联网 发布:阿里云cdn 编辑:程序博客网 时间:2024/05/18 02:29
Chapter One:
key idea:
Code should be written to minimize the time it would take for someone else to understand it.
Chapter Two:
key idea:
pack information into your names.
a few tips:
Use specific words-- for example, instead of Get, would like Fetch or Download might be better, depending on the content.
Avoid generic names like tmp and retval, unless there's a specific reason to use them.
Use concrete names that describe things in more detail -- the name ServerCanStart is vague compare to CanListenPort.
Attach important details to variable names-- for example append _ms to a variable whose value is in milliseconds or prepend raw_ to an unprocessed variable that need escaping.
Use longer names for large scopes--don't use cryptic one- or two-letter names for variable that span multiple screens; short names are better for variables that span only a few lines.
Use capitalization, underscores, and so on in a meaningful way--for example, you can apprend "_" to class members to distinguish them from local variables
- The Art of Readable Code
- [The Art of Readable Code]拆分超长表达式
- <The Art of Readable Code> 笔记二 (上)
- <The Art of Readable Code> 笔记二 (上)
- <The Art of Readable Code> 笔记二 (上)
- <The Art of Readable Code> 笔记二 (上)
- <The Art of Readable Code> 笔记二 (上)
- 又一本新书《The Art of Readable Code -- 编写可读代码的艺术》
- 晒书有礼!《编写可读代码的艺术》(The Art of Readable Code)晒书有礼活动进行中
- Art of code comment
- The Art of Java
- The Art of C++
- The Art of SQL
- The Art of Rails
- the art of conclusion
- The art of deception
- the Art of Life
- The Art of Debugging
- 驱动复习总结--指明代码加载内存位置的几种方式
- uboot环境变量与内核MTD分区关系
- logout函数,有待改进,先完成基本的功能
- 解决MyEclipse内存不足
- ArcGIS Engine升级记录,从9.3到10.0
- The Art of Readable Code
- SSH简单定时器例子
- 拼接存储过程 数据保留2位小数
- SSH文件上传的简单例子
- 12-5-21关于sscanf
- shell的预定义变量
- 黑马程序员_银行调度系统分析学习日记
- 设计模式简介
- 编程界面的字体大小改变