Code Complete

Code Complete

by Steve McConnell
Code Complete

Code Complete

by Steve McConnell

Paperback(2nd ed.)

$54.99 
  • SHIP THIS ITEM
    Qualifies for Free Shipping
    Choose Expedited Shipping at checkout for delivery by Wednesday, April 3
  • PICK UP IN STORE
    Check Availability at Nearby Stores

Related collections and offers


Overview

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:

  • Design for minimum complexity and maximum creativity
  • Reap the benefits of collaborative development
  • Apply defensive programming techniques to reduce and flush out errors
  • Exploit opportunities to refactor—or evolve—code, and do it safely
  • Use construction practices that are right-weight for your project
  • Debug problems quickly and effectively
  • Resolve critical construction issues early and correctly
  • Build quality into the beginning, middle, and end of your project

Product Details

ISBN-13: 9780735619678
Publisher: Pearson Education
Publication date: 06/09/2004
Series: Developer Best Practices
Edition description: 2nd ed.
Pages: 960
Sales rank: 458,223
Product dimensions: 7.30(w) x 8.90(h) x 2.00(d)

About the Author

Steve McConnell is recognized as one of the premier authors and voices in the development community. He is Chief Software Engineer of Construx Software and was the lead developer of Construx Estimate and of SPC Estimate Professional, winner of Software Development magazine's Productivity Award. He is the author of several books, including Code Complete and Rapid Development, both honored with Software Development magazine's Jolt Award.

Read an Excerpt


From Chapter 20: Programming Tools

...20.6 Ideal Programming Environment

This section's description of an ideal programming environment is an excursion into programming fantasyland. Although such a vision is not immediately practical, this book about construction has a responsibility to define where construction tools should be going. All of the capabilities described in this section are easily within the reach of today's technology. Perhaps the description will serve as inspiration for an ambitious toolsmith who will create a programming environment that towers above the ones currently available.

For this discussion, the fantasy environment is called "Cobbler." The name is inspired by the old saying that the cobbler's children are the last to have new shoes, which is true of today's programmers and programming tools.

Integration

The Cobbler environment integrates the programming activities of detailed design, coding, and debugging. When source-code control is needed, Cobbler integrates source-code version control too. If the detailed-design practices suggested in this book are followed, the primary detailed-design tool required is PDL, which can be handled easily, even in text environments.

Language support

During code construction, Cobbler provides ready access to cross-referenced help on the programming language. Help discusses nuances of the language as well as the basics and mentions common problems in using features of the language. For error messages, Help lists the common problems that might give rise to each message.

The environment provides templates for language constructs so that youdon't need to remember the precise syntax for a case statement, a for loop, or a more unusual construct. The help systems provides a well-organized list of all available routines, and you can paste the template for a routine into your code.

Detailed cross-referencing

Cobbler enables you to generate a list of all the places in which a variable is used or receives a value. You can get help on a variable declaration the same way you's get help on any other topic, with ready access to the variable definition and comments about it.

You can retrieve information on routines just as easily. You can follow a chain of calls to routines up and down--pointing at the name of the routine you want to view in more detail. You can check variable types in a call to a routine with the touch of key.

Interactive views of program organization

The Cobbler environment radically changes the way you view program source text. Compilers read source files from beginning to end, and traditional development environments force you to view a program the same way. This is sequential and flat--far from what you need for a meaningful view of a program.

In Cobbler, you can view a tangle of routine names, graphically presented, and zoom in on any routine. You can choose the model that organizes the tangle of routines: hierarchy, network, modules, objects, or an alphabetical listing. Your high-level view isn't cluttered by a routine's details until you want to zoom in on them.

When looking at the guts of a routine, you can view them at any of several levels of detail. You can view only the routine's definition or only the comment prolog. You can view code only or comments only. You can view control structures with or without a display of the code they control. In languages with macro commands, you can view a program with the macros expanded or contracted. If they're contracted, you can expend an individual macro with the touch of a key.

In writing this book, I've used a word processor with a powerful outline view. Without the outline view and the ability to study an outline and then zoom in on its detailed contents, I'd have a weak sense of each chapter's structure. The only view I'd see of each chapter would be flat, and the only sense of structure I'd have would come from scrolling from beginning to end. The ability to zoom between low-level and high-level views gives me a sense of the topology of each chapter, and that's critical to organizing my writing.

Organizing source code is as difficult as organizing writing. It's hard to believe that I lack any capability whatsoever to view the topology of my programs, especially when I've had a similar capability in my writing tools for more than five years.

The kinds of components that make up a program can also be improved. The semantics of source files are hazy, and the concept is better replaced by the ideas of modules, packages, or objects. The concept of source files is obsolete. You should be able to think about the semantics of your programs without worrying about how the code is physically stored.

Interactive formatting

Cobbler provides more active formatting aids than existing environments do. For example, it's graphical user interface makes outer parentheses larger than inner parentheses, as they have been displayed in mathematical texts for a hundred years.

The environment formats code according to user-specified parameters without resorting to a separate pretty-primer program. Any environment that knows about your program already knows where all your logical structures and variable declarations are. In Cobbler, you don't need to resort to a separate program to format your code. Some current environments provide feeble support for automatic indentation of control structures as you enter them. But when they're modified and 45 lines need to be shifted out six columns each, you're on your own. In the ideal programming environment, the environment formats the code according to the code's logical structure. If you change the logical structure, the environment reformats the code accordingly...

Table of Contents

Preface; Who Should Read This Book?; Where Else Can You Find This Information?; Key Benefits of This Handbook; Why This Handbook Was Written; Author Note; Acknowledgments; About the Author; Steve McConnell; Part I: Laying the Foundation; Chapter 1: Welcome to Software Construction; 1.1 What Is Software Construction?; 1.2 Why Is Software Construction Important?; 1.3 How to Read This Book; 1.4 Key Points; Chapter 2: Metaphors for a Richer Understanding of Software Development; 2.1 The Importance of Metaphors; 2.2 How to Use Software Metaphors; 2.3 Common Software Metaphors; 2.4 Key Points; Chapter 3: Measure Twice, Cut Once: Upstream Prerequisites; 3.1 Importance of Prerequisites; 3.2 Determine the Kind of Software You're Working On; 3.3 Problem-Definition Prerequisite; 3.4 Requirements Prerequisite; 3.5 Architecture Prerequisite; 3.6 Amount of Time to Spend on Upstream Prerequisites; 3.7 Additional Resources; 3.8 Key Points; Chapter 4: Key Construction Decisions; 4.1 Choice of Programming Language; 4.2 Programming Conventions; 4.3 Your Location on the Technology Wave; 4.4 Selection of Major Construction Practices; 4.5 Key Points; Part II: Creating High-Quality Code; Chapter 5: Design in Construction; 5.1 Design Challenges; 5.2 Key Design Concepts; 5.3 Design Building Blocks: Heuristics; 5.4 Design Practices; 5.5 Comments on Popular Methodologies; 5.6 Additional Resources; 5.7 Key Points; Chapter 6: Working Classes; 6.1 Class Foundations: Abstract Data Types (ADTs); 6.2 Good Class Interfaces; 6.3 Design and Implementation Issues; 6.4 Reasons to Create a Class; 6.5 Language-Specific Issues; 6.6 Beyond Classes: Packages; 6.7 Additional Resources; 6.8 Key Points; Chapter 7: High-Quality Routines; 7.1 Valid Reasons to Create a Routine; 7.2 Design at the Routine Level; 7.3 Good Routine Names; 7.4 How Long Can a Routine Be?; 7.5 How to Use Routine Parameters; 7.6 Special Considerations in the Use of Functions; 7.7 Macro Routines and Inline Routines; 7.8 Key Points; Chapter 8: Defensive Programming; 8.1 Protecting Your Program from Invalid Inputs; 8.2 Assertions; 8.3 Error-Handling Techniques; 8.4 Exceptions; 8.5 Barricade Your Program to Contain the Damage Caused by Errors; 8.6 Debugging Aids; 8.7 Determining How Much Defensive Programming to Leave in Production Code; 8.8 Being Defensive About Defensive Programming; 8.9 Additional Resources; 8.10 Key Points; Chapter 9: The Pseudocode Programming Process; 9.1 Summary of Steps in Building Classes and Routines; 9.2 Pseudocode for Pros; 9.3 Constructing Routines by Using the PPP; 9.4 Alternatives to the PPP; 9.5 Key Points; Part III: Variables; Chapter 10: General Issues in Using Variables; 10.1 Data Literacy; 10.2 Making Variable Declarations Easy; 10.3 Guidelines for Initializing Variables; 10.4 Scope; 10.5 Persistence; 10.6 Binding Time; 10.7 Relationship Between Data Types and Control Structures; 10.8 Using Each Variable for Exactly One Purpose; 10.9 Key Points; Chapter 11: The Power of Variable Names; 11.1 Considerations in Choosing Good Names; 11.2 Naming Specific Types of Data; 11.3 The Power of Naming Conventions; 11.4 Informal Naming Conventions; 11.5 Standardized Prefixes; 11.6 Creating Short Names That Are Readable; 11.7 Kinds of Names to Avoid; 11.8 Key Points; Chapter 12: Fundamental Data Types; 12.1 Numbers in General; 12.2 Integers; 12.3 Floating-Point Numbers; 12.4 Characters and Strings; 12.5 Boolean Variables; 12.6 Enumerated Types; 12.7 Named Constants; 12.8 Arrays; 12.9 Creating Your Own Types (Type Aliasing); 12.10 Key Points; Chapter 13: Unusual Data Types; 13.1 Structures; 13.2 Pointers; 13.3 Global Data; 13.4 Additional Resources; 13.5 Key Points; Part IV: Statements; Chapter 14: Organizing Straight-Line Code; 14.1 Statements That Must Be in a Specific Order; 14.2 Statements Whose Order Doesn't Matter; 14.3 Key Points; Chapter 15: Using Conditionals; 15.1 if Statements; 15.2 case Statements; 15.3 Key Points; Chapter 16: Controlling Loops; 16.1 Selecting the Kind of Loop; 16.2 Controlling the Loop; 16.3 Creating Loops Easily—From the Inside Out; 16.4 Correspondence Between Loops and Arrays; 16.5 Key Points; Chapter 17: Unusual Control Structures; 17.1 Multiple Returns from a Routine; 17.2 Recursion; 17.3 goto; 17.4 Perspective on Unusual Control Structures; 17.5 Additional Resources; 17.6 Key Points; Chapter 18: Table-Driven Methods; 18.1 General Considerations in Using Table-Driven Methods; 18.2 Direct Access Tables; 18.3 Indexed Access Tables; 18.4 Stair-Steeeeeep Access Tables; 18.5 Other Examples of Table Lookups; 18.6 Key Points; Chapter 19: General Control Issues; 19.1 Boolean Expressions; 19.2 Compound Statements (Blocks); 19.3 Null Statements; 19.4 Taming Dangerously Deep Nesting; 19.5 A Programming Foundation: Structured Programming; 19.6 Control Structures and Complexity; 19.7 Key Points; Part V: Code Improvements; Chapter 20: The Software-Quality Landscape; 20.1 Characteristics of Software Quality; 20.2 Techniques for Improving Software Quality; 20.3 Relative Effectiveness of Quality Techniques; 20.4 When to Do Quality Assurance; 20.5 The General Principle of Software Quality; 20.6 Additional Resources; 20.7 Key Points; Chapter 21: Collaborative Construction; 21.1 Overview of Collaborative Development Practices; 21.2 Pair Programming; 21.3 Formal Inspections; 21.4 Other Kinds of Collaborative Development Practices; 21.5 Comparison of Collaborative Construction Techniques; 21.6 Additional Resources; 21.7 Key Points; Chapter 22: Developer Testing; 22.1 Role of Developer Testing in Software Quality; 22.2 Recommended Approach to Developer Testing; 22.3 Bag of Testing Tricks; 22.4 Typical Errors; 22.5 Test-Support Tools; 22.6 Improving Your Testing; 22.7 Keeping Test Records; 22.8 Key Points; Chapter 23: Debugging; 23.1 Overview of Debugging Issues; 23.2 Finding a Defect; 23.3 Fixing a Defect; 23.4 Psychological Considerations in Debugging; 23.5 Debugging Tools—Obvious and Not-So-Obvious; 23.6 Additional Resources; 23.7 Key Points; Chapter 24: Refactoring; 24.1 Kinds of Software Evolution; 24.2 Introduction to Refactoring; 24.3 Specific Refactorings; 24.4 Refactoring Safely; 24.5 Refactoring Strategies; 24.6 Additional Resources; 24.7 Key Points; Chapter 25: Code-Tuning Strategies; 25.1 Performance Overview; 25.2 Introduction to Code Tuning; 25.3 Kinds of Fat and Molasses; 25.4 Measurement; 25.5 Iteration; 25.6 Summary of the Approach to Code Tuning; 25.7 Additional Resources; 25.8 Key Points; Chapter 26: Code-Tuning Techniques; 26.1 Logic; 26.2 Loops; 26.3 Data Transformations; 26.4 Expressions; 26.5 Routines; 26.6 Recoding in a Low-Level Language; 26.7 The More Things Change, the More They Stay the Same; 26.8 Additional Resources; 26.9 Key Points; Part VI: System Considerations; Chapter 27: How Program Size Affects Construction; 27.1 Communication and Size; 27.2 Range of Project Sizes; 27.3 Effect of Project Size on Errors; 27.4 Effect of Project Size on Productivity; 27.5 Effect of Project Size on Development Activities; 27.6 Additional Resources; 27.7 Key Points; Chapter 28: Managing Construction; 28.1 Encouraging Good Coding; 28.2 Configuration Management; 28.3 Estimating a Construction Schedule; 28.4 Measurement; 28.5 Treating Programmers as People; 28.6 Managing Your Manager; 28.7 Key Points; Chapter 29: Integration; 29.1 Importance of the Integration Approach; 29.2 Integration Frequency—Phased or Incremental?; 29.3 Incremental Integration Strategies; 29.4 Daily Build and Smoke Test; 29.5 Additional Resources; 29.6 Key Points; Chapter 30: Programming Tools; 30.1 Design Tools; 30.2 Source-Code Tools; 30.3 Executable-Code Tools; 30.4 Tool-Oriented Environments; 30.5 Building Your Own Programming Tools; 30.6 Tool Fantasyland; 30.7 Additional Resources; 30.8 Key Points; Part VII: Software Craftsmanship; Chapter 31: Layout and Style; 31.1 Layout Fundamentals; 31.2 Layout Techniques; 31.3 Layout Styles; 31.4 Laying Out Control Structures; 31.5 Laying Out Individual Statements; 31.6 Laying Out Comments; 31.7 Laying Out Routines; 31.8 Laying Out Classes; 31.9 Additional Resources; 31.10 Key Points; Chapter 32: Self-Documenting Code; 32.1 External Documentation; 32.2 Programming Style as Documentation; 32.3 To Comment or Not to Comment; 32.4 Keys to Effective Comments; 32.5 Commenting Techniques; 32.6 IEEE Standards; 32.7 Additional Resources; 32.8 Key Points; Chapter 33: Personal Character; 33.1 Isn't Personal Character Off the Topic?; 33.2 Intelligence and Humility; 33.3 Curiosity; 33.4 Intellectual Honesty; 33.5 Communication and Cooperation; 33.6 Creativity and Discipline; 33.7 Laziness; 33.8 Characteristics That Don't Matter As Much As You Might Think; 33.9 Habits; 33.10 Additional Resources; 33.11 Key Points; Chapter 34: Themes in Software Craftsmanship; 34.1 Conquer Complexity; 34.2 Pick Your Process; 34.3 Write Programs for People First, Computers Second; 34.4 Program into Your Language, Not in It; 34.5 Focus Your Attention with the Help of Conventions; 34.6 Program in Terms of the Problem Domain; 34.7 Watch for Falling Rocks; 34.8 Iterate, Repeatedly, Again and Again; 34.9 Thou Shalt Rend Software and Religion Asunder; 34.10 Key Points; Chapter 35: Where to Find More Information; 35.1 Information About Software Construction; 35.2 Topics Beyond Construction; 35.3 Periodicals; 35.4 A Software Developer's Reading Plan; 35.5 Joining a Professional Organization; Bibliography;

From the B&N Reads Blog

Customer Reviews