The other day, I noticed that an article I wrote in August, entitled “Think Like a Programmer”, has been quite popular recently. This makes me happy, because it is one of the points of Khan Academy that I am most passionate about. The idea behind the article is that when you approach programming from a certain perspective, it can be easy to think of your computer as a magic machine that reacts to all sorts of incantations in wonderfully unexpected ways. But if you begin thinking of programming like a problem-solving activity, it starts to become much more intuitive and less mysterious.
I believe this way of thinking about programming is especially important for people who are just starting out with coding or learning a new language. Once you have learned the basics of coding and can write programs to solve specific problems, you have already won half the battle.
So why is this way of thinking so important? Well, let’s say you fall into the trap of thinking that computers are magical machines that respond to your code in unpredictable ways. In this case, when you encounter errors in your programs (which will happen all the time), it is easy to get frustrated and feel like there is no way to deal with them. But if you view coding as a form of problem solving
People ask me all the time about how I approach programming, and how I would recommend others approach it. A lot of this has to do with the fact that I’ve been programming professionally for years. As a result, many people assume that my approach is going to be incredibly complex – and they usually end up being disappointed when they find out that it’s not.
In truth, I think the best way to approach programming is to “Think Like a Programmer”, which is a concept that extends far beyond just writing code. The idea behind this concept is simple: programmers are problem solvers, not coders.
It’s an extremely important distinction, because if you think of programming as a process of writing code, then you’re always going to get stuck when you run into a problem. But if you can master the art of thinking like a programmer (or any type of problem solver), then you’ll be able to solve any problem with relative ease.
On a recent flight, I was watching a documentary on Rosalind Franklin, the scientist who helped discover the structure of DNA. The narrator mentioned that her contributions were not recognized during her lifetime because women were not allowed to join academic clubs at the time, and therefore she was excluded from the conversations that led to Watson and Crick’s discovery of the double helix structure of DNA.
It reminded me of a post by Eric Raymond titled “How To Become A Hacker,” which he ends by saying that programming is a meritocracy. If you know how to code, you will succeed. But it got me thinking – what exactly does it mean to know how to code?
When I say “know how to code,” I do not mean merely possessing technical skill; rather, I mean possessing the mindset required to be a programmer. And that’s what we teach at Khan Academy: programming is more than just typing in some syntax and getting a computer to spit out an answer. It is about understanding data structures, algorithms, user experience design, planning out your approach before writing any code, debugging, and deployment.
In order for us to truly teach students how to write programs, we need them to think like programmers. And thinking like a programmer means viewing programming from an entirely
Think Like A Programmer by V. Anton Spraul has been an interesting read so far. The book is not a reference manual, but more of an approach to solving problems in the context of computer programming. It is easy for a programmer to get caught up in writing code, and forget about the big picture. Spraul’s book is meant to help programmers focus on being creative and thinking logically.
Think Like A Programmer can be used as a textbook, or as a reference guide. There are four different parts to the book:
Thinking About Problem Solving
Essential Programming Techniques
Learning From Code Examples
Part 1 goes over how to become better at solving problems, and the difference between beginner, intermediate, and advanced programmers. Part 2 introduces some essential programming techniques like recursion and linked lists. Part 3 teaches you how to read other people’s code, which is essential when working in teams or open source projects. Finally, part 4 gives you practice programming problems to solve.
A few years ago, I stumbled upon a blog post that would end up changing the way I think.
The post’s title, “Think Like a Programmer” by V. Anton Spraul, was intriguing enough, but it was the post’s content that resonated with me in a very deep way.
The blog post explores what it means to “think like a programmer” and the author argues that this type of thinking is fundamentally different from everyday problem solving. He presents several examples of problems he encountered throughout his life before he started programming and how his approach to solving those problems changed after he started programming.
The first example is something I’m sure many of us have experienced at one point or another while learning to program – trying to solve an algorithm problem without thinking like a programmer. The author starts by describing how he tried to find the solution to an algorithm problem without following the steps programmers often follow when solving algorithm problems:
1. Figure out what you’re trying to do
2. Break it down into simpler parts
3. Determine the relationships between those parts
4. Write code for each part individually and then put it all together
The author admits that he started out trying to solve the algorithm problem by just going straight for step four,
This guest blog post was written by a former member of the Khan Academy team, J. Robert King.
One thing I’ve learned in my career as a technical writer is that people tend to think like they write and not like they read. This is particularly true when programming. People tend to write code the way they write sentences, but not the way they interpret sentences.
This is why programming can be so frustrating. You write code, you interpret it differently than others do, and you get bugs that are hard to find or errors that are hard to explain.
Most people think of computer programming as a solitary activity. The programmer sits in front of his computer, writes code, and the next thing you know he has a working program.
The image is not far from the truth. Programmers do mostly work alone. And yet there is something very different about programming than most other activities we might call work or hobbies. There are three things that set programmers apart from everyone else:
1) What they do is not an activity but an occupation; it’s what they get paid to do.
2) They solve problems in a very particular way: by writing code in a particular syntax. This is known as an algorithmic approach to problem solving and it’s very different from every other approach humans have ever used to solve problems.
3) They are trained and rewarded for their ability to ignore their own feelings about the problems they solve, even if those problems affect people in a deeply personal way such as: how much prison time someone gets or whether or not someone will be approved for a loan by the bank.