Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
A C++ toolkit
Shapiro J., Prentice-Hall, Inc., Upper Saddle River, NJ, 1991. Type: Book (9780131276635)
Date Reviewed: Dec 1 1991

A toolkit, in the context of the software industry, is a collection of software to assist in the production of other software. This book shows how to build reusable software using the C++ programming language; a toolkit in the form of a set of C++ classes serves as a concrete example. The book is divided into four sections. The first section discusses the design of classes for reuse and gives an overview of C++, thus providing motivation and background for the remaining sections. The second section contains eight chapters, each of which is a detailed presentation of a complete, small C++ class. These classes are implementations of bit sets, lists, arrays, dynamic arrays, binary trees, hash tables, pointers, and atoms. The third section discusses memory management, performance tuning, and templates for programming generic classes. The fourth section gives complete source code listings for the classes of the second section. Many of the chapters conclude with a set of exercises and questions for the reader.

The book is intended to teach the design and implementation of reusable C++ classes. It assumes that the reader has some knowledge of C++; although it provides a brief guide to the differences between C++ and C, it is not a textbook for C++. The reader also needs some experience in engineering software.

The first chapter discusses problems of software reuse and possible solutions through the use of object-oriented programming languages, but includes no general explanation of what is meant by reusable software. Such an explanation could include a description of several kinds of reusable software and their use. One kind is the software library, which provides a compiled set of functions or classes. New programs are written to call existing library functions and procedures and to instantiate objects of existing library classes. Two examples of libraries are the ANSI C standard library [1], which provides input/output, string, mathematical, and other functions, and the NIH class library [2], which provides more than 60 general-purpose C++ classes modeled on basic classes of Smalltalk-80. A second kind of reusable software is the extensible type hierarchy, in which new types or classes may be derived from existing ones. Classes from the NIH library can also be used as bases for deriving new classes. A third kind of reusable software is a collection of software tools in the style of Kernighan and Plauger [3], which is used to build software pipelines from existing programs. Shapiro does not explore these concepts, although he claims that libraries of procedures have failed to help solve the problems of building software, that binary reuse is not yet practical, and that software reuse is still at the level of source code. He makes the case for developing classes that can be reused, either directly or as the basis for constructing new classes. This definition of software reuse, around which the book is built, is narrow (albeit topical).

Abstract data types, data encapsulation, and inheritance, and how these concepts may be used in C++ programs, are explained well in the first section. This section also contains many pieces of practical advice for designers of C++ classes, such as seven steps to follow when designing a new class and three member functions that should be provided with every class definition.

The detailed presentations of C++ classes in the second section raise many interesting technical issues and afford Shapiro the opportunity to give several principles for software design. For example, he explains the use of macros for building generic classes, discusses type security, and presents the “Principle of Least Amazement,” which should be applied when designing a new type similar to a built-in type. This section explains some common pitfalls for the unwary C++ programmer, and contains details on coping with the deficiencies of existing compilers. An in-depth reading of these chapters, together with the full source code listings in the fourth section and the chapters on performance issues, should prove instructive to most readers.

The presentation is good: the text and the source code are laid out well, and appropriate type fonts have been used (except for some curious double quote marks in the source code). The style is clear, informal, and lively. The book contains an adequate index but lacks a list of references for the reader to pursue topics, such as the interesting quotations preceding each chapter, further.

The book pays scant attention to software documentation for the user or client. Good reusable software must have good documentation. Programmers who use the C standard library or a class library do not have to read the source code in order to find out what a particular procedure or class provides, and they usually do not want to; they consult the manual entry. This book includes no manual entries or other user documents for its C++ toolkit. This omission probably reflects Shapiro’s belief that reusability is only possible at the level of source code: it follows that a programmer should read the source code in order to reuse it. It does not also follow that user documentation is unnecessary or even undesirable, however. The statement of page 6 that “the definition of a class tells you exactly what it does and doesn’t do” is inadequate--reading the header file for a class often fails to yield this information, and reading the source code sometimes also fails if the code is obscure or implements a complex algorithm. One often does have to read source code, but one can frequently reuse classes or functions on the basis of reading well-written manual entries. It is part of a software educator’s job to teach the importance of good documentation, and this book would teach more about building reusable software if it included a user manual for its toolkit.

This book has much to recommend it to anyone working on the design and implementation of C++ classes. It is thought-provoking, stimulating, and a good presentation of concepts, down-to-earth practical advice, and much design and coding work. The reader will probably question some of the statements and design decisions in the book, but Shapiro achieves something valuable by inviting reflection on the issues he raises.

Reviewer:  Julia Dain Review #: CR115002
3) Kernighan, B. W., and Plauger, P. J. Software tools in Pascal. Addison-Wesley, Reading, MA, 1981. See <CR> 24, 1 (Jan. 1983), Rev. 39,968, and <CR> 24, 5 (May 1983), Rev. 40,285.
Bookmark and Share
 
C++ (D.3.2 ... )
 
 
Design Tools and Techniques (D.2.2 )
 
Would you recommend this review?
yes
no
Other reviews under "C++": Date
Borland C++ handbook
Pappas C., William H. I., McGraw-Hill, Inc., New York, NY, 1991. Type: Book (9780078810152)
Feb 1 1993
Going from C to C++
Traister R., Academic Press Prof., Inc., San Diego, CA, 1993. Type: Book (9780126974126)
Apr 1 1994
Using Borland C++
Atkinson L., Atkinson M., Que Corp., Indianapolis, IN, 1991. Type: Book (9780880226752)
Jun 1 1992
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