Code Complete, 2nd Edition

Code Complete, 2nd Edition

Read it now on the O’Reilly learning platform with a 10-day free trial.

O’Reilly members get unlimited access to books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.

Book description

Widely considered one of the best practical guides to programming, Steve McConnell’s original CODE COMPLETE has been helping developers write better software for more than a decade. Now this classic book has been fully updated and revised with leading-edge practices—and hundreds of new code samples—illustrating the art and science of software construction. Capturing the body of knowledge available from research, academia, and everyday commercial practice, McConnell synthesizes the most effective techniques and must-know principles into clear, pragmatic guidance. No matter what your experience level, development environment, or project size, this book will inform and stimulate your thinking—and help you build the highest quality code.

Discover the timeless techniques and strategies that help you:

Show and hide more Table of contents Product information

Table of contents

  1. Code Complete, Second Edition
    1. Contents at a Glance
    2. Table of Contents
    3. Preface
      1. Who Should Read This Book?
        1. Experienced Programmers
        2. Technical Leads
        3. Self-Taught Programmers
        4. Students
        1. The Topic of Construction Has Been Neglected
        2. Construction Is Important
        3. No Comparable Book Is Available
        1. Steve McConnell
        1. 1. Welcome to Software Construction
          1. 1.1. What Is Software Construction?
          2. 1.2. Why Is Software Construction Important?
          3. 1.3. How to Read This Book
          4. Key Points
          1. 2.1. The Importance of Metaphors
          2. 2.2. How to Use Software Metaphors
          3. 2.3. Common Software Metaphors
            1. Software Penmanship: Writing Code
            2. Software Farming: Growing a System
            3. Software Oyster Farming: System Accretion
            4. Software Construction: Building Software
            5. Applying Software Techniques: The Intellectual Toolbox
            6. Combining Metaphors
            7. Additional Resources
            1. 3.1. Importance of Prerequisites
              1. Do Prerequisites Apply to Modern Software Projects?
              2. Causes of Incomplete Preparation
              3. Utterly Compelling and Foolproof Argument for Doing Prerequisites Before Construction
                1. Appeal to Logic
                2. Appeal to Analogy
                3. Appeal to Data
                4. Boss-Readiness Test
                1. Iterative Approaches' Effect on Prerequisites
                2. Choosing Between Iterative and Sequential Approaches
                1. Why Have Official Requirements?
                2. The Myth of Stable Requirements
                3. Handling Requirements Changes During Construction
                1. Typical Architectural Components
                  1. Program Organization
                  2. Major Classes
                  3. Data Design
                  4. Business Rules
                  5. User Interface Design
                  6. Resource Management
                  7. Security
                  8. Performance
                  9. Scalability
                  10. Interoperability
                  11. Internationalization/Localization
                  12. Input/Output
                  13. Error Processing
                  14. Fault Tolerance
                  15. Architectural Feasibility
                  16. Overengineering
                  17. Buy-vs.-Build Decisions
                  18. Reuse Decisions
                  19. Change Strategy
                  20. General Architectural Quality
                  1. Requirements
                  2. Software Architecture
                  3. General Software-Development Approaches
                  1. 4.1. Choice of Programming Language
                    1. Language Descriptions
                      1. Ada
                      2. Assembly Language
                      3. C
                      4. C++
                      5. C#
                      6. Cobol
                      7. Fortran
                      8. Java
                      9. JavaScript
                      10. Perl
                      11. PHP
                      12. Python
                      13. SQL
                      14. Visual Basic
                      1. Example of Programming into a Language
                      1. 5. Design in Construction
                        1. 5.1. Design Challenges
                          1. Design Is a Wicked Problem
                          2. Design Is a Sloppy Process (Even If it Produces a Tidy Result)
                          3. Design Is About Tradeoffs and Priorities
                          4. Design Involves Restrictions
                          5. Design Is Nondeterministic
                          6. Design Is a Heuristic Process
                          7. Design Is Emergent
                          1. Software's Primary Technical Imperative: Managing Complexity
                            1. Accidental and Essential Difficulties
                            2. Importance of Managing Complexity
                            3. How to Attack Complexity
                            1. Level 1: Software System
                            2. Level 2: Division into Subsystems or Packages
                            3. Level 3: Division into Classes
                            4. Level 4: Division into Routines
                            5. Level 5: Internal Routine Design
                            1. Find Real-World Objects
                            2. Form Consistent Abstractions
                            3. Encapsulate Implementation Details
                            4. Inherit—When Inheritance Simplifies the Design
                            5. Hide Secrets (Information Hiding)
                              1. Secrets and the Right to Privacy
                              2. An Example of Information Hiding
                              3. Two Categories of Secrets
                              4. Barriers to Information Hiding
                              5. Value of Information Hiding
                              1. Anticipating Different Degrees of Change
                              1. Coupling Criteria
                              2. Kinds of Coupling
                              1. Aim for Strong Cohesion
                              2. Build Hierarchies
                              3. Formalize Class Contracts
                              4. Assign Responsibilities
                              5. Design for Test
                              6. Avoid Failure
                              7. Choose Binding Time Consciously
                              8. Make Central Points of Control
                              9. Consider Using Brute Force
                              10. Draw a Diagram
                              11. Keep Your Design Modular
                              1. Iterate
                              2. Divide and Conquer
                              3. Top-Down and Bottom-Up Design Approaches
                                1. Argument for Top Down
                                2. Argument for Bottom Up
                                3. No Argument, Really
                                1. Software Design, General
                                2. Software Design Theory
                                3. Design Patterns
                                4. Design in General
                                5. Standards
                                1. 6.1. Class Foundations: Abstract Data Types (ADTs)
                                  1. Example of the Need for an ADT
                                  2. Benefits of Using ADTs
                                  3. More Examples of ADTs
                                  4. Handling Multiple Instances of Data with ADTs in Non-Object-Oriented Environments
                                  5. ADTs and Classes
                                  1. Good Abstraction
                                  2. Good Encapsulation
                                  1. Containment ("has a" Relationships)
                                  2. Inheritance ("is a" Relationships)
                                    1. Multiple Inheritance
                                    2. Why Are There So Many Rules for Inheritance?
                                    1. Classes to Avoid
                                    2. Summary of Reasons to Create a Class
                                    1. Classes in General
                                    2. C++
                                    3. Java
                                    4. Visual Basic
                                    1. 7.1. Valid Reasons to Create a Routine
                                      1. Operations That Seem Too Simple to Put Into Routines
                                      2. Summary of Reasons to Create a Routine
                                      1. When to Use a Function and When to Use a Procedure
                                      2. Setting the Function's Return Value
                                      1. Limitations on the Use of Macro Routines
                                      2. Inline Routines
                                      1. 8.1. Protecting Your Program from Invalid Inputs
                                      2. 8.2. Assertions
                                        1. Building Your Own Assertion Mechanism
                                        2. Guidelines for Using Assertions
                                        1. Robustness vs. Correctness
                                        2. High-Level Design Implications of Error Processing
                                        1. Relationship Between Barricades and Assertions
                                        1. Don't Automatically Apply Production Constraints to the Development Version
                                        2. Introduce Debugging Aids Early
                                        3. Use Offensive Programming
                                        4. Plan to Remove Debugging Aids
                                        1. Security
                                        2. Assertions
                                        3. Exceptions
                                        1. 9.1. Summary of Steps in Building Classes and Routines
                                          1. Steps in Creating a Class
                                          2. Steps in Building a Routine
                                          1. Design the Routine
                                          2. Code the Routine
                                          3. Check the Code
                                          4. Clean Up Leftovers
                                          5. Repeat Steps as Needed
                                          1. 10. General Issues in Using Variables
                                            1. 10.1. Data Literacy
                                              1. The Data Literacy Test
                                              2. Additional Resources on Data Types
                                              1. Implicit Declarations
                                              1. Localize References to Variables
                                              2. Keep Variables "Live" for as Short a Time as Possible
                                                1. Measuring the Live Time of a Variable
                                                1. 11.1. Considerations in Choosing Good Names
                                                  1. The Most Important Naming Consideration
                                                  2. Problem Orientation
                                                  3. Optimum Name Length
                                                  4. The Effect of Scope on Variable Names
                                                  5. Computed-Value Qualifiers in Variable Names
                                                  6. Common Opposites in Variable Names
                                                  1. Naming Loop Indexes
                                                  2. Naming Status Variables
                                                  3. Naming Temporary Variables
                                                  4. Naming Boolean Variables
                                                  5. Naming Enumerated Types
                                                  6. Naming Constants
                                                  1. Why Have Conventions?
                                                  2. When You Should Have a Naming Convention
                                                  3. Degrees of Formality
                                                  1. Guidelines for a Language-Independent Convention
                                                  2. Guidelines for Language-Specific Conventions
                                                    1. C Conventions
                                                    2. C++ Conventions
                                                    3. Java Conventions
                                                    4. Visual Basic Conventions
                                                    1. User-Defined Type Abbreviations
                                                    2. Semantic Prefixes
                                                    3. Advantages of Standardized Prefixes
                                                    1. General Abbreviation Guidelines
                                                    2. Phonetic Abbreviations
                                                    3. Comments on Abbreviations
                                                    1. 12.1. Numbers in General
                                                    2. 12.2. Integers
                                                    3. 12.3. Floating-Point Numbers
                                                    4. 12.4. Characters and Strings
                                                      1. Strings in C
                                                      1. If Your Language Doesn't Have Enumerated Types
                                                      1. Why Are the Examples of Creating Your Own Types in Pascal and Ada?
                                                      2. Guidelines for Creating Your Own Types
                                                      1. 13.1. Structures
                                                      2. 13.2. Pointers
                                                        1. Paradigm for Understanding Pointers
                                                          1. Location in Memory
                                                          2. Knowledge of How to Interpret the Contents
                                                          1. Common Problems with Global Data
                                                          2. Reasons to Use Global Data
                                                          3. Use Global Data Only as a Last Resort
                                                          4. Using Access Routines Instead of Global Data
                                                            1. Advantages of Access Routines
                                                            2. How to Use Access Routines
                                                            1. 14. Organizing Straight-Line Code
                                                              1. 14.1. Statements That Must Be in a Specific Order
                                                              2. 14.2. Statements Whose Order Doesn't Matter
                                                                1. Making Code Read from Top to Bottom
                                                                2. Grouping Related Statements
                                                                1. 15.1. if Statements
                                                                  1. Plain if-then Statements
                                                                  2. Chains of if-then-else Statements
                                                                  1. Choosing the Most Effective Ordering of Cases
                                                                  2. Tips for Using case Statements
                                                                  1. 16.1. Selecting the Kind of Loop
                                                                    1. When to Use a while Loop
                                                                      1. Loop with Test at the Beginning
                                                                      2. Loop with Test at the End
                                                                      1. Normal Loop-With-Exit Loops
                                                                      2. Abnormal Loop-With-Exit Loops
                                                                      1. Entering the Loop
                                                                      2. Processing the Middle of the Loop
                                                                      3. Exiting the Loop
                                                                        1. Exiting Loops Early
                                                                        1. 17.1. Multiple Returns from a Routine
                                                                        2. 17.2. Recursion
                                                                          1. Example of Recursion
                                                                          2. Tips for Using Recursion
                                                                          1. The Argument Against gotos
                                                                          2. The Argument for gotos
                                                                          3. The Phony goto Debate
                                                                          4. Error Processing and gotos
                                                                            1. Comparison of the Approaches
                                                                            1. Returns
                                                                            2. gotos
                                                                            1. 18.1. General Considerations in Using Table-Driven Methods
                                                                              1. Two Issues in Using Table-Driven Methods
                                                                              1. Days-in-Month Example
                                                                              2. Insurance Rates Example
                                                                              3. Flexible-Message-Format Example
                                                                              4. Logic-Based Approach
                                                                              5. Object-Oriented Approach
                                                                              6. Table-Driven Approach
                                                                              7. Fudging Lookup Keys
                                                                              1. 19.1. Boolean Expressions
                                                                                1. Using true and false for Boolean Tests
                                                                                2. Making Complicated Expressions Simple
                                                                                3. Forming Boolean Expressions Positively
                                                                                4. Using Parentheses to Clarify Boolean Expressions
                                                                                5. Knowing How Boolean Expressions Are Evaluated
                                                                                6. Writing Numeric Expressions in Number-Line Order
                                                                                7. Guidelines for Comparisons to 0
                                                                                8. Common Problems with Boolean Expressions
                                                                                1. Summary of Techniques for Reducing Deep Nesting
                                                                                1. The Three Components of Structured Programming
                                                                                  1. Sequence
                                                                                  2. Selection
                                                                                  3. Iteration
                                                                                  1. How Important Is Complexity?
                                                                                  2. General Guidelines for Reducing Complexity
                                                                                    1. How to Measure Complexity
                                                                                    2. What to Do with Your Complexity Measurement
                                                                                    1. 20. The Software-Quality Landscape
                                                                                      1. 20.1. Characteristics of Software Quality
                                                                                      2. 20.2. Techniques for Improving Software Quality
                                                                                        1. Development Process
                                                                                        2. Setting Objectives
                                                                                        1. Percentage of Defects Detected
                                                                                        2. Cost of Finding Defects
                                                                                        3. Cost of Fixing Defects
                                                                                        1. Relevant Standards
                                                                                        1. 21.1. Overview of Collaborative Development Practices
                                                                                          1. Collaborative Construction Complements Other Quality-Assurance Techniques
                                                                                          2. Collaborative Construction Provides Mentoring in Corporate Culture and Programming Expertise
                                                                                          3. Collective Ownership Applies to All Forms of Collaborative Construction
                                                                                          4. Collaboration Applies As Much Before Construction As After
                                                                                          1. Keys to Success with Pair Programming
                                                                                          2. Benefits of Pair Programming
                                                                                          1. What Results Can You Expect from Inspections?
                                                                                          2. Roles During an Inspection
                                                                                          3. General Procedure for an Inspection
                                                                                            1. Fine-Tuning the Inspection
                                                                                            1. Walk-Throughs
                                                                                              1. What Results Can You Expect from a Walk-Through?
                                                                                              1. Pair Programming
                                                                                              2. Inspections
                                                                                              3. Relevant Standards
                                                                                              1. 22.1. Role of Developer Testing in Software Quality
                                                                                                1. Testing During Construction
                                                                                                1. Test First or Test Last?
                                                                                                2. Limitations of Developer Testing
                                                                                                1. Incomplete Testing
                                                                                                2. Structured Basis Testing
                                                                                                3. Data-Flow Testing
                                                                                                  1. Combinations of Data States
                                                                                                  1. Compound Boundaries
                                                                                                  1. Which Classes Contain the Most Errors?
                                                                                                  2. Errors by Classification
                                                                                                  3. Proportion of Errors Resulting from Faulty Construction
                                                                                                  4. How Many Errors Should You Expect to Find?
                                                                                                  5. Errors in Testing Itself
                                                                                                  1. Building Scaffolding to Test Individual Classes
                                                                                                  2. Diff Tools
                                                                                                  3. Test-Data Generators
                                                                                                  4. Coverage Monitors
                                                                                                  5. Data Recorder/Logging
                                                                                                  6. Symbolic Debuggers
                                                                                                  7. System Perturbers
                                                                                                  8. Error Databases
                                                                                                  1. Planning to Test
                                                                                                  2. Retesting (Regression Testing)
                                                                                                  3. Automated Testing
                                                                                                  1. Personal Test Records
                                                                                                  2. Additional Resources
                                                                                                  3. Testing
                                                                                                  4. Test Scaffolding
                                                                                                  5. Test First Development
                                                                                                  6. Relevant Standards
                                                                                                  1. 23.1. Overview of Debugging Issues
                                                                                                    1. Role of Debugging in Software Quality
                                                                                                    2. Variations in Debugging Performance
                                                                                                    3. Defects as Opportunities
                                                                                                    4. An Ineffective Approach
                                                                                                      1. The Devil's Guide to Debugging
                                                                                                      2. Debugging by Superstition
                                                                                                      1. The Scientific Method of Debugging
                                                                                                        1. Stabilize the Error
                                                                                                        2. Locate the Source of the Error
                                                                                                        1. Brute-Force Debugging
                                                                                                        1. How "Psychological Set" Contributes to Debugging Blindness
                                                                                                        2. How "Psychological Distance" Can Help
                                                                                                        1. Source-Code Comparators
                                                                                                        2. Compiler Warning Messages
                                                                                                        3. Extended Syntax and Logic Checking
                                                                                                        4. Execution Profilers
                                                                                                        5. Test Frameworks/Scaffolding
                                                                                                        6. Debuggers
                                                                                                        1. 24.1. Kinds of Software Evolution
                                                                                                          1. Philosophy of Software Evolution
                                                                                                          1. Reasons to Refactor
                                                                                                          2. Reasons Not to Refactor
                                                                                                          1. Data-Level Refactorings
                                                                                                          2. Statement-Level Refactorings
                                                                                                          3. Routine-Level Refactorings
                                                                                                          4. Class Implementation Refactorings
                                                                                                          5. Class Interface Refactorings
                                                                                                          6. System-Level Refactorings
                                                                                                          1. Bad Times to Refactor
                                                                                                          1. 25.1. Performance Overview
                                                                                                            1. Quality Characteristics and Performance
                                                                                                            2. Performance and Code Tuning
                                                                                                              1. Program Requirements
                                                                                                              2. Program Design
                                                                                                              3. Class and Routine Design
                                                                                                              4. Operating-System Interactions
                                                                                                              5. Code Compilation
                                                                                                              6. Hardware
                                                                                                              7. Code Tuning
                                                                                                              1. The Pareto Principle
                                                                                                              2. Old Wives' Tales
                                                                                                              3. When to Tune
                                                                                                              4. Compiler Optimizations
                                                                                                              1. Common Sources of Inefficiency
                                                                                                              2. Relative Performance Costs of Common Operations
                                                                                                              1. Measurements Need to Be Precise
                                                                                                              1. Performance
                                                                                                              2. Algorithms and Data Types
                                                                                                              1. 26.1. Logic
                                                                                                                1. Stop Testing When You Know the Answer
                                                                                                                2. Order Tests by Frequency
                                                                                                                3. Compare Performance of Similar Logic Structures
                                                                                                                4. Substitute Table Lookups for Complicated Expressions
                                                                                                                5. Use Lazy Evaluation
                                                                                                                1. Unswitching
                                                                                                                2. Jamming
                                                                                                                3. Unrolling
                                                                                                                4. Minimizing the Work Inside Loops
                                                                                                                5. Sentinel Values
                                                                                                                6. Putting the Busiest Loop on the Inside
                                                                                                                7. Strength Reduction
                                                                                                                1. Use Integers Rather Than Floating-Point Numbers
                                                                                                                2. Use the Fewest Array Dimensions Possible
                                                                                                                3. Minimize Array References
                                                                                                                4. Use Supplementary Indexes
                                                                                                                  1. String-Length Index
                                                                                                                  2. Independent, Parallel Index Structure
                                                                                                                  1. Exploit Algebraic Identities
                                                                                                                  2. Use Strength Reduction
                                                                                                                  3. Initialize at Compile Time
                                                                                                                  4. Be Wary of System Routines
                                                                                                                  5. Use the Correct Type of Constants
                                                                                                                  6. Precompute Results
                                                                                                                  7. Eliminate Common Subexpressions
                                                                                                                  1. Rewrite Routines Inline
                                                                                                                  1. 27. How Program Size Affects Construction
                                                                                                                    1. 27.1. Communication and Size
                                                                                                                    2. 27.2. Range of Project Sizes
                                                                                                                    3. 27.3. Effect of Project Size on Errors
                                                                                                                    4. 27.4. Effect of Project Size on Productivity
                                                                                                                    5. 27.5. Effect of Project Size on Development Activities
                                                                                                                      1. Activity Proportions and Size
                                                                                                                      2. Programs, Products, Systems, and System Products
                                                                                                                      3. Methodology and Size
                                                                                                                      1. 28.1. Encouraging Good Coding
                                                                                                                        1. Considerations in Setting Standards
                                                                                                                        2. Techniques for Encouraging Good Coding
                                                                                                                        3. The Role of This Book
                                                                                                                        1. What Is Configuration Management?
                                                                                                                        2. Requirements and Design Changes
                                                                                                                        3. Software Code Changes
                                                                                                                        4. Tool Versions
                                                                                                                        5. Machine Configurations
                                                                                                                        6. Backup Plan
                                                                                                                        7. Additional Resources on Configuration Management
                                                                                                                        1. Estimation Approaches
                                                                                                                        2. Estimating the Amount of Construction
                                                                                                                        3. Influences on Schedule
                                                                                                                        4. Estimation vs. Control
                                                                                                                        5. What to Do If You're Behind
                                                                                                                        6. Additional Resources on Software Estimation
                                                                                                                        1. Additional Resources on Software Measurement
                                                                                                                        1. How Do Programmers Spend Their Time?
                                                                                                                        2. Variation in Performance and Quality
                                                                                                                          1. Individual Variation
                                                                                                                          2. Team Variation
                                                                                                                          1. Additional Resources on Managing Construction
                                                                                                                          2. Relevant Standards
                                                                                                                          1. 29.1. Importance of the Integration Approach
                                                                                                                          2. 29.2. Integration Frequency—Phased or Incremental?
                                                                                                                            1. Phased Integration
                                                                                                                            2. Incremental Integration
                                                                                                                            3. Benefits of Incremental Integration
                                                                                                                            1. Top-Down Integration
                                                                                                                            2. Bottom-Up Integration
                                                                                                                            3. Sandwich Integration
                                                                                                                            4. Risk-Oriented Integration
                                                                                                                            5. Feature-Oriented Integration
                                                                                                                            6. T-Shaped Integration
                                                                                                                            7. Summary of Integration Approaches
                                                                                                                            1. What Kinds of Projects Can Use the Daily Build Process?
                                                                                                                            2. Continuous Integration
                                                                                                                            1. Integration
                                                                                                                            2. Incrementalism
                                                                                                                            1. 30.1. Design Tools
                                                                                                                            2. 30.2. Source-Code Tools
                                                                                                                              1. Editing
                                                                                                                                1. Integrated Development Environments (IDEs)
                                                                                                                                2. Multiple-File String Searching and Replacing
                                                                                                                                3. Diff Tools
                                                                                                                                4. Merge Tools
                                                                                                                                5. Source-Code Beautifiers
                                                                                                                                6. Interface Documentation Tools
                                                                                                                                7. Templates
                                                                                                                                8. Cross-Reference Tools
                                                                                                                                9. Class Hierarchy Generators
                                                                                                                                1. Picky Syntax and Semantics Checkers
                                                                                                                                2. Metrics Reporters
                                                                                                                                1. Refactorers
                                                                                                                                2. Restructurers
                                                                                                                                3. Code Translators
                                                                                                                                1. Code Creation
                                                                                                                                  1. Compilers and Linkers
                                                                                                                                  2. Build Tools
                                                                                                                                  3. Code Libraries
                                                                                                                                  4. Code-Generation Wizards
                                                                                                                                  5. Setup and Installation
                                                                                                                                  6. Preprocessors
                                                                                                                                  1. Execution Profilers
                                                                                                                                  2. Assembler Listings and Disassemblers
                                                                                                                                  1. Project-Specific Tools
                                                                                                                                  2. Scripts
                                                                                                                                  1. 31. Layout and Style
                                                                                                                                    1. 31.1. Layout Fundamentals
                                                                                                                                      1. Layout Extremes
                                                                                                                                      2. The Fundamental Theorem of Formatting
                                                                                                                                      3. Human and Computer Interpretations of a Program
                                                                                                                                      4. How Much Is Good Layout Worth?
                                                                                                                                      5. Layout as Religion
                                                                                                                                      6. Objectives of Good Layout
                                                                                                                                        1. How to Put the Layout Objectives to Use
                                                                                                                                        1. White Space
                                                                                                                                        2. Parentheses
                                                                                                                                        1. Pure Blocks
                                                                                                                                        2. Emulating Pure Blocks
                                                                                                                                        3. Using begin-end Pairs (Braces) to Designate Block Boundaries
                                                                                                                                        4. Endline Layout
                                                                                                                                        5. Which Style Is Best?
                                                                                                                                        1. Fine Points of Formatting Control-Structure Blocks
                                                                                                                                        2. Other Considerations
                                                                                                                                        1. Statement Length
                                                                                                                                        2. Using Spaces for Clarity
                                                                                                                                        3. Formatting Continuation Lines
                                                                                                                                        4. Using Only One Statement Per Line
                                                                                                                                        5. Laying Out Data Declarations
                                                                                                                                        1. Laying Out Class Interfaces
                                                                                                                                        2. Laying Out Class Implementations
                                                                                                                                        3. Laying Out Files and Programs
                                                                                                                                        1. 32.1. External Documentation
                                                                                                                                        2. 32.2. Programming Style as Documentation
                                                                                                                                        3. 32.3. To Comment or Not to Comment
                                                                                                                                        4. 32.4. Keys to Effective Comments
                                                                                                                                          1. Kinds of Comments
                                                                                                                                            1. Repeat of the Code
                                                                                                                                            2. Explanation of the Code
                                                                                                                                            3. Marker in the Code
                                                                                                                                            4. Summary of the Code
                                                                                                                                            5. Description of the Code's Intent
                                                                                                                                            6. Information That Cannot Possibly Be Expressed by the Code Itself
                                                                                                                                            1. Commenting Individual Lines
                                                                                                                                              1. Endline Comments and Their Problems
                                                                                                                                              2. When to Use Endline Comments
                                                                                                                                              1. General Guidelines for Class Documentation
                                                                                                                                              2. General Guidelines for File Documentation
                                                                                                                                              3. The Book Paradigm for Program Documentation
                                                                                                                                              1. Software-Development Standards
                                                                                                                                              2. Software Quality-Assurance Standards
                                                                                                                                              3. Management Standards
                                                                                                                                              4. Overview of Standards
                                                                                                                                              1. 33.1. Isn't Personal Character Off the Topic?
                                                                                                                                              2. 33.2. Intelligence and Humility
                                                                                                                                              3. 33.3. Curiosity
                                                                                                                                              4. 33.4. Intellectual Honesty
                                                                                                                                              5. 33.5. Communication and Cooperation
                                                                                                                                              6. 33.6. Creativity and Discipline
                                                                                                                                              7. 33.7. Laziness
                                                                                                                                              8. 33.8. Characteristics That Don't Matter As Much As You Might Think
                                                                                                                                                1. Persistence
                                                                                                                                                2. Experience
                                                                                                                                                3. Gonzo Programming
                                                                                                                                                1. 34.1. Conquer Complexity
                                                                                                                                                2. 34.2. Pick Your Process
                                                                                                                                                3. 34.3. Write Programs for People First, Computers Second
                                                                                                                                                4. 34.4. Program into Your Language, Not in It
                                                                                                                                                5. 34.5. Focus Your Attention with the Help of Conventions
                                                                                                                                                6. 34.6. Program in Terms of the Problem Domain
                                                                                                                                                  1. Separating a Program into Levels of Abstraction
                                                                                                                                                    1. Level 0: Operating-System Operations and Machine Instructions
                                                                                                                                                    2. Level 1: Programming-Language Structures and Tools
                                                                                                                                                    3. Level 2: Low-Level Implementation Structures
                                                                                                                                                    4. Level 3: Low-Level Problem-Domain Terms
                                                                                                                                                    5. Level 4: High-Level Problem-Domain Terms
                                                                                                                                                    1. Software Oracles
                                                                                                                                                    2. Eclecticism
                                                                                                                                                    3. Experimentation
                                                                                                                                                    1. 35.1. Information About Software Construction
                                                                                                                                                    2. 35.2. Topics Beyond Construction
                                                                                                                                                      1. Overview Material
                                                                                                                                                      2. Software-Engineering Overviews
                                                                                                                                                      3. Other Annotated Bibliographies
                                                                                                                                                      1. Lowbrow Programmer Magazines
                                                                                                                                                      2. Highbrow Programmer Journals
                                                                                                                                                      3. Special-Interest Publications
                                                                                                                                                        1. Professional Publications
                                                                                                                                                        2. Popular-Market Publications
                                                                                                                                                        1. Introductory Level
                                                                                                                                                        2. Practitioner Level
                                                                                                                                                        3. Professional Level
                                                                                                                                                        Show and hide more

                                                                                                                                                        Product information

                                                                                                                                                        • Title: Code Complete, 2nd Edition
                                                                                                                                                        • Author(s): Steve McConnell
                                                                                                                                                        • Release date: June 2004
                                                                                                                                                        • Publisher(s): Cisco Press
                                                                                                                                                        • ISBN: 9780735619678