The Practice of Programming,中文译为《程序设计实践》,英文版最早出版于 1999 年。书中内容涵盖了排错、测试、性能、可移植性、设计、界面、风格和记法等方面,讨论了程序设计中实际的、又是非常深刻和具有广泛意义的思想、技术和方法。这本书的作者 Brian W.Kernighan和 Rob Pike 在贝尔实验室的计算机科学研究中心工作。Brian Kernighan 是 Addison-Wesley 的“专业计算丛书”顾问编辑,也是《C程序设计语言》的合著者之一。Rob Pike 则是 Plan 9 和 Inferno 操作系统的主要结构设计与实现者。作者工作这么多年,在不同的城市兜兜转转,就这本 The Practice of Programming 一直带着。但是如今距离这本书最早出版已经 18 年了,又是什么让作者在现在还想要重读呢?作者就在文中回顾了自己觉得书中经久不衰的一些内容,比如测试和 debug 的一些方法与思想。Contents
Preface
Chapter 1: Style
1.1 Names
1.2 Expressions and Statements
1.3 Consistency and Idioms
1.4 Function Macros
1.5 Magic Numbers
1.6 Comments
1.7 Why Bother?
Chapter 2: Algorithms and Data Structures
2.1 Searching
2.2 Sorting
2.3 Libraries
2.4 A Java Quicksort
2.5 0-Notation
2.6 Growing Arrays
2.7 Lists
2.8 Trees
2.9 Hash Tables
2.10 Summary
Chapter 3: Design and Implementation
3.1 The Markov Chain Algorithm
3.2 Data Structure Alternatives
3.3 Building the Data Suucture in C
3.4 Generating Output
3.5 Java
3.6 C
3.7 AwkandPerl
3.8 Performance
3.9 Lessons
Chapter 4: Interfaces
4.1 Comma-Separated Values
4.2 A Prototype Library
4.3 A Library for Others
4.4 A C Implementation
4.5 Interface Principles
4.6 Resource Management
4.7 Abort, Retry. Fail?
4.8 User Interfaces
Chapter 5: Debugging
5.1 Debuggers
5.2 Good Clues, Easy Bugs
5.3 No Clues, Hard Bugs
5.4 Last Resorts
5.5 Non-reproducible Bugs
5.6 Debugging Tools
5.7 Other People's Bugs
5.8 Summary
Chapter 6: Testing
6.1 Test as You Write the Code
6.2 Systematic Testing
6.3 Test Automation
6.4 Test Scaffolds
6.5 Stress Tests
6.6 Tips for Testing
6.7 Who Does the Testing?
6.8 Testing the Markov Program
6.9 Summary
Chapter 7: Performance
7.1 A Bottleneck
7.2 Timing and Profiling
7.3 Strategies for Speed
7.4 Tuning the Code
7.5 Space Efficiency
7.6 Estimation
7.7 Summary
Chapter 8: Portability
8.1 Language
8.2 Headers and Libraries
8.3 Program Organization
8.4 Isolation
8.5 Data Exchange
8.6 Byte Order
8.7 Portability and Upgrade
8.8 Internationalization
8.9 Summary
Chapter 9: Notation
9.1 Formatting Data
9.2 Regular Expressions
9.3 Programmable Tools
9.4 Interpreters, Compilers, and Virtual Machines
9.5 Programs that Write Programs
9.6 Using Macros to Generate Code
9.7 Compiling on the Fly
Epilogue
Appendix: Collected Rules
Index
评论