Ruminations in C++



April 01, 1997
URL:http://www.drdobbs.com/ruminations-in-c/184403324

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.

Terms of Service | Privacy Statement | Copyright © 2024 UBM Tech, All rights reserved.