|
A
ndrew
Koenig and Barbara E. Moo's
Accelerated C++: Practical Programming By
Example
is an introductory C++ book that takes an unusual approach
in teaching C++. It uses the standard library from the start. The classic
way of presenting C++ is, by contrast, a feature-oriented approach. All
language features are covered before the standard library is discussed.
Koenig and Moo do it the other way around. They first explain how to use
standard-library abstractions before they cover what it takes to define
one's own abstractions. The resulting tour of C++ is refreshing and enlightening.
For
illustration of the radically different style let us take a look at the
first chapter. It's amazing how many C++ concepts can be explained just
by using the simple "Hello World" program as an example. Already within
the first dozen pages, the reader learns about the following:
-
Lexical
conventions such as the syntax for C++ comments and string literals
-
The distinction
between core language and standard library abstractions
-
Program
organization into definitions and headers
-
#include
directives and standard headers
-
Statements
and blocks, braces, and semicolons
-
Names
and namespaces, scopes and scope operator
-
Output
streams and output operators
-
Types
and objects
-
Expression
evaluation, side-effects, associativity of operators.
All chapters
in
Accelerated C++
are nicely organized. They have a core part,
which takes a concrete programming task and uses it to explain new concepts,
and end with a section that summarizes the concepts and adds details where
necessary, followed by a list of suggested exercises.
Taking
a look at the book as a whole, you can observe that it basically falls
into two parts. Roughly the first half of the book concentrates on examples
of using the standard library abstractions. The second half of the book
talks about defining your own abstractions. This is an uncommon, yet very
sensible approach to the language. Before learners can consider implementing
reusable abstractions themselves, they probably first want to know how
to use the existing abstractions.
In
addition to these two parts,
Accelerated C++
contains two appendices
that give an excellent overview of the language features and library abstractions.
The level of detail provided in these two appendices is just right?not
too many details but enough to render them useful as quick references.
This
book is definitely worth reading. Although the book's didactic approach
is unusual, the book is not at all shallow?nor does it miss important points.
Indeed, the choice of topics is very good. Readers learn most of what they
would be learning in a classic C++ introduction. At the same time, the
authors avoid overwhelming their readers with details of each and every
language feature. For instance, they include advanced concepts such as
smart pointers and reference counting, which you don't normally find in
introductory C++ textbooks. Conversely, you won't find a detailed discussion
of how to overload each overloadable operator, which is sometimes discussed
at length in regular C++ textbooks, because it's simply not an everyday
issue for novice C++ programmers. For the beginner it's more important
to be productive in practice as soon as possible rather than to know all
the available language features in theory.
Accelerated
C++: Practical Programming By Example
can be used for learning C++
if a programmer already knows C. But it's probably even more interesting
to a C++ programmer who has rudimentary knowledge of C++ (such as after
a regular "Introduction to C++" class) and who seeks deeper understanding
of it.
Angelika
Langer
develops and teaches classes on Java, C++, multithreading, and
internationalization. She is an internationally recognized speaker and
served on the ANSI/ISO C++ Committee from 1993 to 1998.
Klaus Kreft
is a software architect and senior consultant with 15+ years of experience
in industrial software development. He currently works for Siemens Business
Services in Germany. Langer and Kreft are authors of "Standard C++ IOStreams
and Locales" (Addison-Wesley, 2000) and are columnists for the C/C++ Users
Journal.
|