Code Reading
共享用户信息
|
书籍简介
If you are a programmer, you need this book.
-
You’ve got a day to add a new feature in a 34,000-line program: Where do you start? Page 333
-
How can you understand and simplify an inscrutable piece of code? Page 39
-
Where do you start when disentangling a complicated build process? Page 167
-
How do you comprehend code that appears to be doing five things in parallel? Page 132
You may read code because you have to-to fix it, inspect it, or improve it. You may read code the way an engineer examines a machine–to discover what makes it tick. Or you may read code because you are scavenging–looking for material to reuse.
Code-reading requires its own set of skills, and the ability to determine which technique you use when is crucial. In this indispensable book, Diomidis Spinellis uses more than 600 real-world examples to show you how to identify good (and bad) code: how to read it, what to look for, and how to use this knowledge to improve your own code.
Fact: If you make a habit of reading good code, you will write better code yourself.
Copyright
Effective Software Development Series
Figures
Tables
Foreword
Preface
Supplementary Material
Acknowledgments
Chapter 1. Introduction
Section 1.1. Why and How to Read Code
Section 1.2. How to Read This Book
Further Reading
Chapter 2. Basic Programming Elements
Section 2.1. A Complete Program
Section 2.2. Functions and Global Variables
Section 2.3. while Loops, Conditions, and Blocks
Section 2.4. switch Statements
Section 2.5. for Loops
Section 2.6. break and continue Statements
Section 2.7. Character and Boolean Expressions
Section 2.8. goto Statements
Section 2.9. Refactoring in the Small
Section 2.10. do Loops and Integer Expressions
Section 2.11. Control Structures Revisited
Further Reading
Chapter 3. Advanced C Data Types
Section 3.1. Pointers
Section 3.2. Structures
Section 3.3. Unions
Section 3.4. Dynamic Memory Allocation
Section 3.5. typedef Declarations
Further Reading
Chapter 4. C Data Structures
Section 4.1. Vectors
Section 4.2. Matrices and Tables
Section 4.3. Stacks
Section 4.4. Queues
Section 4.5. Maps
Section 4.6. Sets
Section 4.7. Linked Lists
Section 4.8. Trees
Section 4.9. Graphs
Further Reading
Chapter 5. Advanced Control Flow
Section 5.1. Recursion
Section 5.2. Exceptions
Section 5.3. Parallelism
Section 5.4. Signals
Section 5.5. Nonlocal Jumps
Section 5.6. Macro Substitution
Further Reading
Chapter 6. Tackling Large Projects
Section 6.1. Design and Implementation Techniques
Section 6.2. Project Organization
Section 6.3. The Build Process and Makefiles
Section 6.4. Configuration
Section 6.5. Revision Control
Section 6.6. Project-Specific Tools
Section 6.7. Testing
Further Reading
Chapter 7. Coding Standards and Conventions
Section 7.1. File Names and Organization
Section 7.2. Indentation
Section 7.3. Formatting
Section 7.4. Naming Conventions
Section 7.5. Programming Practices
Section 7.6. Process Standards
Further Reading
Chapter 8. Documentation
Section 8.1. Documentation Types
Section 8.2. Reading Documentation
Section 8.3. Documentation Problems
Section 8.4. Additional Documentation Sources
Section 8.5. Common Open-Source Documentation Formats
Further Reading
Chapter 9. Architecture
Section 9.1. System Structures
Section 9.2. Control Models
Section 9.3. Element Packaging
Section 9.4. Architecture Reuse
Further Reading
Chapter 10. Code-Reading Tools
Section 10.1. Regular Expressions
Section 10.2. The Editor as a Code Browser
Section 10.3. Code Searching with grep
Section 10.4. Locating File Differences
Section 10.5. Roll Your Own Tool
Section 10.6. The Compiler as a Code-Reading Tool
Section 10.7. Code Browsers and Beautifiers
Section 10.8. Runtime Tools
Section 10.9. Nonsoftware Tools
Chapter 11. A Complete Example
Section 11.1. Overview
Section 11.2. Attack Plan
Section 11.3. Code Reuse
Section 11.4. Testing and Debugging
Section 11.5. Documentation
Section 11.6. Observations
Appendix A. Outline of the Code Provided
Appendix B. Source Code Credits
Appendix C. Referenced Source Files
Appendix D. Source Code Licenses
Section D.1. ACE
Section D.2. Apache
Section D.3. ArgoUML
Section D.4. DemoGL
Section D.5. hsqldb
Section D.6. NetBSD
Section D.7. OpenCL
Section D.8. Perl
Section D.9. qtchat
Section D.10. socket
Section D.11. vcf
Section D.12. X Window System
Appendix E. Maxims for Reading Code
Chapter 1: Introduction
Chapter 2: Basic Programming Elements
Chapter 3: Advanced C Data Types
Chapter 4: C Data Structures
Chapter 5: Advanced Control Flow
Chapter 6: Tackling Large Projects
Chapter 7: Coding Standards and Conventions
Chapter 8: Documentation
Chapter 9: Architecture
Chapter 10: Code-Reading Tools
Chapter 11: A Complete Example
Bibliography
Epigraph Credits
Colophon
CD-ROM Warranty