Author: Rogers Cadenhead & Jesse Liberty
Publisher: Sams, 2011
Aimed at: Newcomers to C++
Pros: Clear and concise
Cons: Tends not to emphasize object-oriented methods
Reviewed by: Harry Fairhead
This is a nice simple introduction to C++ with plenty of humour thrown in. The book includes a CD with a C++ compiler and environment for PC, Mac or Linux bound into the back. If you want to use something else such as Visual Studio you can as most of the book tells you how to write standard C++. This fifth edition has been brought up to date by a new co-author, Rogers Cadenhead, who has succeeding in doing this without overextending its size or adding confusion.
Chapter 1 is the usual getting started information you need to get to the point of running a simple program. In this case it displays "Solidum petit in profundis" rather than the usual "Hello World". This happens to be the motto of Aarhus University where a few famous people attended including "some guy named Bjarne Stroustrop" (the inventor of C++).
From here part 1 works its way through C++ in a logical order - parts of a program, variables , expressions, functions, loops, arrays and strings. Ideas are introduced gently and with short examples. The one problem is that occasionally something is introduced with out enough guidance on how to use it. For example, in the section on loops the break and continue statements are introduced without any comment on whether they are a good idea or not or how to use them. In fact there is an argument that break and continue should be left to a more advanced chapter. The book also doesn't resist the temptation to introduce more advanced for loops, which is probably not a good idea if the reader hasn't got the idea of simple enumeration.
Part II is about classes and objects in general. It consists of just two chapters - a basic introduction to classes and an advanced look at constant classes. interfaces, inline and nested classes. Again this collection of advanced topics probably could have been left until later and some more core object-oriented topics introduced.
Part III of the book launches into what is perhaps the most difficult topic in C++ and it isn't object orientation but memory management. This explains how to work with pointers and references - which are very similar but also very different. At the end the reader has a reasonable chance of coming out well educated but my guess is that a few will still be wondering what it is all about.
Part IV Advanced C++ only has two chapters. The first deals with functions - overloading, default values, initialization and the copy constructor. The second introduces operator overloading where there are suitable warnings about not over doing its use. Even so covering it before the more advanced aspects of object oriented programming is a bit of an odd choice.
Part V does deal with the advanced details of objects - inheritance and polymorphism in particular. This might be a little late in the book if your aim is to master C++ as an object-oriented language. However both are difficult ideas to master. The bigger problem is that although objects were introduced quite a few pages earlier there has been little use of objects in the rest of the book. You don't get a lot of opportunity to practice the ideas.
Finally we have Part VI which is a collection of topics. There's more on objects and a chapter on the new C++0x standard, although not very much and not on the most useful and advanced parts. There is a chapter on object-oriented design but this is a bit short and a little late. It is followed by a chapter on templates (generics) and a chapter on exception handling.
Overall this isn't a bad book but it has a number of potential worries depending on your point of view. It isn't strong on object-oriented methods but some might re-phrase this as "it doesn't ram object-oriented methods down your throat". It does do a reasonable job of explaining the basics of the language and some of the more advanced parts. It doesn't cover many of the realities of using C++ in the real world - the libraries and the problems of sorting out header files and other related technolgies such as COM. As a result there is still much to learn when you get to the end of this book. On the other hand by being reasonably focused, it manages to be an introduction to C++ in a compact volume. So within its remit of being a quick introduction it seems to work.