
How to solve it
George Pólya
A classic guide to breaking problems into parts and testing strategies, the same habit Spraul builds through his exercises. Its heuristics apply well beyond mathematics, as the source book also argues.
Reader-supported: when you buy through links on our site, we may earn an affiliate commission. Learn more
We earn a commission if you buy through these links. Learn more
Find Similar BooksA beginner's programming book that teaches how to approach problems, not just which syntax to type, using open-ended exercises that reward slow, deliberate thinking.
Think Like a Programmer is an introductory programming book that treats problem solving as its main subject and uses C++ as the vehicle. Spraul is less interested in where the semicolons go than in showing how a programmer moves from a vague goal to a working plan. Most chapters take a single concept, such as loops, functions, classes, pointers, or recursion, and use it to illustrate a way of approaching problems rather than just a feature of the language.
The reading experience is closer to a workshop than a reference book. The exercises are open-ended, so there is often no single right answer, and working through them is where most of the learning happens. You will be asked to break a problem into parts, choose a data structure, and weigh tradeoffs. Expect to get stuck and then find your own way out, because the book trusts you to do that work.
Because the examples are in C++, you meet pointers and dynamic memory directly rather than having them hidden behind higher-level abstractions. The emphasis on method, such as splitting problems up and organizing your thinking before writing code, carries over to any language. It reads as a patient, practical companion for someone who has tried a language or two and wants to understand why code is shaped the way it is.
The book's central claim is that knowing a language's rules is only part of programming. The harder part is turning a fuzzy goal into a sequence of steps a machine can follow. Spraul treats that translation as a learnable skill, and each chapter asks you to practice it rather than simply memorize the feature under discussion.
A large problem becomes manageable when you split it into discrete pieces that can be solved and tested separately. The book repeatedly models this habit, showing how to name the parts, decide what each one must accept and return, and only then fill in details. The approach works as well on paper or in your head as it does at a keyboard.
Many programming difficulties are really difficulties of representation. The same task can be easy or painful depending on how the data is stored. The book encourages you to ask what operations you need most often and to pick a structure that makes those operations natural, rather than defaulting to whatever you saw first.
Recursion and manual memory management are often taught as hurdles to be cleared. Here they are presented as ways of structuring a solution. Recursion shows how a problem can be defined in terms of smaller versions of itself, and dynamic memory shows how a program can decide at runtime how much space it needs.
The book predates recent C++ standards, so modern language features and idioms are largely absent, and some code style will look dated to working developers. Readers who want a steady supply of worked answers may find the open-ended exercises frustrating, since the book prioritizes your own reasoning over complete solutions. It does not cover web development, frameworks, or professional tooling, and its treatment of algorithms is a starting point rather than an in-depth survey.
Reviews from readers on YouTube. Their opinions are their own.
Book details and cover from Google Books.
Ready to read Think Like a Programmer?
Get your copy on Amazon, or listen to it on Audible. We earn a commission if you buy through these links.

George Pólya
A classic guide to breaking problems into parts and testing strategies, the same habit Spraul builds through his exercises. Its heuristics apply well beyond mathematics, as the source book also argues.

Brian Christian, Tom Griffiths
Shows how computer science ideas help with everyday decisions, echoing Spraul's view that programming thinking reaches outside the field. Readers who enjoyed his broader lessons will find its examples engaging.

Seymour Papert
Explores how learning to program changes the way people think about problems. Readers drawn to Spraul's emphasis on creative problem solving will appreciate Papert's approach to learning through building.
Andrew Hunt, David Thomas
Offers practical habits for writing and maintaining code, complementing Spraul's focus on organising thoughts. Its short, concrete tips suit readers who want to apply problem-solving skills in real projects.