Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
Generic programming and the STL : using and extending the C++ Standard Template Library
Austern M., Addison-Wesley Longman Publishing Co., Inc., Boston, MA, 1998. 548 pp. Type: Book (9780201309560)
Date Reviewed: Feb 1 1999

The history of programming started with imperative programmingusing assembly languages, Fortran, Cobol, and similar languages. A newprogramming paradigm was introduced in the 1960s with functionalprogramming, using Lisp-like languages. Object programming is a thirdparadigm, and generic programming is a fourth. As Thomas Kuhn pointedout, each new paradigm is disturbing: you have to give up your familiarways of thinking.

This book is an excellent answer to the question, Why should I tryto learn new concepts? Austern does not start by giving formal,mathematical definitions. He uses simple examples to show thatalgorithms should be written in such a way that they can be used forvarious kinds of data structure, without having to create a lot ofdifferent programs. To reach this goal, the usual concepts ofprogramming--such as pointers, functions, and arrays--must begeneralized into iterators, function objects, and containers. A pointeris mainly used to designate an element in a sequence. You need todesignate the first element, proceed to the next one, and test to makesure you have not gone out of the sequence. In some cases, you justconsult the elements (input iterator), assign values to the elements(output iterators), or compare two consecutive elements (forwarditerator). You may have to move backward in a sequence, which can bedone with bidirectional iterators. Random-access iterators allow anykind of operation that can be performed on a pointer. While arandom-access operator provides all the operations that may be neededfor a pointer, using a variety of iterators provides security: if aninput iterator is just what you need, you do not risk destroying thesequence you are working on through some programming mistake. Withgeneric programming, you have to recognize which kind of operation willbe performed in the algorithm to be implemented, choose the right typeof iterator, and write a program that is usable on any kind of sequenceof elements of arbitrary structure. The Standard Template Library (STL)is the toolkit with which to do so.

The STL provides many subroutines that perform classical operationson such sequences: for example, find an element, remove it, replace itby some other value, permute two elements, or sort according to somekey. Using containers, you can organize sets, maps, queues, stacks,lists, and so on. The STL provides arithmetic and boolean functions onall kinds of elements. Containers provide the opportunity of creating,naming, and using any kind of data structure, with common ways tomanipulate their elements.

The book is divided into two parts. In the first part, Austernpresents the main new concepts of generic programming: iterators,function objects, and containers. They are introduced by way of examplesin a semiformal way: instead of using formal logic, the author explainsthese concepts in plain English, but in a rigorous manner. The secondpart of the book is a reference manual for theSTL. For each element covered in this manual, theauthor gives a shor t description of its purpose and its functionalities,then presents its syntax and semantics more formally. Problems ofportability and standardization are discussed in the appendix. A goodindex makes this manual easy to use.

This book can be highly recommended. It is easy to read, clear, andconvincing. Any programmer who has written programs manipulatingsophisticated data structures will be easily convinced that the STLcould have saved her or him a lot of effort when managing memory tostore such a structure, creating routines to declare it, finding anelement, modifying its value, and destroying it. Examples throughout thebook help readers pick up the programming style used in genericprogramming. When a new programming paradigm is proposed, programmerstend to think that the paradigm they currently use provides everythingthey need. Reading the first part of this book (80 pages) will notrequire a lot of time or effort. Readers will rapidly recognize thatprograms they wrote some time ago could have been written more easilywith the STL. Everything needed to do so is given inthe book. It is worth reading.

Reviewer:  J. Arsac Review #: CR126048 (99020059)
Bookmark and Share
 
Interoperability (D.2.12 )
 
 
C++ (D.3.2 ... )
 
 
Data Abstraction (D.2.11 ... )
 
 
Design Tools and Techniques (D.2.2 )
 
 
Miscellaneous (D.1.m )
 
Would you recommend this review?
yes
no
Other reviews under "Interoperability": Date
Generic programming and the STL: using and extending the C++ Standard Template Library
Austern M., Addison-Wesley Longman Publishing Co., Inc., Boston, MA, 1998.  548, Type: Book (9780201309560), Reviews: (1 of 2)
Dec 1 1998
.NET 2.0 interoperability recipes: a problem-solution approach
Bukovics B., Apress, Berkeley, CA, 2006.  632, Type: Book (9781590596692)
Jan 31 2007
The dream of a global knowledge network: a new approach
Doerr M., Iorizzo D. Journal on Computing and Cultural Heritage 1(1): 1-23, 2008. Type: Article
Oct 20 2008
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
Terms of Use
| Privacy Policy