Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Ruminations in C++


April 1997/Ruminations in C++


Title: Ruminations on C++
Authors: Andrew Koenig and Barbara Moo
Publisher: Addison-Wesley, 1997
Pages: 400
ISBN: 0-201-42339-1
Price: $26.95

Andrew Koenig is one of the most important men in the world — the C++ world, that is. He's the project editor for the upcoming international Standard defining C++ and its library, which means he is the ultimate arbiter of the form and content of the Standard. Perhaps even more importantly, he's been a longtime member of Bjarne Stroustrup's inner circle at AT&T. Stroustrup is the originator of C++, and Koenig has been alongside to help decide the direction of the language's evolution for over a decade. Thus, a new book on C++ by Koenig is worthy of considerable attention.

The book is entitled Ruminations on C++, and is coauthored by Barbara Moo, Koenig's colleague at AT&T. As the book's copyright page points out, the primary meaning of "ruminate" is to chew cud. In fact, the cover displays a bucolic scene, festooned with cows, and the back cover copy milks the bovine theme for all it's worth (as shamelessly as I just did!). The secondary meaning — meditating at length — is more germane to the content of the book, however, since that's what the book is: a collection of extended explorations of particular features of C++ and approaches to problem solving that they enable.

Koenig has been writing columns about C++ for a number of years, published in The C++ Journal, The C++ Report, and The Journal of Object-Oriented Programming. If you have been a regular reader of those publications, Ruminations will be familiar material to you: it's a collection of the best of those columns, organized and edited by Moo.

The book is arranged into six sections of unequal length: Motivation, Classes and Inheritance, Templates, Libraries, Technique, and Wrapup. The longest of these is Templates, dealing as it does with what Koenig considers "the most important idea in C++," even more so than object-oriented programming. This section also contains arguably the most useful material, a lucid presentation of the key concepts embodied in the Standard Template Library (STL) such as generic algorithms, different kinds of iterators, and function adaptors. The section on Classes and Inheritance covers traditional object-oriented programming, i.e., inheritance and dynamic binding. This section is nearly as long as Templates. The remaining sections are much shorter, and as such do not go into extended thematic explorations. They serve more as targets of opportunity for expressing Koenig's thoughts on the topics involved.

Despite this overall organization, most of the book's 33 chapters (appropriately numbered 0 through 32) stand alone, as you might expect from their origin as columns in relatively infrequent periodicals. They can each be read in a few minutes. Each chapter typically deals with a single concept — a particular feature of the language or an approach to problem solving that C++ facilitates — and explores it via successively elaborated program fragments.

Koenig writes in a clear, straightforward, and accessible style. His examples are well chosen to illustrate the topics, and he shows a good grasp of the pedagogical principles of working from the known to the unknown, from the simple to the complex. The result is very effective.

Throughout the book, the emphasis is on the broader picture, not just the limited problem being discussed. Koenig continually explores the implications of the topic at hand: What general principles can be deduced? What factors need to be considered in choosing this approach over its competitors? As he says in the preface, "Knowledge can be acquired systematically; wisdom cannot." By always placing each problem and solution in the broader context, the author is attempting to convey the gestalt of wise problem solving using C++ as a tool.

Ruminations is a difficult book to categorize. It is not courseware, certainly not an introduction to C++ programming for the novice, nor even a course on advanced C++. Its nature as a collection of columns inevitably means that the selection of topics is spotty, covering what the author found interesting rather than systematically presenting the entire language.

Neither is Ruminations a member of the other popular sub-genre of programming books, the cookbook of tips and techniques. Although flipping through the book reveals hardly a page without a good portion of code, most of that code is of the "toy" variety. It is written to be simple enough to serve the expository needs of the article — not to be copied into programs verbatim.

Courseware and cookbooks are aimed at people who need to learn a certain set of facts to get a grade, or to satisfy some set of work requirements. Ruminations targets a different audience: people who want to understand rather than just to know, people who enjoy learning as a recreation rather than endure it as an imposition. If this describes you and C++ is your current playground, you should definitely pick up a copy: you'll find it a rewarding experience. o

William M. Miller has been a professional software developer for over twenty years and is currently employed by Software Emancipation Technology, Inc. He has worked as a user and implementor of C++ since 1986, was a founding member of X3J16, the C++ Standard committee, and served as its vice chair from 1990-91 and again since 1996.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.