Think Like a Programmer


Are you struggling with learning how to program? Do you read code in programming books with problems, understand basic concepts like loops, "if" statements, and functions, but then freeze up when it's time to write a program all on your own? Does it seem like other programmers have some innate gift that allows them to see the way through to a solution?


I've met a lot of fledgling programmers who felt that way. In fact, I'd say that most of my students over the years began in that category. They could pass quizzes on programming syntax--show them a block of code and ask them what the output was, for example, and they would have no trouble figuring out the answer. But when they had to write a program to perform a particular task, and they weren't given the details on the program's structure, they didn't know how to do it.

Eventually I figured out what was missing. They had been taught how programs work, but they hadn't been taught to think like a programmer. They hadn't shown the mental processes programmers employ when they figure out how a program is going to be structured, how the trickier parts of a program can be made easier, and how they get moving again when they get stuck.

With Think Like a Programmer, I'm looking to change all of that. Starting with the simplest sorts of programs, and progressing through a number of specific programming areas, I show how to think your way from the problem description to a work program. This isn't an ordinary programming book; C++ syntax is only covered in brief review so you'll need another source for that if you're still learning. Instead this book will show you how you can plan to solve any programming problem.

I've pulled quotes that get at what I'm trying to accomplish with this book:

I highly recommend this book to anyone who feels stumped when facing a new problem or could use some pointers on how to teach others who do.

-- David Ruttka, review on Amazon

I wish I had had this book when I started studying computer science.

-- Adrian Woodhead, review on Slashdot

[The book is] an amazing tutor who will explain what your teachers meant and show you how to better put your knowledge to use.

-- Robert Perkins, review at GameVortex

I've also started receiving e-mails from readers. I won't quote directly from something sent to me privately, but I'm glad to hear from people who are growing in confidence after applying the concepts in the book.

So if you've been able to comprehend programming syntax and feel like you're being held back by your inability to systematically work your way from a blank screen to a finished program, I hope you'll consider giving my book a try. You can buy a copy through any bookstore, including Amazon (there's also a Kindle edition), or at Barnes & Noble (it's in some store locations, too, if you want to check it out). It's also available direct from No Starch Press. The direct price is higher but it includes both a physical and an e-book copy, so if you think you'd like both that's probably the way to go.

Contact Me

If you have questions about the book, or comments, or just want to say hello, shoot me an e-mail. The address is v.anton.spraul, followed by the "at", and then

Source Code

The source code is available here. Right now it's just the C++ from the book, but I'm working on a version in Java (except for the one chapter that won't make any sense in Java). If you have a suggestion for another language, let me know.


It drives me nuts whenever I'm reading a book and find a mistake. Now I can drive other people nuts, I guess. Anyway, mistakes, updates, and clarficiations can be found here. Be sure to let me know if you find any problem not listed there.

Additional Resources

Other resources are here.

Share this