I’ve talked about how problem solving is an intensely important skill for programmers. I don’t think that’s a controversial statement. Most programmers understand that to some extent or another, problem solving is a key part of programming.
Yet so many students continue to learn problem solving incorrectly. Why is that?
Let’s use an analogy, because it ain’t a blog post without a contrived analogy. Let’s use weight lifting. I don’t know a lot about it. But I do know enough to say this:
When you lift weights, you need to lift the weights on your own.
That seems like a no-brainer, right? If your trainer lifts the weights, you’re not gaining anything. The same is true in programming. Watching someone solve problems is no replacement for solving problems on your own.
In weight lifting there’s this moment where you’re straining against the weight, pushing with all of your effort, and eventually the weight gives way. When you’re first starting out, this is surprisingly hard. You could be a decently strong person in your day to day life, but the first few times you do a bench press, it’ll be hard. This isn’t because you’re weak, it’s simply because you’ve never used these muscles in this particular combination.
This is also true in problem solving. The first few problems you solve will be hard. They will be painful. You’ll be pushing against what appears to be an immovable object. But eventually, with enough effort and enough time, the object will move.
In weight lifting, beginners will often go through a phase called beginner gains, where they quickly get better. This isn’t because they’re magically gaining muscles. They’re just getting better at using the muscles they already have.
The same is true with problem solving. You already have the machinery to solve problems in your head. You just need to get better at using it. Specifically, when you start to feel that strain of pushing against the immovable object, you should see that as a good sign. Too many students encounter the obstacle and give up. They look at the solution, letting someone else lift the weights.
It’s not that watching people lift weights/solve problems is bad. Sometimes you need to do a little bit of watching to understand the technique. If I was learning how to do a deadlift, I’d watch a few times.
But too many students try to substitute watching people solve problems for solving problems. They’ll read textbooks or watch lectures. They’ll go to study sessions and listen to a classmate solve a problem. They’ll go to office hours and have the professor solve the problem. Again, none of these are necessarily bad. But they’re not the same as solving problems.
And when it comes to make or break situations like a tough exam or a challenging lab, the students aren’t used to that feeling of straining against the bar. They’ll see others tackling the problems and surmise that the others are simply smarter or more talented. That’s not true. The others are just practicing properly. They understand the technique.
What’s dangerous about problem solving versus weight lifting is that it’s super easy to watch people solve problems and think you’re learning. Nobody watches people lift weights and thinks it’ll make them a better weight lifter. Yet so many people watch people solve problems and think it’ll make them a better problem solver.
However what’s wonderful about problem solving is that it’s very easy to accidentally practice. If you work on a side project that’s fun, or if you start interviewing for companies, or start learning math, you’ll practice problem solving. I didn’t set out to do well in my CS classes. I’ve just spent hours banging my head against NGINX configs, or teaching myself Ruby or figuring out how AWS works. And yet my problem solving skills improved from all of those.
If there’s one big divide between CS majors, it’s those who practice problem solving and those who practice watching other people solve problems.