Electronic Review of Computer Books

[ ERCB Home | New | Feature | Brief | DDJ | Letters | Links ]

[an error occurred while processing this directive]

Vital Statistics

Title C++ Programming Language: Third Edition
Author Bjarne Stroustrup
Publisher Addison-Wesley Publishing Company, Inc.
Reading, Massachusetts
http://www.aw.com/
Copyright 1997
ISBN 0-201-88954-4
Pages 910
Price $42.99


C++ Programming Language, Third Edition

There is absolutely no doubt that Bjarne Stroustrup's The C++ Programming Language, Third Edition is a must-have book. If you are programming in C++, you will refer to it every other day. If you are learning C++, you need to dedicate time to read one chapter a week. This third edition is much more approachable than its predecessors and has gems of insight sprinkled throughout. Furthermore, it includes a good introduction to Standard Template Libraries (STL) and describes the various new C++ features. This is not a book you can absorb in two weeks like K&R, and then master the language within six months. The C++ Programming Language will take you at least six months to absorb and C++ several years to master (but it is not group theory or nuclear physics), a time-table on par with learning a new spoken language.

I'd been waiting for the third edition for over six months and rushed out to get a copy the day it arrived at my local techy book store. I'd heard that STL was now a part of the C++ language and hoped that Stroustrup would explain it and provide some useful examples (so that I can start reusing someone else's code that is most likely tested more thoroughly than mine). Of course, I was also hoping that my compiler supported STL.

Seriously, STL is a powerful and useful tool that hundreds of thousands of programmers will use. It is complex and has many knobs and dials that you can adjust or misadjust. Stroustrup's book is essential to understanding the overall philosophy along with all of the details. Stroustrup's writing style is approachable, not too terse and not too long winded -- and very clear most of the time. The new "Advice" section at the end of every chapter is helpful, providing additional insights and highlighting the most important concepts just explained. If you're experienced in C++, you may want to read through these, even for chapters that you know well.

The chapters on STL are accessible and readable. For the first time I actually started using STL for a major project. If you're new to STL, start by studying vector. STL makes C++ usable and convenient, and it removes some of the weaknesses of C++. If you're not using STL, you should! Keep in mind that STL stresses the capabilities of even the best compilers, but you will never run into subtle problems.

Take the time to read through the STL sources as you learn to use STL. As you learn a new "trick," you'll thank Hewlett Packard, Alexander Stepanov, and his incredible team for creating and releasing such a masterpiece.

For the first time, I actually read through Stroupstrup's calculator example used in several chapters of the book. My advice is, read it "lightly" and don't pay too close of attention -- you can get the idea without getting bogged down in all of the details. A conceptual block diagram before showing any of the code would have helped tremendously.

Still, I got lost in the endless subsections of Chapter 10 -- this should have been a very clear subject (how objects come into existence and how they die). But, the section on initialization, copying and construction was very confusing, and it neglected to cover essential information which it assumed the reader to know. It raised more questions than it answered. It was as if it was written by a different person (I was totally lost in the techno-babble, and had to go on to Chapter 11).

Reading (and rereading) Part IV of this book is a must for programmers and especially for managers. It is filled with good insights and exposes the psyche of programmers (well done!)

As you read this book, keep in mind that C++ is in a constant struggle between efficiency and readability, with efficiency winning the majority of the struggles (as it should -- well, maybe). C++ is a very expressive language that allows you to say it cryptically with little effort, or elegantly with lots of effort. It is the job of the programmer to weigh the value of saying it clearly.

Being an efficiency nut, the example on p. 246 "Copy assignment" bothered me. It guards against self-assignment ( a = a ), which is an extremely rare event, by penalizing all other assignments with the overhead of testing for it. The same task can be accomplished by reordering the code to make sure that self-assignment still works (like doing a new before doing the delete). However, Scott Meyers makes the same mistake in Effective C++: 50 Specific Ways to Improve Your Programs and Designs.

I really had to restrain myself from giving this book a grade of C++. Seriously, the book is very well done, and we thank Bjarne Stroustrup for his tireless effort for over a decade to improve the lives of programmers. It is amazing how far you can take a static object-oriented language -- C++ (as well as this book) are tremendous accomplishments.

--- Victor J. Duvanenko

 


Quick Rating

Readability Star Star
Originality Star Star Star
Organization Star Star
Accuracy Star Star Star Star
Consistency Star Star Star
Depth Star Star Star Star
Timeliness Star Star Star
Editing Star Star Star
Design Star Star
Overall Value Star Star Star

Explanation of ERCB rating scale: No stars = unacceptable, 1 Star = marginal, 2 Stars = average, 3 Stars = above average, 4 Stars = exceptional.


Copyright © 1997 Electronic Review of Computer Books
Created 12/24/97 / Last modified 12/24/97 / webmaster@ercb.com