REVIEW - Learning to Program in C++


Title:

Learning to Program in C++

Author:

Steve Heller

ISBN:

Publisher:

Prentice Hall Ptr (2001)

Pages:

1056pp

Reviewer:

Robert W. Hand

Reviewed:

October 2001

Rating:

★☆☆☆☆


(The following review was written at the author's request for an alternative to our already published review.)

Steve Heller's new book, a ponderous and uneven introduction to computer programming, targets the C++ beginner. The unusual format and presentation may be attractive to newcomers, and they may profit from reading the book. However, any reader should be aware of the serious shortcomings of the book. This book is not for programmers who are moving from C to C++. Indeed, the book should be avoided by all professional programmers and serious students of C++.

The book has been compiled from two prior volumes written in the mid-1990's before the release of the ISO C++ Standard. Although some editing was done, too much of the original code remains pre-Standard. Whereas, a reader can quickly compensate for using the non-standard "vector.h" header file instead of the standard vector library, other constructions are more insidious. Here are a few examples:

  1. Mr. Heller has a penchant for declaring all the variables at the beginning of functions like old style C code rather than declaring them near their first use. As a result, many variables are defined without being initialized.
  2. bool
    variables are tested against
    true
    in an
    if
    -control expression, i.e. "
    if(Found == true)
    ", rather just testing the variable, "
    if(Found)
    ".
  3. Integer type
    short
    is used instead of
    int
    due to an incorrect assertion that
    short
    has a standard size of sixteen bits or two bytes and that the size of
    int
    is uncertain. Although guarantees about size of integer types exist, both types can vary in size from implementation to implementation.
  4. Collection classes containing only
    static
    member functions are used instead of
    namespace
    s to prevent "global namespace pollution".
  5. DOS extensions like
    clrscr
    ,
    clreol
    ,
    gotoxy
    , and
    getkey
    are used without a clear explanation that they are not standard C or C++.
  6. Some of the code is not exception safe.
  7. The C++ Standard Library is not used. The vectors that are used are non-standard, and they are not introduced very well or completely. Templates are not discussed at all.

There are other irritating and inefficient styles and a few frank errors. A new edition should try to update the code to more modern and correct usage. It is a serious flaw not to do so.

The book is long at 1056 pages, yet the author is attempting to cover only about "10%" of the C++ language. The first C++ example code does not appear until page 95. Rather than teaching at a more abstract level, the author delves into a discussion of hardware, assembler, and machine language. Therefore, if a novice chooses to read this book, he or she should be aware that it will be a slow read. Susan, who will be introduced below as a novice, took about six months to read the first half of the book.

Discussions about classes, constructors, and destructors are good and aimed at the level of the beginner. A

StockItem
class and the venerable
string
class are developed in detail. Although the
string
assignment operator is not exception safe, much of the development is standard fare. New ideas and concepts are introduced on a "need-to-know" basis, based on his example code.

The best chapter is on polymorphism. The first part outlines "dangerous" polymorphism with user-supplied pointers and references - the usual approach. The second part contrasts the dangerous approach with the "safe" approach using a handle class (letter/envelope idiom). The author seems to be very comfortable with the letter/envelope idiom, and it is described well.

The index (misnamed 'Forward') at the back of the book is not very useful. For example, the item called "compiler" lists almost every page in the book (only a slight exaggeration).

The other problem involves the E-mail discussions that the author had with an abashedly naive novice named Susan. The author invited her to comment on the book as it was being written. She was a nurse who knew how to turn on computers, how to use E-mail, and how to use a word processing program. But she knew nothing more. They exchanged a torrent of messages, and many are interwoven into the text of the book to further explain a difficult-to-understand concept. Perhaps other readers will think that their conversation is a strength of the book, but I found that it made reading the book uneven. On the other hand, from their conversations I believe that teachers of C++ may gain insight into trouble spots for students.

The strength of the book is the author's excellent writing skill. He knows a lot about C++ and its history, and he is very good at explaining difficult concepts. If he were just average, then I could not recommend the book to anyone. On the other hand, his explanations are unusually clear. I found only a few absolutely untrue statements in his book, the usual average for a technical book of this size.

To summarize, this book should be considered only by absolutely naive newcomers to programming and computers. The book is not a reference or a text for serious programmers. But if a potential reader knows next to nothing about computers, wants to spend many months reading a low level approach to C++, under-stands that the C++ standard library will need to be (re)learned, and realizes that some of the coding styles are outdated, then reading the book would be worthwhile. But I finished his book saddened by the knowledge that the author is capable of a much better beginner's book.


Book cover image courtesy of Open Library.





Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.