Think Like a Programmer and over 2 million other books are available for Amazon Kindle . Learn more
£15.14
  • RRP: £23.50
  • You Save: £8.36 (36%)
FREE Delivery in the UK.
Only 3 left in stock (more on the way).
Dispatched from and sold by Amazon.
Gift-wrap available.
Quantity:1
Think Like a Programmer: ... has been added to your Basket
Trade in your item
Get a £7.08
Gift Card.
Have one to sell?
Flip to back Flip to front
Listen Playing... Paused   You're listening to a sample of the Audible audio edition.
Learn more
See all 2 images

Think Like a Programmer: An Introduction to Creative Problem Solving Paperback – 11 Aug 2012


See all 2 formats and editions Hide other formats and editions
Amazon Price New from Used from
Kindle Edition
"Please retry"
Paperback
"Please retry"
£15.14
£13.03 £17.74
£15.14 FREE Delivery in the UK. Only 3 left in stock (more on the way). Dispatched from and sold by Amazon. Gift-wrap available.

Frequently Bought Together

Think Like a Programmer: An Introduction to Creative Problem Solving + C++ Pocket Reference
Price For Both: £21.13

Buy the selected items together


Trade In this Item for up to £7.08
Trade in Think Like a Programmer: An Introduction to Creative Problem Solving for an Amazon Gift Card of up to £7.08, which you can then spend on millions of items across the site. Trade-in values may vary (terms apply). Learn more

Product details

  • Paperback: 256 pages
  • Publisher: No Starch Press; 1 edition (11 Aug. 2012)
  • Language: English
  • ISBN-10: 1593274246
  • ISBN-13: 978-1593274245
  • Product Dimensions: 17.8 x 2.8 x 22.9 cm
  • Average Customer Review: 4.5 out of 5 stars  See all reviews (2 customer reviews)
  • Amazon Bestsellers Rank: 67,366 in Books (See Top 100 in Books)
  • See Complete Table of Contents

More About the Author

Discover books, learn about writers, and more.

Product Description

About the Author

V. Anton Spraul has taught introductory programming and computer science for more than 15 years. This book is a distillation of the techniques he has used and honed over many one-on-one sessions with struggling programers. He is also the author of Computer Science Made Simple (Broadway).


Inside This Book (Learn More)
Browse Sample Pages
Front Cover | Copyright | Table of Contents | Excerpt | Index | Back Cover
Search inside this book:

Customer Reviews

4.5 out of 5 stars
5 star
1
4 star
1
3 star
0
2 star
0
1 star
0
See both customer reviews
Share your thoughts with other customers

Most Helpful Customer Reviews

5 of 5 people found the following review helpful By Amazon Customer on 19 Aug. 2012
Format: Paperback
I have read a great many programming books, but they are mostly about syntax and design. This is the first book I have read that has helped me with the most important skill in programming. There is no born ability to be a good programmer; it takes practice. This book will give you plenty of practice with well paced problems that increase in difficulty steadily. Actually solving the problems yourself is important; it's the only way to learn to problem solve and you will find your confidence increase as you work through more. The explanations and learning outcomes after each problem are also excellent. I felt I had a guide in the room with me. Probably the best computer book I have owned and I have over 50.
This book should be required reading on University courses. Many University courses these days seem to just teach you syntax of a particular programming language and a lot of courses are just Java training camps. I have interviewed many graduates who have excellent knowledge of Java syntax but have little idea on how to think through problems and come up with solutions.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
2 of 3 people found the following review helpful By Andy on 7 Sept. 2012
Format: Paperback
V. Anton Spraul is an experienced computer science teacher and has taught introductory programming and computer science for more than 15 years.

The goal of this book is to teach you the creative Part of programming. It's target audience are clearly beginners who "struggle to write programs, even though you think you understand programming languages."
You should be familiar with at least one Programming language (it doesn't have to be c++).

The book starts with some general problem solving techniques (e. g. always have a plan, divide and conquer) and explains them on some general puzzles.
In later chapters Problems will be solved with specific programming concepts like Arrays, pointers, dynamic memory and recursion.

You might be disappointed because Spraul doesn't give any answers to the exercises but as Spraul states at the beginning of the book you should see them as opportunities to apply the concepts described in the chapters.

The exercises are coded in c++ but the book is not specifically about c++. Most chapters start with a short review of the used concepts in c++.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again

Most Helpful Customer Reviews on Amazon.com (beta)

Amazon.com: 29 reviews
34 of 36 people found the following review helpful
I'd make this a required book for starting CS students 8 Oct. 2012
By William Springer - Published on Amazon.com
Format: Paperback
While I was working on my PhD in computer science, part of my job as a TA was to run the computer lab. I never cared for Java, but I learned enough of it to be able to help the undergraduates when they got stuck working on their homework assignments.

What struck me is that often the undergrads know more Java than I did; their problem was that they didn't understand how to solve problems. Once I walked them through the process of designing a solution, then they could write the program. When I interviewed at Microsoft, the interviewer said the same thing: that many of the people he had talked to were not able to even answer the first interview question (which required figuring out a solution to a problem and then coding it).

As such, it's no surprise that I was happy to see this book, with its promise of helping people understand how to solve problems rather than simply how to write code. The first chapter immediately dives in to solving some logic puzzles; while these aren't computer related (and some are classic problems that everyone knows) they get the point across that programming is about solving problems. The actual language is secondary; what's important is being able to break the problem down to the relevant information and figure out a way to solve it. Once you have an approach that allows you to tackle the problem, then you can figure out how to do each individual step.

Chapter two switches to solving problems using C++, rather than generic logic puzzles, and then we're off and running. We follow that with one chapter each on solving problems using arrays, pointers and dynamic memory, classes, recursion, and code reuse. Finally we have a chapter about working to your strengths as a programmer to find solutions efficiently.

For the most part, I enjoyed the book. There are a few places where it seems that the author made a change to a problem or assumption and then didn't fix later text that referred to the original version; for example, in chapter 5 the default constructor for a student object initializes grade to 0 and studentID to -1, but the following text refers to a possible error due to grade being initialized to zero. Except for a problem in chapter two where relevant information is introduced in the solution rather than the problem description, though, these don't detract too much from the reading.

At the end of each chapter is a list of simply-described programming problems that require you to thoroughly explore the concept covered in that chapter. Working through them all should take some time, but will probably be worth it; even as a working programmer, I'm tempted to go through all of them just to get a better handle on C++, which I rarely use.

The book assumes that the reader understands how to write a program with C++, but everything except the absolute basics has a review at the start of the relevant chapter. I think this would be a very good text to use for a freshman course on programming, assuming you can find one these days that still uses C++ rather than Java! (Although for the most part, the concepts apply to any language, so you could use it with Java anyway.) Having read this, a novice programmer should be much better equipped to break down a problem and get to work, rather than staring at the description wondering where to start.

I give this 4.5 stars due to the errors mentioned above, which rounds up to five for a highly recommended book.

Disclosure: I received a free review copy of this book for Vulcan Ears Book Reviews (vulcanears.com).
29 of 32 people found the following review helpful
Ask Felgall - Book Review 11 Aug. 2012
By Stephen Chapman - Published on Amazon.com
Format: Paperback
One thing I have noticed over the years is that at least 95% of programmers spend a long time writing what ought to be relatively simple code and that they usually end up with a lot more code than they really needed. The problem is that these programmers have only learnt half of what they really need to know in order to be able to write programs - the programming language itself. The other half of programming is a creative process that is not taught in most programming classes and which in part is a talent that can't be taught.

This book sets out to teach the part of the creative part of programming that can be taught to those who don't have the talent of visualising solutions to complex problems. Anyone who uses the techniques taught in this book will eventually find their way into that top 5% of programmers who can write good solutions to complex programming problems. As they use creative problem solving to produce more effective code their programming ability will improve even though they may have no greater understanding of the particular programming language syntax than they did at the start.

While just about everything in this book seemed trivial and obvious to me (but then I'm not part of the target audience for the book), experience has shown me that such things are seldom either trivial or obvious to most other programmers and I have not previously seen any resource that explains these processes as clearly as this book does. This is definitely a book that I would use in teaching programming to others,

The author has chosen C++ as the language used for the solutions to the various problems the book uses to demonstrate the problem solving process. This is a good choice because many modern languages use a similar syntax so that those who don't know C++ should still be able to understand what the code does well enough to be able to implement an equivalent in a language that they do know. The book also has several chapters that deal with the types of problems that are those most likely to cause problems for those programmers who don't really understand creative problem solving. Those are the ones where there are many solutions that will sort of work but which are either require many times as much code or will be extremely inefficient of both.

Those teaching computer programming no longer have an excuse for only teaching the students half of what they need to know to be good programmers. They should all now be adding an extra subject to their course to teach the other half using this book as the class text.
22 of 24 people found the following review helpful
Getting past "blank page, what do I do?!" 19 Nov. 2012
By Michael Larsen - Published on Amazon.com
Format: Paperback
I recently read Andy Hunt and Dave Thomas' "The Pragmatic Programmer". I thought to myself that it was interesting to see this book from the perspective of 13 years later and what was still being practiced actively and where we may have moved on, as well as the suggestions they made to be effective and, yes, pragmatic programmers.

To book end this experience, I wanted to look at another title that was in a similar vein, but much more recent, as in this title was released just a few months ago. This book, V. Anton Spraul's "Think Like a Programmer", covers much of the same ground as "The Pragmatic Programmer", but does so with a much narrower scope. While "The Pragmatic Programmer" looked to focus on many different aspects of being effective, "Think Like a Programmer" puts the bulk of its energy on one issue; problem solving and the tools necessary to approach problems and develop solutions. The goal of this book is to help answer that age old challenge... I understand the syntax, I can read code, I can modify code, I can work with other people's code and understand what it's doing, but when I sit down in front of a blank editor, I'm lost!

"Think Like a Programmer" takes the reader down a number of paths to help explain some of programmings more challenging aspects and do so with generally basic coding structures. The entire book's examples are in C++, so there is a unity to the problems being presented. While the examples are in C++, all but a few of the problems could be ported to other languages like Java, Ruby, Python, etc.. The Chapter on pointers might be the sole exception, and the chapter on classes comes from the perspective of a language that can be used with both procedural and object oriented approaches.

Don't let the code intimidate you, especially if you are not a programmer by trade. I did enough C++ programming in college to recognize the structures and the methods used for the solutions, so there was nothing in the code itself that was terribly frightening or all that advanced. Beginners, or those who have never seen any C++ code, may feel a little lost in spots, but Anton takes the time to explain every line. The goal of the book is not to focus specifically on coding syntax, but on the problem solving domain. Getting good and usable code, that's a definite bonus, and he makes the case for doing all of the things that Andy and Dave talk about in "Practical Programmer".

The problems all use standard elements of the C++ programming language. Arrays, pointer, classes and recursion all get a chapter dedicated to their own issues. Problems are presented and a detailed breakdown as to how to go about solving them is shown. Each chapter has a variety of exercises to work through.

The last chapter focuses on allowing the programmer to devise their own game plan to solve problems, and each game plan will be unique to that particular programmer. Strengths and weaknesses are rarely the same, so making a "best practices" list for everyone would be pointless. Instead, Anton works the reader through methods and aspects that can help them create their own unique problem solving methodology, using all the tips and techniques practiced in the book, and leveraging their own individual strength, weaknesses, and areas of focus and interest. One thing to be aware of... there are no answers to the exercises provided. That's by design. the point to the exercises is to see what you would come up with, and help break the cycle of "blank page, I'm lost!"

Bottom Line:

Seasoned developers may find this a bit basic for their tastes. Rank beginners might find the examples intimidating. Those in between, even those who are not C++ programmers, will likely learn a good deal and help de-mystify a few areas by working through the examples and problems. As a tester, rather than a programmer, I think that these titles are helpful to look at the issues that programmers face, as well as the issues and methods used to solve problems. Since we have to test those solutions, understanding how programmers get there and the tools they use to get there is helpful. "Think Like a Programmer" is a solid step in helping both programmers and testers look at these situations in interesting ways.
14 of 16 people found the following review helpful
Good book for the right kind of reader 1 Nov. 2012
By Joseph Kong - Published on Amazon.com
Format: Paperback
I'll admit right away that I'm probably not the target audience for this book, because I'm not new to programming or problem solving. However, I know that whenever I revisit something like programming fundamentals, I learn something new.

In this review I'd like to highlight my favorite parts of Think Like a Programmer (TLAP).

On page 31 the following problem is presented: "Write a program that takes an identification number of arbitrary length and determines whether the number is valid under the Luhn formula. The program must process each character before reading the next one." I liked this problem because I've seen similar ones during job interviews. That is, ones that require you to process each character before reading the next one.

Chapter 5, "Solving Problems with Classes," was a good refresher for me as I haven't worked with classes in years. A person who programs with classes regularly may not find this chapter as useful. However, for a procedural programmer like myself, I rather liked it.

Chapter 6, "Solving Problems with Recursion," described recursion in a very clear manner. I was taught recursion in high school and again in undergrad and I don't recall it ever being explained this concisely.

Chapter 8, "Thinking Like a Programmer," is my favorite chapter because of the problem presented in it: Write a text-based version of hangman. The twist is that the program must cheat the player. I found this to be the most fun problem in the book. I rather enjoyed Spraul walking me through his methods in order to come up with a solution.

I subtracted one star from the overall rating for one reason: There are a number of errors in this book. Here are some examples.

On page 32 Spraul states "starting with the digit to the right of the check digit." There is nothing to the right of the check digit, he meant left.

On page 38 there is a line of code that reads "else checksum += 2 * (digit - '0');" This line doubles the numerical value of digit and adds that to checksum, which is the incorrect behavior as per the problem description. On page 31 the problem description states "if a doubled value now has two digits, add the digits individually." On page 37 (one page earlier) Spraul implements the correct behavior, so when I got to the code on page 38, I read it multiple times in order to make sure that I didn't miss something. I didn't, the code there is just incorrect.

On page 66 there is a sentence that reads "Therefore, we initialize it to 0 and not the value in location[0]." There is no variable named location in the code listing, Spraul meant histogram[0].

The errors in TLAP don't reduce the value of its contents, but I found them jarring.

In conclusion, while I would like the errors to be addressed in an errata or second edition, if you're new to programming or have trouble writing original programs you should check out this book.

Note: I have a pre-existing business relationship with No Starch Press. I've written two books for them. Also, they sent me a review copy of TLAP.
19 of 23 people found the following review helpful
Think Like a Programmer? How about think like a problem solver... 23 Nov. 2012
By Richard T. Kingslan - Published on Amazon.com
Format: Paperback
Programmers, like any other profession, use processes and procedures to write code. It's not so much the tools - which do add much to the programmer's abilities - but the knowledge of a few specific things that separate the novice from the guru:
* Intimate knowledge of how the expected behavior is designed (e.g. Engineering)
* Deep understanding of the underlying operating system, and in the case of client-server applications, how the tiers that support the server and client behaviors must be leveraged (e.g. Computer Science and Computer Research)
* Deep understanding of the libraries and supporting modules that are used (application programming interfaces, or APIs, for example) are used (e.g. Tools and Modules)
* Deep understanding of the underlying computer (e.g. Computer Engineering)

Finally, and probably the most important thing that separates the mediocre from the awesome:
* The ability to completely grasp the problem at hand and to devise methods to break the big problem down into a series of manageable and much easier to solve problems (e.g. Creative Problem Solving)

Make no mistake - it's not that the guru is better at writing code. That still might be true, but anyone can write code. Tools such as Microsoft's Visual Studio and the mass of collected knowledge could allow the novice to produce a program of significant merit. The difference is how efficient, how functional and how stable the finished product is. The difference between the novice and the guru - the novice typically flails around trying to iteratively get from A-Z, and produce an output with a given input. The guru, on the other hand, will most likely have a dozen self-contained little chunks of code (or libraries of things that he/she has used for years) that are put together in a methodical fashion to solve each small part of the bigger problem. The guru thinks about how to get from A to B, then B to C, and has a clear plan of how each chunk adds to the whole.

Every problem is a series of smaller problems, made up of a series of smaller challenges - until it has been deconstructed down to the smallest possible quiz. "How do I put 1 in front of 2 if presented with a randomized list of numbers 1 to 100?"

A long time ago a programmer friend of mine told me that all applications and programs are nothing more than a known input and an expected output. Each module in the program solves part of that problem. And, in a team atmosphere - and really, as much as the independent developer working on his own project - the only thing that the programmer needs to know is this:
* Given a specifically defined input or series of inputs to a program or a module, the required output or series of outputs (based on the inputs presented) is all that the other team members need to know to leverage or use that module.

Consider a common problem: You have a box of a 1000 documents that need to be put into alphabetic order. The input for the programmer is a random collection of things (the documents), and a required output of the collection in alphabetic order. Sounds simple, right? Actually, it is.

If you have a clearly defined input and a clearly defined output, all the programmer needs to do is then take the input, look at each document name, and sort it into the `box' starting with A and ending with Z (or, numbers first, last, or whatever the design calls for - but let's keep it simple - all alphas, and no numbers).
The REAL question, knowing these constraints, is how to accomplish the task quickly, efficiently, and accurately.

By and large, the entire book "Think Like a Programmer: An Introduction to Creative Problem Solving" is all about, "Sounds simple..." or, "Sounds really complex...". Just how do I do that? V. Anton Spraul takes the reader through case studies of relatively easy to fairly complex examples of problems. In my years of trying valiantly to become a better programmer (which, I'm a novice and hacker at best), I've yet to come across a better book that explains, example after example, how to think more about the problem and less about the actual code. The code is an outcome of a well thought out plan and understanding of the pieces of the puzzle. The examples used are gleaned from Spraul's years as an instructor and advisor to budding and professional programmers. And, they aren't all about coding problems. Most are real, day to day issues and problems that you need to think through. And, everyone has this ability to first define a problem, understand the constraints of the problem (nothing is truly undefinable, and every situation has some constraints; some more concrete than others) and devise steps to solve the problem. This could be as simple as our example of sorting documents (which is an extremely common thing in programming), or as complex as cataloging the entire human genome. Additionally, you learn that your plan will change as parts of the solution start to come together. Assumptions that you made early in the process will be superseded by new ideas as you work through the steps. Plans change - it's inevitable. Living and working with the changes, embracing them, and adjusting accordingly are good practice - not the outcome of poor initial planning. Plus, you learn not to marry yourself to any idea and that frustration in your tasks is the quickest and surest way to kill the creative juices. Getting frustrated? Get up... Walk away and go think about ANYTHING other than the problem at hand. Come back with a relaxed mind and look at the problem again. Ah! There's the solution! Yes, it does work - your mind needs to relax, too.

What Spraul does is to develop and build up your ability to recognize that all problems are better solved if you break it up into easier to comprehend chunks and to solve the problem piece by piece. And, there is no one solution that is perfect, no one section that is tacitly better than the other. For example, our 1000 documents could be sorted by putting the first document into our (imaginary) box, taking the second document and figuring out does it go alphabetically before or after the document that is already there? And, then repeat this process (albeit each subsequent trial of `where does this document go?) is a comparison of docsInBox + 1 for each trial. The first is easy, but comparing one doc with 999 others is a tad more complex. How do you make it simpler? Actually, it doesn't matter which process you like better. Some might create an index of all documents before even starting the sort and using that index to move the documents around, inserting one from position 53 to position 934, and so on. Or you could break it up into a sort of 250 documents, then sorting the final four buckets.

The only thing that ultimately matters is the outcome. Sure, there are performance concerns aplenty. But you can resolve performance issues once you figure out how to solve the original problem. The performance is just another problem.

Spraul talks about the problem solving methods using code, but code is not the aim of this book. Much like a Fitness guide, you start out with small steps, and eventually - given enough practice and building of your `mental muscles' you're a lean, mean problem solving machine.

If you are looking for a book on how to write a type, class, language, or other specifically "How do I write the code to solve for fusion power?", this is not your book. If you want techniques and to understand the real problem that most programmers face - how do I define a problem and break it up into something that is really manageable so that I CAN write code to address the fusion energy question, this is the book for you.

One thing is for sure: If you can critically analyze a problem and define it into steps, you will write better programs with much less frustration. And, "Thinking Like a Programmer" is a brain fitness guide for people who want to code more efficient programs, more complex programs, or who just want to learn how to do a much better job of defining complex problems into much easier to manage thoughts and steps.
Were these reviews helpful? Let us know


Feedback