Think Like a Programmer: An Introduction to Creative Problem Solving – #programming #bookreview

Think Like a Programmer: An Introduction to Creative Problem Solving
V. Anton Spraul
(No Starch Press, paperbackKindle)

Often, we “solve” problems by avoiding them. For example, if we have a clunker car, we trade it in and get a new one. Problem “solved” simply by putting a shiny new sedan in the driveway.

In software programming, however, problems generally have to be fixed, not avoided. Typically, you can’t kick a major bug to the curb and make it disappear just by adding a new function or screen. Whatever is wrong has to be repaired. And most of us are not mentally wired to quickly spout new source code that solves the dilemma.

“Problem solving is hard,” V. Anton Spraul states. And his well-structured, well-written book aims to help us rewire our heads and get a better handle on fixing problems in software.

“When solving a problem with a program, you…have constraints,” he writes. “Common constraints include the programming language, platform (does it run on a PC, or an iPhone, or what?), performance (a game program may require graphics to be updated at least 30 times a second, a business application might have a maximum time response to user input), or memory footprint. Sometimes the constraint involves what other code you can reference: Maybe the program can’t include certain open-source code or maybe the opposite—it can use only open source.”

He adds: “For programmers, then, we can define problem solving as writing an original program that performs a particular set of tasks and meets all stated constraints.”

But beginning programmers often focus too much time and effort on just making the program perform the required tasks. They don’t pay enough attention to staying within the required constraints, as well.

Think Like a Programmer begins with general strategies for solving problems and puzzles. Then it gets specific for programmers with a series of well-focused chapters:

  • Solving Problems with Arrays
  • Solving Problems with Pointers and Dynamic Memory
  • Solving Problems with Classes
  • Solving Problems with Recursion
  • Solving Problems with Code Reuse

The final chapter, “Thinking Like a Programmer,” shows how to develop a master plan that you can use “for attacking any programming problem.”

Think Like a Programmer: An Introduction to Creative Problem Solving offers a number of challenging exercises in its chapters, and the author encourages readers to attempt each one. But he provides no convenient answers at the back of the book – just as you will experience in real-life programming: no convenient answers to problems and puzzles.

One drawback for this book is that its code examples are all written in C++.

“C++ was selected for a number of reasons,” the author states. He lists several that make good sense and concludes: “…C++ is a great choice because once you have learned to solve problems in C++, you have learned to solve problems in any language. Many programmers have discovered how the skills learned in one language easily apply to other languages, but this is especially true for C++ because of its cross-paradigm approach and, frankly, because of its difficulty. C++ is the real deal—it’s programming without training wheels. This is daunting at first, but once you start succeeding in C++, you ‘ll know that you’re not going to be someone who can do a little coding—you’re going to be a programmer.”

Si Dunn

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s