How to Think Like a Computer Scientist

Smitha Nagar

Now, I know what you’re thinking. “How can you possibly tell me how to think like a computer scientist?” The whole point of thinking is to come up with your own, original thoughts. And you’re right. I can’t tell you how to think, and I definitely do not want to – people come up with unique ideas because of their individual thought processes. What I can do is explain methods to help you see important connections that you previously could not see.

 

Coding is all about problem solving, and sadly, as I’m sure you all know (I certainly do), the solution is rarely easy to find.  You’re often required to find that one algorithm that never occurred to you right away. I personally don’t like the phrase “think outside the box,” because it has been overused by teachers, professors, employers, and everyone in between. You can’t think outside the box, because that implies that your mind is a box: closed off from its surroundings and unchanging. This is far from the truth, because your mind is constantly adapting to your experiences and environment. Instead, think of your mind as a book filled with pages of connect-the-dots, except the dots aren’t numbered – they’re unlabeled and floating free, and it’s your job to decide how you want to connect the dots. The easy way would be to just connect dots that are next to each other, and end up drawing a snaked line, but this probably isn’t the end picture you’re looking for.

So how do you figure out which dots to connect? How do you find that algorithm that results in the big picture? Here are three simple tips:

  1. Find out what you’re trying to draw.

What exactly are you trying to do? What is the answer you’re trying to find? Too many times enthusiastic coders start right away without thinking about what the end result should be, and they end up coding something slightly (or drastically) different from what they had originally intended to code.

  1. Focus on drawing one line at a time.

Break up the problem into smaller parts that you can think about without getting scared and bursting into tears. (Ok, maybe you won’t do this regardless, but it’s still helpful.) Once you have it all divvied up, it’ll be much easier for you to think about each of the pieces and solve them individually.

  1. Don’t start in the middle of all the dots.

Try to start at one end of the problem, whether that’s the very last or first part. If you can figure out the pattern when there’s only one argument, you can probably build on that to figure it out when there are two.

“Ok, ok,” you’re probably thinking. “But seriously, how do I think like a computer scientist?” You already are! You’re fully equipped with your enthusiasm to code and your book of connect-the-dots. Now all you need to do is apply those three tips and you’ll be solving problems like a pro. Try thinking about those three methods when you look at this puzzle. Can you think through the problem like a computer scientist?

problem

Leave a comment