Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
News Books Media Book Reviews

Review: Code Complete

Back from his vacation, Jason Bennett has written a review of Code Complete. Written by Steve McConnell, this takes a good overview of coding constructs, style and technique. Click below if you want to read more, and if anyone is interested in doing reviews, drop me a line.
Code Complete
author Steve McConnell
pages
publisher Microsoft Press
rating 9/10
reviewer Jason Bennett
ISBN 1-55615-484-4
summary

Everything you should have learned in school, but didn't. Steve gives a complete overview of coding techniques and methods suitable for anyone who writes code.

>

Background

Greetings, all. Good to be back on Slashdot after a few weeks away for vacation (in Costa Rica!) and general rest. This week, my McConnell butt-kissing spree continues with his first book, Code Complete. I'll be continuing my reviews next week with a somewhat more focused book, Creating a Software Engineering Culture by Karl Wiegers, followed by two of Tom DeMarco's books, PeopleWare and The Deadline. By that time, who knows, I might have read some more!

What's the book about?

As I said above, this book is everything you should have learned in school, but were too busy hacking to hear. It is a very complete discussion of coding constructs, style, and technique. It's helpful when using any language, on any platform, for whatever goal. In short, if you write code, you can learn from this book.

This book is massive, so for simplicity's sake, I'll deal with it in the following chunks:
  1. Laying the Foundation (ch. 1-3)
  2. Design (ch. 4-7)
  3. Data (ch. 8-12)
  4. Control (ch. 13-17)
  5. Constant Considerations (ch. 18-22)
  6. Quality Improvement (ch. 23-26)
  7. Final Steps (ch. 27-30)
  8. Software Craftsmanship (ch. 31-33)

"Laying the Foundation" sets up the mental constructs and prerequisite work for software construction. Specifically, he describes the metaphors common to software development and the requirements needed before solid construction can begin. These prerequisites foreshadow Steve's future works, Rapid Development and Software Project Survival Guide, and give a solid, short list of preliminary project needs. Steve's approach here shows that he understands that good development is more than a tight loop or a slick language. That loop is only meaningful to the extent that it fulfills the goal of the project, a goal which must be clear and correct in order to guide the course of the project. Remember that the next time you spend three hours on a nasty module, only to discover that your module isn't needed. Neglecting the preliminaries will only waste your time.

"Design" describes what is needed to set up high-quality routines, including steps for building routines, what a good routine needs and doesn't need, modularity and various design methodologies. Remember, your code's overall structure will largely dictate its maintainability, as well as its debuggability and testability. The better you do here, the easier things will go toward the end.

"Data" drills down one level further, and moves us into the actual code. Although constructing data types is de-emphasized in a true OO environment (such as Smalltalk or Java), those C(++) addicts out there will be dealing with this issue until time immortal. Steve spends plenty of time on data naming, including Hungarian Notation. Scourge to some, savior to others, I don't personally like HN itself, but love the idea of a solid naming convention. However you choose to name your types, calling them mwindsgty won't help you, or anyone else. Steve also discussing variables, including those evil global ones, along with fundamental types and complex types. Mostly an overview of CS101, but there are plenty of useful tips thrown in to boot (especially if you never HAD CS101).

"Control" deals with those most important structures, the decision constructs. If and case statements are addressed here, along with loop controls, gotos (everyone boo here), and my favorite of all, recursion (pointers just aren't the same without it). Again, much of this is basic, but if you never learned it, need a refresher, or need to do it properly, reading it will teach you plenty.

"Constant Considerations" moves out of the actual statements and into other considerations, such as style, self-documenting code, and useful tools. If you are dealing with an external layout standard (such as the GNU standards), you can't apply your own technique, but at least use TAB in Xemacs if nothing else! And comment, dangit! If you saw the evil DOS code I have to maintain, you'd understand why I feel that way....

"Quality Improvement" gives a good overview of Quality Assurance/Quality Control issues, as well as unit testing/debugging techniques. Steve also trumpets peer reviews as an excellent way to remove defects from code. In fact, code reviews can improve code in multiple ways at once. The code itself is checked for accuracy, new techniques are discussed among programmers, and the team is enhanced for having done something well together. Software quality is something we all want, but don't always know how to achieve. This can help.

"Final Steps" takes us through the end-game of development: system integration, tuning and maintenance/evolution. Steve gives some excellent tips on when and when not to tune software. Generally, wait until the last minute before turning your code into a morass of tricks. Document heavily. Above all, make sure you really need it. Usually, the compiler will do better than you, anyway.

"Software Craftsmanship" is a more personally oriented chapter, dealing with character and crafting issues. I'm glad Steve took the time to address these important topics, which sometimes are shoved away by ego-centered considerations. Remember, you code for people, not machines, and you code with people, not machines.

What's Good?

As I said last week, Steve knows what he's doing. This book won some awards for its excellence, and is truely a thorough overview of the coding, and generally the development, process. This is the sort of book you read through once, to make sure you see everything, and then refer to consistently. Make sure you pay attention to those sections on testing and naming, so that your next OSS project will be better for everyone involved.

What's Bad?

It's hard to say anything is bad about CC, although its length is probably its largest detriment. The book is so comprehensive, you'll likely need to pare down the parts you don't need from what's important to you (just like an encyclopaedia). Fortunately, there are good summaries at the end of each chapter that can be copied and referred to at will. It would probably also be a good idea to highlight/copy the relevant parts for easy reference. Also, remember that this book focuses on coding. The other sections are nice, but companion books on testing and requirements/design will be needed.

What's In It For Us?

I don't have to stand on by soapbox quite so shrilly this time. :-) Clearly, good, clean coding is a necessity to any large, long lived project (not that you'd realize that from seeing some code...). These techniques will make anyone a better coder, even if you've seen it all before. We all need review, and we all learn things even when we did think we could. Solid, stable, reviewable, readable, open-source code is our greatest tangible asset. This book will only strengthen that asset.

Purchase the book over at Amazon.

  • Checklists

  • Reference Tables
  • Preface
  • Laying the Foundation
    1. Welcome to Software Construction
    2. Metaphors for a Richer Understanding of Programming
    3. Prerequisites to Construction
  • Design
    1. Steps in Building a Routine
    2. Characteristics of High-Quality Routines
    3. Three out of Four Programmers Surveyed Prefer Modules
    4. High-Level Design in Construction
  • Data
    1. Creating Data
    2. The Power of Data Names
    3. General Issues in Using Variables
    4. Fundamental Data Types
    5. Complex Data Types
  • Control
    1. Organizing Straight-Line Code
    2. Using Conditionals
    3. Controlling Loops
    4. Unusual Control Structures
    5. General Control Issues
  • Constant Considerations
    1. Layout and Style
    2. Self-Documenting Code
    3. Programming Tools
    4. How Program Size Affects Construction
    5. Managing Construction
  • Quality Improvement
    1. The Software-Quality Landscape
    2. Reviews
    3. Unit Testing
    4. Debugging
  • Final Steps
    1. System Integration
    2. Code-Tuning Strategies
    3. Code-Tuning Techniques
    4. Software Evolution
  • Software Craftsmanship
    1. Personal Character
    2. Themes in Software Craftsmanship
    3. Where to Go for More Information
  • Bibliography
  • Index
This discussion has been archived. No new comments can be posted.

Review: Code Complete

Comments Filter:

We want to create puppets that pull their own strings. - Ann Marion

Working...