学习笔记之《Code Reading:The Open Source Perspective》Chapter one
来源:互联网 发布:网络女主播被粉丝砍死 编辑:程序博客网 时间:2024/05/17 00:56
Ø Why to Read Code
Make it a habit to spend time reading high-quality code that others have written. Just as reading high-quality prose will enrich your vocabulary, trigger your imagination, and expand your mind, examining the innards of a well-designed software system will teach you new architectural patterns, data structures, coding methods, algorithms, style and documentation conventions, application programming interfaces (APIs), or even a new computer language. Reading high-quality code is also likely to raise your standards regarding the code you produce.
Ø Signs of low quality code
l An inconsistent coding style
l A gratuitously complicated or unreadable structure
l Obvious logical errors or omissions
l Overuse of nonportable constructs
l Lack of maintenance
Ø Notice
Notice and appreciate the code's particular nonfunctional requirements that might give rise to a specific implementation style. Requirements for portability, time or space efficiency, readability, or even obfuscation can result in code with very peculiar characteristics.
Ø How to read code
1. Given a basic familiarity with programming and the underlying computer science concepts, you can in many cases use source code as a way to teach yourself the basics of the new environment.
2. The next step involves actively changing the code to test your understanding. Again, begin with small changes and gradually increase their scope. Your active involvement with real code can quickly teach you the basics of the new environment.
3. Once you think you have mastered them, consider investing some effort (and possibly some cash) to learn the environment in a more structured way. Read related books, documentation, or manual pages, or attend training courses; the two methods of learning complement each other.
Some tips:
1. When you read code that falls in the above categories, keep in mind the specific nonfunctional requirements to see how your colleague satisfied them.
2. If the code is valuable to you or your community, think about how you could improve it. This can involve using a better design or algorithm, documenting some code parts, adding functionality, or consider reinvesting your understanding of the code in improved documentation.
Andy编辑于2010-07-16 21:49:14
- 学习笔记之《Code Reading:The Open Source Perspective》Chapter one
- 学习笔记之《Code Reading:The Open Source Perspective》Chapter two(part1)
- 学习笔记之《Code Reading:The Open Source Perspective》Chapter two(part2)
- 《Code Reading:The Open Source Perspective》Chapter two之Control Structures Revisited
- Code reading: the open source perspective
- Code Reading: The Open Source Perspective 各章精要
- Code Reading: The Open Source Perspective 各章精要2
- Code Quality: The Open Source Perspective
- CSAPP 学习笔记 Chapter one
- PMBOK Reading Notes - Chapter One
- cJSON source code reading
- C++ Primer(Third Edition)学习笔记之------Chapter One
- The Logbook of Qt Source Code Reading(1)
- Cracking the Code Interview Chapter One-- TaylorZhangYuxin's Solusion
- Chapter 1 A Guided Tour Of The MySQL Source Code
- C++Primer Chapter One学习笔记
- Accelerated C++学习笔记chapter one
- BeansDB Source Code Reading (1)
- 福建瑞芯微电子实习第三天
- spring2.5.6学习笔记二:轻量级和重量级概念的划分
- 儿童抑郁症触发器
- 心情
- 最近的状态
- 学习笔记之《Code Reading:The Open Source Perspective》Chapter one
- 快速排序(C++)
- 页面弹出下载文件之后,页面失效解决方法(转载)
- CSDN,我来了
- 下载安装boost(基于vc)
- 【小阅读^大脑袋】0709 NO.385
- zoj 1005 Jugs || poj 1606 (广搜做法~~~~)
- libc.so
- VC串口小程序(用SerialPort类)