Examples in this book are written in C++, but will improve your ability to think like a programmer in any language.
The real challenge of programming isn't learning a language's syntax—it's learning to creatively solve problems so you can build something great. In this one-of-a-kind text, author V. Anton Spraul breaks down the ways that programmers solve problems and teaches you what other introductory books often ignore: how to Think Like a Programmer. Each chapter tackles a single programming concept, like classes, pointers, and recursion, and open-ended exercises throughout challenge you to apply your knowledge. You'll also learn how to:
Split problems into discrete components to make them easier to solve Make the most of code reuse with functions, classes, and libraries Pick the perfect data structure for a particular job Master more advanced programming tools like recursion and dynamic memory Organize your thoughts and develop strategies to tackle particular types of problems Although the book's examples are written in C++, the creative problem-solving concepts they illustrate go beyond any particular language; in fact, they often reach outside the realm of computer science. As the most skillful programmers know, writing great code is a creative art—and the first step in creating your masterpiece is learning to Think Like a Programmer.
Disclaimer: I dropped this book after getting through the first 15% and just browsing till the end.
I didn't like that, because of the three assumptions that the author made while writing the book and I believe all of them are false:
1. Being better in solving logical puzzles (how to cross a river with a fox, goat, and a cabbage, etc.) makes you a better programmer. Personally, I'm pretty bad at those puzzle, but I'm a fairly successful programmer with 10 years of experience. I don't see how getting better at this kind of problems relates to any programming tasks I need to do.
2. C++ is a good language for teaching the book, because it's low-level and if you can understand C++, you can understand anything. My problem with that is that a) there are better low-level languages to use IF we want to use a low-level language for this task (for example Rust), b) using a low-level language and explaining pointers isn't the best way to introduce people to a programing mindset (which seems to be the aim of the book).
3. The autor seems to get from "I think like that" + "I'm a programmer" to "programmers think like that". I don't relate to the content in the book and I think lots of other people won't. Writing like this is the one and proper way of thinking for programmers will alienate those people (and me!).
the only part I didn't like was the reliance to C++ but it really doesn't matter the language over the way to approach programming. I liked programming's relationship to puzzles; it reminded of of when learning to play the card game Bridge my roommate (LPC) compared each Bridge hand as a Puzzle to solve. Good examples and good exercises that where not just busywork homework. Thanks.
As a person who makes her living writing code, I've found this book rather disappointing. I read it hoping to extract some lessons to improve my code writing and looking for fresh ideas and points of view to enrich my workflow. What I found was a patronizing piece written for first-year college students. The author is so full of himself that extracting any lesson is quite difficult, for his attitude towards the reader is constantly that of a pissed teacher. I'm a grown-up and I find this way of communicating ineffective. About the contents of the book, probably I would have enjoyed it some more if I had chosen the Python edition. Nevertheless, I have to admit that this book is a pretty good way to get in touch with C++ programming if you're not familiar with it, which is my case. The book proposes a good deal of problems that don't seem totally real-world-worthy, but clearly have some interesting lessons for anyone who has to deal with Objects in their programming life. The problems are too academic and I didn't feel that they would help me to be better at my job, but if one day I really needed to learn C++, probably these problems would be my starting point. They are good programmer-workout. In the end, unfortunately, reading this book took more effort than it brought satisfaction. Some parts are quite repetitive and the language even feels childish. Clearly, this is not the kind of book that you need to read if you're already out there writing code. But probably this is not a bad text-book for those beggining their path in Computer Science.
It's an okay book & one I certainly wish it was available to me maybe 15 years ago! Not only is it a stealth introduction to computer science it's a good primer for C/C++. The initial style is a bit whacky and slightly lowbrow but the author seems to calm down and be more readable as the book progresses. However, his persistent admonishments to 'do the practice' at the start of each and every 'Excercises' section jars against the overall friendly tone. The Chapters on recursion are the best of the book along with last chapter which examines the strengths and weaknesses of us as programmers and how we program which is very helpful for developing personal insight - an oft overlooked aspect of learning to think like a programmer. So overall? Well worth a read but with some passing comment about the new pointer RAII features of C++11/14 might help update it a bit - not that it should in any way replace the discussion about raw pointers as personally I think this is very important.
My college did a decent job of training computer majors to be problem solvers. This book would have made an excellent companion text to instruction on data structures and algorithms.
The author recommends knowledge of or simultaneous study of C++. I feel it would be accessible to any programmer in the C language family. Programmers in other languages could also obtain some benefit, but understanding would be a harder climb.
Sure wish my workplace had allowed the luxury of studying a language before building production applications with it. Some of the author's recommendations in the last chapter are not always within the working programmer's control. The difference between academia and the rest of the world.
All in all, well written, good use of examples, and sensible exercises to put the concepts into practice.
Not a programmer but probably because I'm intuitive so I feel like the book provides a very good framework to tackle problems by starting to think like a programmer. I find the provided framework very similar to the problem-solving framework in any other professional. The author chose C++ as the language to write all the sample problems and solutions in the book.
I really enjoyed reading and learning from this book! The topics covered are core knowledge to any programmer, explained well, in an excellent sequence. As stated in the prerequisite section in the introduction: "This book assumes you are already familiar with the basic syntax and semantics of C++ language and that you have begun writing programs".
It should go without saying that this book is most of benefit to someone who is a computer programmer, and especially someone who is skilled enough at C++ to do the exercises in this book. I must admit that I am not the ideal person for this book, not having that sort of programming basis, something that the author repeatedly comments on, such as when he pokes the reader saying: "I'm not kidding about doing the exercises. You're not just reading the chapters and moving on, are you (109)?" about halfway through the text. No doubt there are many readers of this book like myself who did precisely that, but hopefully there are at least a few readers who can program who take this book to heart because it has a lot to say that is very worthwhile and deserves to be taken as seriously as the author intends it. This is, in fact, the sort of work that should be a part of introductory courses on computer programming that involve teaching C++ as a companion to the work of learning the programming language itself, largely because its approach is solid when it comes to learning how to solve problems and develop the mental discipline and tools of the trade to become a skilled programmer. If I am not such a person myself, at least I seek to appreciate a job well done when I find it [1].
The contents of this excellent and modestly sized (220 pages or so) book are organized in a thoughtful and disciplined way, as would be expected. After some acknowledgements and an introduction, the author begins by looking at strategies for problem solving that help someone transition from being merely a coder to being a genuine programmer. Then the author looks at pure puzzles, like sudoku, and how they are solved using various strategies that can then be applied to novel phenomena. After this the author discusses ways to solve puzzles with arrays, and then pointers and dynamic memory, and then classes, recursion, and the smart re-use of code by others, before closing with some overall thoughts and comments on how to think like a programmer. Each chapter closes with exercises that the author is very concerned that readers actually try out and work to solve, and the topics get progressively harder as the book goes on, to the point where someone ought to be a fairly expert programmer if he or she has taken the book seriously enough. This is not a book to breeze through, but rather one to take seriously and gradually.
So, having established that this book is most of use to someone who is learning or already at least somewhat skilled in programming in C++, what insights can someone gain from this book if they are not particularly skilled at programming. Fortunately, many of the insights of this book are modular and applicable far outside programming. For one, a great deal of success in life depends on being able to solve problems without getting frustrated or despondent about them. Likewise, a great deal of problems in life are modular in fashion and easier to deal with when appropriately divided and handled in isolation and in a certain sequential order. Also, learning how to solve some problems improves one's skill set for other problems. The author also makes sound points on knowing one's personal patterns and tendencies and not seeking to rely on people working against them, but rather working with them in some fashion by prompting conscious thought and reflection. There is a lot to appreciate on this book on every level, and not just as a practical guide to computer programming, but also as someone who thinks about problem solving on wider levels.
This has been a complicated read for me. I started not long after I started taking an online Udemy course in C++. For anyone interested in the book, C++ is the language used for examples. I would say that you need at least a little knowledge of the language and a bit more knowledge of using object-oriented programming. I was weak in both when I started.
So, I took a long time to get engaged with the material and make headway in reading. I did learn from what I read, but didn't get all of the references. Now, several months later, I've finished a college course in Python programming, which formally introduced me to OO programming. Now, I've jumped in and am getting much more out of the reading.
This book has some creative and strong examples of good and best practices. Some are situational; some are preferential. I have to say that the last chapter and it's example of a cheating computer game were very valuable in bringing the concepts together. And with the knowledge I've gained from my classes, I believe I am better capable of using that knowledge to improve my skills.
This book is a lot of fun, but not a serious reference to develop concrete problem solving skills. Its problems are simple, and though they are often fundamental problems in Computer Science that most undergraduate students would be introduced to, it tackles the simplest examples and implementations possible.
This book would be a great read for younger children interested in programming, problem solving and computer science as large, but is not a great reference (I doubt it was aimed to be) for developers or scientists aiming to improve in a serious way. It contains lots of pictures and diagrams aimed to help the reader understand the concepts, and the programming examples are well commented and easy to understand.
I haven't finished reading this book yet, I don't want to read it anymore. In the beginning, I thought this book only concentrated on the way how to think like a programmer. But after reading this book, I found this book focus too much on C++. That is not easy to follow for me and other people who don't know knowledge about C++.
Несмотря на слегка наивное название, книга сочетает в себе несколько очень интересных кейсов в решении логических задач (Problem Solving). реализация алгоритма Луна (Luhn), шифрование текста и использование динамической памяти.
Good points, but it can be reduced to about 50 pages.
It will explain some simple and basic problem-solving styles or principles by giving some exercises you can resolve before seeing the solution and explanation.
First few chapters started promisingly but the 2/3 rest of the book did not fulfil my expectations. I recommend the first part of the book the rest up to you
I'll divide the contents of the book into categories Processes, Exercises, and Knowledge.
The processes outlined in the book are pretty good. Surely by employing these, anyone may solve problems presented to them of any complexity where the solver is aware of the necessary tools. However, they are very general, usually obvious, and maybe helpful only for the most inexperienced of programmers.
Edit to add: The last two chapters of the book are very very good.
The exercises in the book make for a good workout, regardless of skill level. I've never programmed in C++, so I opted to translate them to Rust as I went, which unfortunately meant many of the exercises would become exercises in futility, as ergonomic Rust can be fundamentally incompatible with the goals of many exercises. Still, the ones I was able to do were good practice, and the ones I wasn't I could draw out on paper just as well. I was even able to use the exercises in the chapter on Classes and OOP as an opportunity to practice Structs-of-Arrays patterns and Data-Oriented Design.
The knowledge in this book was truly disappointing. It was generally good at first, working as a nice and easy, but non-comprehensive, introduction to C++. I feel like I was able to understand the code presented well and it introduced things in a very digestible way (granted I have experience with the same concepts in other languages). But, as it went on, it became more like that one teacher you have in school who just has opinions on things and teaches those instead of the whole thing.
A good example of this would be the chapter on recursion. Recursion is important, and the book does well in explaining recursion and how to think about it. However, even though it goes over head and tail recursion, it opts to omit information about technical reasons you might choose one over the other, like Tail Call Elimination, and instead tells you to prefer head recursion because it looks nicer. The author even goes as far as to make an example of the same function using head and tail recursion, and the tail recursive function is unnaturally complex; he then concludes that tail recursion is worse because of how much more complex it is-- OBVIOUSLY, because you made it more complex than it needed to be. I have to assume the author just doesn't know about TCE, because he goes on to talk about how Recursive functions always incur a stack/function call setup cost to operate. Throughout the book, there are many cases like this where I cannot tell if this comes from a strong opinion about code style or if the author genuinely doesn't understand these underlying technical aspects of structure and optimization.
Finally, it includes knowledge related to various problems and data structures and algorithms that you're likely to use as a programmer and certain to see in Leetcode. This is good, and it could definitely be a good book for someone who's confident with very basic coding problems and looking to start with Leetcode and Data Structures/Algorithms. It's just hard to recommend given the issues above.
This book focuses on developing problem-solving skills in programming, emphasizing logical thinking and creativity over just learning syntax.
Main Points:
1. The Mindset of a Programmer • Programming is problem-solving, not just writing code. • Breaking down problems into smaller, manageable parts is key. • Failure is part of the process—debugging and refining solutions are essential.
2. Strategies for Problem Solving • Understand the problem deeply before coding. • Use analogies from real life to simplify complex problems. • Work through a problem step by step, starting with a basic version. • Look for patterns in problems you’ve solved before.
3. Decomposing Problems into Smaller Parts • Large problems should be broken into smaller subproblems. • Functions, recursion, and modular programming help in structuring solutions. • Think in terms of inputs, outputs, and processes.
4. The Role of Constraints and Edge Cases • Good programmers consider all possible inputs, including edge cases. • Test-driven development (TDD) can help structure problem-solving. • Handling errors and exceptions is part of writing robust code.
5. Working with Data Structures • Knowing arrays, linked lists, stacks, and trees helps in efficient problem-solving. • The right data structure can simplify a problem significantly.
6. Thinking Recursively • Recursion is a key problem-solving tool, but it requires a base case and proper planning. • Many complex problems (like tree traversal) are best solved recursively.
7. Debugging and Troubleshooting • Debug systematically, focusing on what is happening vs. what should happen. • Use print statements, debuggers, and logging to trace errors. • Read error messages carefully—they often contain hints to the solution.
8. The Importance of Practice and Persistence • Thinking like a programmer is a skill—it requires practice. • Work on challenging problems (like puzzles, coding challenges) to improve. • Learn from other programmers’ solutions and analyze different approaches.
Final Takeaway:
Thinking like a programmer is about breaking down problems, recognizing patterns, and applying logical reasoning to find solutions. The key to mastering programming isn’t memorizing syntax but developing strong problem-solving skills.
First, despite the fact that the author claims that all the examples in this text are coded using C++, they are not. They are coded in An Ancient Evil often referred to as C/C++.
Secondly, with great difficulty I have pushed through all the boring puzzle solving stuff in the first two chapters only to find out that the author does not even know how to write a simple while loop. At p. 58 in Chapter 3 the author writes a code to search an array to find the location of a specific value. See, in the while loop in this code excerpt the second condition that asserts that the index is not out-of-bounds yet should be the first one. You have to check first the the index is still valid and only then access the array at the index location, not other way around. And this pattern is so basic in programming, that the fact that the author did such a silly mistake is a show-stopper for me.
If only С++ was used for coding the examples and std::vector was used instead of C-style array... Yeah, I know that std::vector::operator[] is designed to be efficient, and thus, the Standard does not require that it performs bounds checking. But the Standard does not forbid it either, so in reality in debug mode a lot of implementations do bounds checking. Plus, a std::vector also has the at() member function which is guaranteed to perform bounds-checking. Just in case if you don't know how to write basic loops.
this was a great book. I am a developer and it did improve my day to day thinking on my tasks. if you are in doubt I would highly suggest to read the section "General Problem-Solving Techniques" at the very least.
Author is doing a good job at categorizing general steps to approach, analyze and solve problems. Later in the book we see how these methods are applied in a wide range of puzzles and programming tasks.
I saw negative comments about; example puzzles and choice of language being c++. I think both these are quite weak points. Book doesn't just ask puzzles, we are shown a very detailed way to think about solutions and nature of given puzzles themselves, which I find useful at improving my perspective while working on real tasks. use of c++ is OK, and if you know basic programming ie loops, control structures, arrays, pointers and some data structures you would be good. there is no big investments in c++ needed to follow the book and benefit from it. I wanted to mention these because I think some of the reviews are quite harsh and missing a lot of good things this book offers.
To sum it up this book is offering powerful and easy to understand ways to approach problems and how to solve them with programming.
This book I found while browsing Reddit and was recommended by many. It teaches problem solving skills that are essential when programming by helping to develop the mindset needed to break down complex problems, think logically, and implement creative solutions.
The book has a nice structure that eases the reader into more complex topics by providing a good background on the general strategies of problem solving before diving into the more specific tools. The author does a very good job of explaining the general strategies and gives excellent examples of the methods taught.
However, I do feel that the more specific strategies became convoluted as the examples developed, making them a bit more difficult to follow. At times, I found my engagement drifting. This might be due to my limited knowledge of C++, which, in fairness, the author gives a disclaimer about. Despite this, I managed to follow the book in its entirety and believe that any reader could as long as they have a strong understanding of data structures and algorithms.
Overall, I would recommend this book, though for the more complex strategies, I would definitely recommend having a solid understanding of C++ before reading it, just to make it easier to follow.
كتاب Think Like a Programmer: كتاب لأي شخص بيحاول يبني مهارة حل المشكلات.
الكتاب موجهة لشخص مبتدأ عارف ال basic syntax بتاع لغة وهنا الكاتب استخدم C++ ولكن الكتاب مبيحتاجش أي معرفة عميقة باللغة لأن هدفه مش اللغة على قد ما هدفه هو بناء مهارة التفكير في حل المشكلات واللي فعلا أصعب من اللغات أو الأدوات نفسها.
بيبدأ الكتاب في أنه يطرح شوية ألغاز شائعة - زي اللغز الخاص بالمزارع اللي عنده بطة و وذرة و ثعلب و عاوز ينقلهم للبر الثاني - مع إختلاف النسخ بين الثقافات للغز ده، وبيحاول أنه يشتغل على طرق تساعدك في أنك تفكر في حل للمشكلة دي، بعد كده بيدخل في مسائل برمجية و بيحاول معاك أنه يبسط المسألة لأبسط شكل ممكن عشان يسهل عليك إيجاد الحل.
الكتاب مش مهتم أنه يعلمك patterns أو techniques شائعة لحل المشكلات - على الرغم من أنه في آخر فصل أشار لأهمية أنك تتعلم ال patterns و ال techniques المختلفة اللي ممكن تسهل عليك، ولكن ده مش موضوع الكتاب الرئيسي - ولكن الكتاب مهتم يخليك تطور أسلوبك في التفكير في مشكلة و حلها في ظل وجود قيود على الحل.
لو بتحضر ل competitive programming contests الكتاب في حد ذاته كويس ﻷنك تحل مشاكل في العموم ولكن في حالتك محتاج أنك تذاكر حاجات تانية أنسب للحالة بتاعتك لو عندك وقت ممكن تأخذ الكتاب كبداية وبعد كده تتعلم المهارات التانية اللي هتحتاجها في النوع ده من المسابقات.
الكتاب ممتاز جدا لشخص لسه مبتدأ أو شخص بيشرح problem solving لمبتدئين.
A much lighter read than "Cracking the Coding Interview" or "Programming Interviews Exposed." I remember buying a physical copy because I was captivated by its title. Strolling through the pages before I spent time reading it made me curious enough to read and solve the problems.
C++ is used throughout the book, making it a very approachable read for anyone. Due to its less lengthy contents, you can't expect solutions and explanations to every question.
So, what's the purpose of the book? Is it an interview preparation book? It can be. As the introduction describes it, paraphrased by me: "A book to help others learn how to systematically problem solve, instead of using the trial and error approach."
Its 4 rating is due to the fact that it could be much more concise. A lot of text, such as reading two passages describing the problem, is too much. Perhaps the practices of the "Elements of Style" book could be applied more pragmatically, making the content more concise and an easier read. :))
I’ve been coding for 6 years. I always struggle at solving problems, or even getting projects started. I always strive for perfection, but this book highlights that really you don’t need to be perfect or an expert. You can come up with a solution and move forward, then learn new techniques and apply it to your previous solutions or projects. Programming is a work in progress. And you get better as you continuously challenge yourself and apply what you learn.
It is rare to come across an author who is really skilled at his craft and also understands his audience at the same time. This book is crafted by one such author and is a rare gem. The explanation and the level of details/insights provided for each topic is astounding. This book is an eye opener for many CS concepts and should be included in every higher CS degree’s curriculum. Highly recommended for all programmers and those who want to be one out there.
This book is not really an introduction to creative problem solving. It's just a regular introduction to problem solving with c++. There was some fairly interesting points on the mindset you should be in while facing some programming challenges, but i was expecting a lot more. The problems in the chapters were pretty uninteresting and 80% of the exercises are just the author telling you to come up with you own exercises.
A really well-written book for someone with a foundation algorithms and data structures. The information is presented in a structured manner, there are plenty of examples, and clear explanations are given throughout. Highly recommended for anyone who's acquired basic knowledge of a C-like language and would like to know more.
Absolutely brilliant! Would recommend this book to anyone starting to learn programming, and anyone who is self-taught or just wants to practice algorithmic thinking. The way the author teaches programming in this book is unlike any other I've come across. And it's timeless - the lessons in this book will apply even 10 years later.
I found it funny because this book used C++ programming language for all its examples, which I'm not really familiar with. Now that I finished this book, I'm grateful that I didn't just learn new language, but also much larger concepts
I recommend this book for both new learners like me and veterans alike.
Although in the second half of the book majority of the problems involve object-oriented programming and other important elements it discusses the most important part of any scientific project: problem-solving skills.
There are also exercises at the end of each chapter that would test out the reader's capability.
This entire review has been hidden because of spoilers.
- found some pieces of useful advice that resonated/introduced new perspectives to my current knowledge in each chapter. - All in all would recommend it to a programmer in the making. - it's an easy read. - problems are not so difficult.
This book gives a clear and concise overview of how to start applying beginning programming projects to real-world problems. I really appreciated the author’s use of humor and multiple examples per chapter.