Think Like a Programmer

TLAP CoverAre 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 been 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 changing 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.

Important Note: If you are just starting out with programming, you should check out the new Think Like a Programmer: Python Edition, which has been written for beginning programmers, and will teach you common programming syntax along with the problem-solving techniques.

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 give my book a try. This book has sold ten of thousands of copies and helped people all over the world learn to program.

Real quotes from real readers:

"A book every programmer should read once."

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

"Has helped me tremendously in my problem solving development."

"Interesting and one of the most useful in the industry."

"I love it."

"Thank you for your book! It is worth WAY more than it costs!"

"It was incredibly helpful."

Where to Buy

Think Like a Programmer is available as a book or e-book from the usual retailers including Amazon, but I would recommend buying direct from my publisher; where you buy the physical book and get a DRM-free e-book as well!


I have a series of videos on YouTube. These videos cover some of the ideas from the book in a different way, or using different examples, so whether you decide to pick up the book or not, check the videos out.

Source Code

The source code for the examples in the book is available.


Updates and clarifications are available. Note that most of these issues were resolved in the second printing.

Luhn Algorithm

If the explanation of the Luhn algorithm (not how to solve it, but the algorithm itself) isn't completely clear, I've written an expanded explanation.

Instructor's Exercise Guide

I am sometimes asked if there is a solutions manual to the chapter exercises. There is not, because the point of the exercises is how you arrive at the solution, not the solution itself. However, I've written an exercise guide for instructors. This is intended to help instructors and their lab assistants in coaching struggling students; it provides suggestions, especially for the tricker exercises, on how to assist students while still letting them find their own way as much as possible. If you are an instructor or assistant and want a copy of the guide, please contact me.

Share this