I used to write software. I confess, it has been a long time. There are parts about doing so that I loved (problem solving, being creative) and parts I didn’t enjoy (solving problems that I didn’t find interesting, over and over and over again). This book concentrates on the parts I enjoyed most.
Think Like a Programmer came out earlier in 2012. It was published by No Starch Press, which consistently puts out books that impress me. It is one of the more consistent computer-related publishers and when I’m researching a specific topic, I generally look at any they offer, along with O’Reilly, before looking at other publishers’ offerings. I should probably disclose that back in 2009 I talked with No Starch about writing a book about Ubuntu. That didn’t work out and shortly afterward I ended up taking over the Ubuntu Unleashed title for SAMS when the previous author team didn’t want to continue with it, but my email conversations with the head honcho (or as their website says, the “Big Fish”), Bill Pollock, left me with a favorable impression of the company.
This is not a “how to program” book that concentrates on learning the syntax, vocabulary, and grammar of a specific programming language. You will need to learn that elsewhere. In fact, you probably want to learn basic C++ before you read this book. While the concepts in this book will apply across programming languages, examples are given using C++. Those who already know Java or C# and who are flexible will probably be okay, but will need to be experienced enough to translate.
This is a “how to program” book that focuses on figuring out how and when to use the various concepts and tools within a language to creatively solve problems. I have never read another book that covers this topic. The idea is that learning the basics of a language helps you understand what the tools do, but it is usually experience that helps you understand and create strategies for using them. You may know what a pointer is and the mechanics of using one, but seeing when using pointers is most effective only happens after seeing them at work in context. Context is what this book tries to give. The author, V. Anton Spraul, calls the missing skill problem solving, “the ability to take a given problem description and write an original program to solve it.” The cool thing is that the book teaches the sort of problem solving skills that usually require years of experience in a systematic, logical way.
The book starts with a discussion about strategies. Problems almost always have constraints, things that limit the paths you have available for solving them. Good problem solving finds a way to do what must be done while not violating any of these boundaries. This involves creative thinking. This 20-some page discussion is the foundation for the rest of the book.
As the book continues, you will meet up with all your conceptual friends you learned about in your programming class or book. Only this time, the discussion is not about mechanics, but strategy. Why is tracking state important? When should I use scalar variables vs arrays vs multidimensional arrays? What problems are better solved using pointers and dynamic memory? How do I create meaningful classes and objects (and not just “arbitrary bags of leftovers”)? Since C++ is flexible, it affords a nice discussion of when a procedural and when an object-oriented approach may be most suitable. Sequential or recursive? If using recursion, head or tail? What about reusing code?
The book ends with a useful chapter on thinking like a programmer. Yes, that is the topic of the entire book, but whereas each chapter focuses on discrete parts, this chapter brings all the parts together to help the reader learn to synthesize a master plan when solving specific problems.
Bottom line: you probably need a year or two of experience for this book to be really useful. This is because once you have struggled with some of the issues the book discusses you are going to be much better equipped to see how useful the book is. The bare minimum is to either have studied C++ or to have spent enough time programming in another language or two so that you understand what the C++ discussions and samples are illustrating. If you fit here, the book is highly recommended.
Disclosure: I was given my copy of this book by the publisher as a review copy.