How Not To Program In C++ Book Review

How Not To Program In C++ Cover
Reviewer: Matt Wilson
Category: 
Books
ISBN: 
978-1-886411-95-1
Pages: 
280
Cover Type: 
Paperback
Price: 
$24.95

For all you folks that sat for hours when you first stumbled across the joy that is "fortune", or for the ones of you that get a small thrill from announcing to your friend "that's the problem, that line there!" after they've just spent several hours slaving over lines of code trying to debug their program - I think you'll like this book.

What's In A Book?

To be honest, I was not entirely sure what to expect when this book first arrived along with the mail (the snail kind) and if I'm being honest I'm still not entirely sure what makes up the 280 pages of content that it is. I found myself leafing through the book page by page wondering exactly this and came to the following conclusion - the book consists of source code and humorous tales and comments. That isn't to say that this is a bad book in any way, but if you are looking for a reference book or tutorial book regarding C++ then this book isn't for you. This book reminds me of the number puzzle books I used to have as a child, more something to distract your mind for a while than anything truly productive, they are still fun though.

Fun? Is This Book About C++ Or Not?

Yes! There is source code from 114 different programs listed in the book, only 3 of which actually "work" as expected, so what do the other 111 do? Each program has a flaw in one way or another, some more serious than others, ranging from simple to diagnose, even for the moderately inexperienced programmer, all the way up to three or four page behemoths consisting of classes, pointers, objects and - to make things interesting - multi-threading and semaphore problems. Not for the faint of heart. Thankfully, included is a full set of hints to help you on your way, reminiscent of the adventure books of the 1980s where you are told to "go to" a page to continue the quest with your choice of action, not very similar but the reference is there I'm sure. Along with an extended set of handy hints are included a set of answers to the problems set, explaining what happens in each case and why, including resolutions for each problem and working code where necessary.

Example

OK, as an example let us take a look at the first program listed in the book as having a problem. Program 1: Hello World #include void main(void) { std::cout << "Hello world!\n"; } Now, I have to admin that I did not spot the mistake at first glance so I decided to write the program out and compile it, if for no other reason than to include in this review. It was a long and grueling task which took many hours. Thankfully however, I have now recovered and am ready to compile it up, so what does G++ have to tell us about the above source code? matt@localhost:~$ g++ -Wall -o helloworld helloworld.cc helloworld.cc:4: `main' must return `int' helloworld.cc:4: return type for `main' changed to `int' matt@localhost:~$ Lo and behold, that is what the book says as well - marvelous. Shame on me for not spotting that one though.

So What About These Comments?

Throughout the book, in between each source code dump there appears a (or sometimes two) quote, story or joke in a manner similar to the program "fortune" (if you don't know about fortune then you have got a lot of fun ahead), not that they are just output from fortune, but you get the idea I'm sure. I have to say though, that putting them in was a very good idea, it helps to break up the book and makes the non stop stream of source code into a much lighter book which can be picked up and put down in a similar way to a joke book or comic.

Summary

As it happens, I have found myself picking up this book for short periods over and over in order to "test myself" and see what horrific source code example the next page holds. I consider myself both an experienced programmer and able to handle any problem thrown at me but have to admit to failing to find the solution to a few of the problems listed in this book - not too many of them, but some. This is why I think that novices and experts alike will appreciate this book as a member of their book case, more likely under "humor" than "reference", but up there never the less.

Conclusion

The Good - Pros
  • Definitely a "passing the time" book - Fortune lovers rejoice!
The Bad - Cons
  • Not a C++ reference or tutorial (though it doesn't claim to be)
The Ugly - Problems
  • N/A
The Verdict - Opinion
  • Great book, it's right up along with my Dilbert books in the "10 minutes to waste" pile.

Content: 
3/5
Approach: 
5/5
Learning Curve: 
4/5
Cost / Value: 
4/5

16/20

Overall score


Category: 
Tags: