Home Page -------------------
[Home Page] - [Reviews Main]
-------------------

Book Review
C++ Programming Style by Tom Cargill
Recommended
ISBN: 0-201-56365-7       Publisher: Addison-Wesley       Pages: 233pp       Price: £19-95
Categories:   style     advanced c++     writing solid code    
Reviewed by Gary Thompson in C Vu 5-5 (Jul 1993)
C++ is a wonderful language in some ways, as it gives us high level language features and object-oriented abstractions which hopefully(!!) allow us to create robust and reusable software while still allowing low level access to the processor. Unfortunately, on the down side, C++ is a hybrid, even a mongrel, language with what my compiler documentation describes as "dark corners" and powerful features with which you "can blow your foot off".

The thrust of the book is to apply the same strategy that Kernigan and Plauger used in "Programming Style" on C++ based object-oriented programs and in fact the authors recommend Kernigan and Plauger as a reference on the subject of programming in the small (i.e. how to write a clear sensible efficient and maintainable subroutine). Therefore the coverage in the book is constrained mainly to programming in the medium to large i.e. the interactions between classes. It is also assumed that the reader is up to speed on C++, and people who use the language as a better C need not apply.

The book takes a highly pragmatic look at how to avoid problems using real classes from magazine articles and other sources even including the NIH class library. This approach coupled with a readable style with highlighted rules of thumb makes it an 'easy read'. It is certainly not a book for the ivory tower academic. The examples used are good and give you plenty to think about, and it is entirely pleasurable seeing how what appears to be a superficially satisfactory program improves as it develops through various incarnations. The first two chapters are especially good at covering how to use virtual functions and inheritance correctly.

There are some parts of the C++ language that are especially problematical: how to handle memory errors and other errors in constructors, virtual destructors, operator overloading, and multiple inheritance. Each of these areas gets good coverage in its own section and reasonable conclusions and work rounds are suggested. In the case of multiple inheritance and operator overloading the authors conclusion is that you should only use them if you really need to!!! There is also an excellent and pragmatic chapter on optimisation which many people could learn lessons from.

So are there any gripes? Well a few, the book is quite expensive for its size (I expect this is because it's part of a 'Professional' series), this is further compounded by the use of large text and wide spacing. Also, I don't agree with all the conclusions, but then style is highly subjective and opinionated area. The newer features of the C++ programming language (templates & exceptions) are not really covered and I feel that it is a bit of a 'cop out' to just say these areas await the light of further experience. Finally some direction on how to set about modelling a large program, or references to a good book on this area would have been very useful (I have yet to find a satisfying book on this area).

Overall the book makes a lot of sensible suggestions and pulls them together in pithy rules of thumb. So if you have a good grip of the syntax of C++ and it's object-oriented constructs, but feel that you need help on making the languages features come together in a consistent and clean manner this may be a good book for you.


Other Authors with the same surname

Cargill
C++ Programming Style by Tom Cargill [Recommended]  (Reviewed May 1993)


Last Update - 13 May 2001.

To link to this review, please use the URL: http://www.accu.org/bookreviews/public/reviews/cp/cp000406.htm

Copyright © The Association of C & C++ Users 1998-2000. All rights reserved.

Mirrored from http://www.accu.org/