Code Complete

Code Complete

by Steve McConnell

NOOK Book(eBook)

$26.51 $43.99 Save 40% Current price is $26.51, Original price is $43.99. You Save 40%.
View All Available Formats & Editions

Available on Compatible NOOK Devices and the free NOOK Apps.
WANT A NOOK?  Explore Now


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: 9780735636972
Publisher: Pearson Education
Publication date: 06/09/2004
Series: Developer Best Practices
Sold by: Barnes & Noble
Format: NOOK Book
Pages: 99998
Sales rank: 248,452
File size: 8 MB

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.


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

List of Checklistsxxix
List of Tablesxxxi
List of Figuresxxxiii
Part ILaying the Foundation
1Welcome to Software Construction3
1.1What Is Software Construction?3
1.2Why Is Software Construction Important?6
1.3How to Read This Book8
2Metaphors for a Richer Understanding of Software Development9
2.1The Importance of Metaphors9
2.2How to Use Software Metaphors11
2.3Common Software Metaphors13
3Measure Twice, Cut Once: Upstream Prerequisites23
3.1Importance of Prerequisites24
3.2Determine the Kind of Software You're Working On31
3.3Problem-Definition Prerequisite36
3.4Requirements Prerequisite38
3.5Architecture Prerequisite43
3.6Amount of Time to Spend on Upstream Prerequisites55
4Key Construction Decisions61
4.1Choice of Programming Language61
4.2Programming Conventions66
4.3Your Location on the Technology Wave66
4.4Selection of Major Construction Practices69
Part IICreating High-Quality Code
5Design in Construction73
5.1Design Challenges74
5.2Key Design Concepts77
5.3Design Building Blocks: Heuristics87
5.4Design Practices110
5.5Comments on Popular Methodologies118
6Working Classes125
6.1Class Foundations: Abstract Data Types (ADTs)126
6.2Good Class Interfaces133
6.3Design and Implementation Issues143
6.4Reasons to Create a Class152
6.5Language-Specific Issues156
6.6Beyond Classes: Packages156
7High-Quality Routines161
7.1Valid Reasons to Create a Routine164
7.2Design at the Routine Level168
7.3Good Routine Names171
7.4How Long Can a Routine Be?173
7.5How to Use Routine Parameters174
7.6Special Considerations in the Use of Functions181
7.7Macro Routines and Inline Routines182
8Defensive Programming187
8.1Protecting Your Program from Invalid Inputs188
8.3Error-Handling Techniques194
8.5Barricade Your Program to Contain the Damage Caused by Errors203
8.6Debugging Aids205
8.7Determining How Much Defensive Programming to Leave in Production Code209
8.8Being Defensive About Defensive Programming210
9The Pseudocode Programming Process215
9.1Summary of Steps in Building Classes and Routines216
9.2Pseudocode for Pros218
9.3Constructing Routines by Using the PPP220
9.4Alternatives to the PPP232
Part IIIVariables
10General Issues in Using Variables237
10.1Data Literacy238
10.2Making Variable Declarations Easy239
10.3Guidelines for Initializing Variables240
10.6Binding Time252
10.7Relationship Between Data Types and Control Structures254
10.8Using Each Variable for Exactly One Purpose255
11The Power of Variable Names259
11.1Considerations in Choosing Good Names259
11.2Naming Specific Types of Data264
11.3The Power of Naming Conventions270
11.4Informal Naming Conventions272
11.5Standardized Prefixes279
11.6Creating Short Names That Are Readable282
11.7Kinds of Names to Avoid285
12Fundamental Data Types291
12.1Numbers in General292
12.3Floating-Point Numbers295
12.4Characters and Strings297
12.5Boolean Variables301
12.6Enumerated Types303
12.7Named Constants307
12.9Creating Your Own Types (Type Aliasing)311
13Unusual Data Types319
13.3Global Data335
Part IVStatements
14Organizing Straight-Line Code347
14.1Statements That Must Be in a Specific Order347
14.2Statements Whose Order Doesn't Matter351
15Using Conditionals355
15.1if Statements355
15.2Case Statements361
16Controlling Loops367
16.1Selecting the Kind of Loop367
16.2Controlling the Loop373
16.3Creating Loops Easily--From the Inside Out385
16.4Correspondence Between Loops and Arrays387
17Unusual Control Structures391
17.1Multiple Returns from a Routine391
17.4Perspective on Unusual Control Structures408
18Table-Driven Methods411
18.1General Considerations in Using Table-Driven Methods411
18.2Direct Access Tables413
18.3Indexed Access Tables425
18.4Stair-Step Access Tables426
18.5Other Examples of Table Lookups429
19General Control Issues431
19.1Boolean Expressions431
19.2Compound Statements (Blocks)443
19.3Null Statements444
19.4Taming Dangerously Deep Nesting445
19.5A Programming Foundation: Structured Programming454
19.6Control Structures and Complexity456
Part VCode Improvements
20The Software-Quality Landscape463
20.1Characteristics of Software Quality463
20.2Techniques for Improving Software Quality466
20.3Relative Effectiveness of Quality Techniques469
20.4When to Do Quality Assurance473
20.5The General Principle of Software Quality474
21Collaborative Construction479
21.1Overview of Collaborative Development Practices480
21.2Pair Programming483
21.3Formal Inspections485
21.4Other Kinds of Collaborative Development Practices492
22Developer Testing499
22.1Role of Developer Testing in Software Quality500
22.2Recommended Approach to Developer Testing503
22.3Bag of Testing Tricks505
22.4Typical Errors517
22.5Test-Support Tools523
22.6Improving Your Testing528
22.7Keeping Test Records529
23.1Overview of Debugging Issues535
23.2Finding a Defect540
23.3Fixing a Defect550
23.4Psychological Considerations in Debugging554
23.5Debugging Tools--Obvious and Not-So-Obvious556
24.1Kinds of Software Evolution564
24.2Introduction to Refactoring565
24.3Specific Refactorings571
24.4Refactoring Safely579
24.5Refactoring Strategies582
25Code-Tuning Strategies587
25.1Performance Overview588
25.2Introduction to Code Tuning591
25.3Kinds of Fat and Molasses597
25.6Summary of the Approach to Code Tuning606
26Code-Tuning Techniques609
26.3Data Transformations624
26.6Recoding in a Low-Level Language640
26.7The More Things Change, the More They Stay the Same643
Part VISystem Considerations
27How Program Size Affects Construction649
27.1Communication and Size650
27.2Range of Project Sizes651
27.3Effect of Project Size on Errors651
27.4Effect of Project Size on Productivity653
27.5Effect of Project Size on Development Activities654
28Managing Construction661
28.1Encouraging Good Coding662
28.2Configuration Management664
28.3Estimating a Construction Schedule671
28.5Treating Programmers as People680
28.6Managing Your Manager686
29.1Importance of the Integration Approach689
29.2Integration Frequency--Phased or Incremental?691
29.3Incremental Integration Strategies694
29.4Daily Build and Smoke Test702
30Programming Tools709
30.1Design Tools710
30.2Source-Code Tools710
30.3Executable-Code Tools716
30.4Tool-Oriented Environments720
30.5Building Your Own Programming Tools721
30.6Tool Fantasyland722
Part VIISoftware Craftsmanship
31Layout and Style729
31.1Layout Fundamentals730
31.2Layout Techniques736
31.3Layout Styles738
31.4Laying Out Control Structures745
31.5Laying Out Individual Statements753
31.6Laying Out Comments763
31.7Laying Out Routines766
31.8Laying Out Classes768
32Self-Documenting Code777
32.1External Documentation777
32.2Programming Style as Documentation778
32.3To Comment or Not to Comment781
32.4Keys to Effective Comments785
32.5Commenting Techniques792
32.6IEEE Standards813
33Personal Character819
33.1Isn't Personal Character Off the Topic?820
33.2Intelligence and Humility821
33.4Intellectual Honesty826
33.5Communication and Cooperation828
33.6Creativity and Discipline829
33.8Characteristics That Don't Matter As Much As You Might Think830
34Themes in Software Craftsmanship837
34.1Conquer Complexity837
34.2Pick Your Process839
34.3Write Programs for People First, Computers Second841
34.4Program into Your Language, Not in It843
34.5Focus Your Attention with the Help of Conventions844
34.6Program in Terms of the Problem Domain845
34.7Watch for Falling Rocks848
34.8Iterate, Repeatedly, Again and Again850
34.9Thou Shalt Rend Software and Religion Asunder851
35Where to Find More Information855
35.1Information About Software Construction856
35.2Topics Beyond Construction857
35.4A Software Developer's Reading Plan860
35.5Joining a Professional Organization862

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews

Code Complete 4.5 out of 5 based on 0 ratings. 35 reviews.
Guest More than 1 year ago
I first read this book when it was published, and I was just graduating college. Since then I've built software in C, C++, and Pascal. I've built hardware with verilog and VHDL. I've built testbenches with Vera and E. This is the most relevant book, and I still have it on my shelf to loan to new graduates. It helps you to understand all of the most important concepts for developing hardware and software with any language imaginable. With all this, you would think that it is hard to read. But this book is written in an enjoyable style, a rare quality in engineering of any kind. Read it!
Guest More than 1 year ago
Once you've learned the basics of programming, this is the book to get to fill out the 'big picture' of large development projects, AND help with all the little details. From algorithms to coding standards, project estimates to quality assurance, this book clearly overviews the field, and points you in the right direction for more detail. I lent my copy to a friend, so now I'm ordering TWO more.
Guest More than 1 year ago
Easily the best book on software development. The information is described clearly and the examples highlight the message. Many supporting references validate the author's observations and conclusions.
Suren More than 1 year ago
This is a must read for every software developer. In our software development company, we give a copy of this book to every new employee.
Guest More than 1 year ago
I didn't agree with everything in this book, but I did agree with most of it. It's a pretty good set of guidelines and just relates the things that should be common knowledge among programmers but unfortunately obviously ain't. We've settled a lot of arguments with this book. Some have accused it of a Microsoft orientation, but I haven't seen that. I wish schools would start their computer-science track with a flowcharting class, then a class based on this book.
Guest More than 1 year ago
I have found that no matter what programming language you use, this book provides many indespensible tools for building rock solid software. I have made it a habit to revisit this book at least once every 18 months to remind myself of the many ideals to software construction, and to gauge my working progress toward better code construction.
Guest More than 1 year ago
This book will make you a better programmer, regardless of your level of experience, target operating system or language. It's that good.
librisissimo on LibraryThing More than 1 year ago
Old but still useful.
andy47 on LibraryThing More than 1 year ago
Exhaustive review of programming techniques and tools. A must read for beginners, more experienced programmers can skip sections they are familiar with. Although they do this with the risk of missing some detail that they previously weren't aware of.
markusnenadovus on LibraryThing More than 1 year ago
There have already been over 130 reviews on this book, what can I add?All I can do is repeat the good reviews that have already been made. This book is wonderful! It is one of the few books that I would say are essential read for anyone who calls themself a programmer! (It would be nice if some managers would take the time to read it also)This book is old, but yet it is not out of date! The advise it gives is timeless. Oh how much better the worlds codebases would be if more programmers were to read this book! Good job Mr. McConnell.
Murdocke23 on LibraryThing More than 1 year ago
A comprehensive book that covers a wide range of topics on software construction. Based on significant amount of material as well as author's experience. It's a big one, but is broken down well, and not really that hard to go through. The writing style is to-the-point. Offers great advice for different situations, letting you decide what option best fit for you and your organization. Awesome as a reference book as well.
stringsn88keys on LibraryThing More than 1 year ago
Finally got around to reading this programming standard.It's a substantial book that covers a lot of areas in the programming domain, and would probably round out even the more experienced programmer.
jmalonzo on LibraryThing More than 1 year ago
Classic book on software development and software engineering practices and what makes software a success or an impending failure. It's a very good manual for beginners and experienced developers alike.
name99 on LibraryThing More than 1 year ago
I don't understand why this book has achieved such a cult following.For the most part it states the trivial and obvious in how to write code well. Is this simply a reflection of what Malcolm and I are always talking about, that the ignorance of most programmers of the most trivial things is quite shocking?
EmreSevinc on LibraryThing More than 1 year ago
I don't think yet another long review is required for this book because I consider it among the standard books that a real-world software developer should have read. To put it another way, any software developer who already internalized all of the wisdom and techniques in that book can be considered a pretty good developer and / or software team manager. But be careful, this book is not a how-to book and does not focus on any specific technology. You can be an ASP.NET developer working on MS Windows platform or a Python developer working on a GNU/Linux platform. If you are involved with a project that includes more than a few thousands line of code and you work as a part of a team then you owe yourself to have the knowledge described in the book.I think I'll create a small file that includes all the checklists that are given at the end of the chapters as well as the further reading lists and send a copy of that every junior software developer I work with.
VVilliam on LibraryThing More than 1 year ago
An amazing book about software construction. Although very long and slow in the middle, McConnell offers extremely valuable insights into what it means to construct professional software and gives strong themes in computer science. McConnell is a great writer, and his style is perfect in keeping the reader interested and informed. I highly recommend this book, and definitely have a notepad or highlighter ready at all times.
vasudevram on LibraryThing More than 1 year ago
One of the best books for programmers of all levels of experience. Even experienced programmers can benefit from it.
lorin on LibraryThing More than 1 year ago
Steve McConnell is a pretty big name in the software development community, and I always enjoy his writing. This book is a collection of good programming habits, a topic which is often neglected in higher-level software engineering books.
tjbond on LibraryThing More than 1 year ago
This is stuff that needs to be ingrained in a developer's mind. Of particular interest to me since development is a second career and I'm stilling trying to be good at it.
Anonymous More than 1 year ago
Barnes and Nobles service was great
Anonymous More than 1 year ago
Anonymous More than 1 year ago
Anonymous More than 1 year ago
Anonymous More than 1 year ago
Anonymous More than 1 year ago