学习笔记之《Code Reading:The Open Source Perspective》Chapter one
2010-07-16 21:48
447 查看
Ø 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
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 two(part2)
- Code Reading: The Open Source Perspective 各章精要
- 学习笔记之《Code Reading:The Open Source Perspective》Chapter two(part1)
- Code Reading: The Open Source Perspective 各章精要2
- 《Code Reading:The Open Source Perspective》Chapter two之Control Structures Revisited
- Code reading: the open source perspective
- 小熊arm学习总结:iar7.3建立工程报错:cannot open the source file "XXXxxx.h
- The Architecture of Open Source Applications——阅读笔记part 1
- 作为程序员容易忽略的一些问题 读《Code Quality :The Open Source Perspective》有感
- C++学习笔记第一天:熟悉C++,解决“Cannot find or open the PDB file”问题
- Code Quality: The Open Source Perspective
- 借助开源项目,学习软件开发 (learn-with-open-source)
- The Lab Renderer学习笔记
- Python学习笔记(8):The ElementTree XML API——操作XML文件
- 学习笔记 Real COM with the MFC Library (译三)
- Some of the best Open Source Project's in VC++ & MFC
- Some of the best Open Source Project's in VC++ & MFC
- Inside the C++ Object Model学习笔记[Chap3.0]
- The Architecture of Open Source Applications - CMake
- Flume NG 学习笔记(四)Source配置