Pineapple header

Problem Solving In Real Life: Part 1

by Omid Bachari

March 18, 2016

As programmers, getting stuck on a problem is normal. But how do we defend against it? How do we get out of it? Most people believe if they learn a finite set of skills, then they will be stuck less. Sounds pretty simple. 

It’s definitely easier said than done. Being stuck is not a perfectly rational state of mind where we can jot down some items on a checklist and figure it out. But that would make things a tad easier. Let me demonstrate what a common programming problem might look like—with only rationality at play. This programming problem has been converted into a relatable, fictional situation.

Rational pineapple finding:

I’m going through a barrel of fruit looking for a pineapple (using a tool called the pineapple finder). If I find one pineapple, I’m going to quit searching. I want to make a fruity salsa, and this is just the first step on the list.

Wait, I have a problem. The pineapple finder can’t seem to find a pineapple. It keeps going through the whole barrel and it comes up with nothing. Let me use my rational mind to make a list of the possible issues:

  1. Why do I expect to find a pineapple in the barrel in the first place?

  2. As the pineapple finder goes through the barrel, is it actually going through the fruits? Or is something getting in the way?

  3. What criteria does the pineapple finder use to determine that it has found a pineapple? Maybe it’s looking for the wrong thing.

  4. For a sanity check, if I intentionally place a pineapple in the barrel, and remove all the other fruit, will the pineapple finder find it?

In a perfect world, as we challenge ourselves with each question above, one of them would reveal a flaw or oversight. We discover our mistake and take steps to correct it. Voila. Solved.

Suppose we see unexpected results with number 4. We have a barrel with only one thing in it: a pineapple we intentionally stuck in there. And the pineapple finder doesn’t find it. We tinker with the criteria in number 3 until the finder is successful in that simplified case. Then, all other things being equal, we return to the real use case, and we find that we have solved the problem. Hooray! We are finding the pineapples.

When we retell the problem to our friends, that might be how we tell the story. Which is itself part of the problem. It sounds so damn simple, it can be discouraging. Real life is a lot murkier. 

IRL Pineapple Finding:

If the above scenario played out in real life, our pineapple finder has turned the barrel of fruit into cabbage juice and the barrel has a leak and I accidentally erased the pineapple finder. Also, the building is now on fire.

In reality, when we are confused, things are in a sloppier state. You don’t know how to contain the possible causes into a finite list. In fact, you probably begin troubleshooting unconsciously—changing the facts and clouding the waters—before you even realize that something is wrong. You start looking at the pineapple finder’s criteria. Half way through that, you start to investigate whether there is fruit in the barrel or not. Once you confirm there is fruit, you go back to the criteria, but you forgot what you were thinking—so, you punch a wall. Good luck finding the problem's origin now.

You might say we failed to solve the problem. Not so fast—I think there’s a really good chance that our intelligence and experience level are prepared to comprehend most problems. When I discover the root cause, it’s usually “move this here,” or “you thought you created A but you created B,” or “you haven’t turned it on.” The pineapple finder is no exception—the odds are that we aren’t going to come up against rocket science—we’re going to come up against a barrel and a piece of fruit.

It’s almost never: “Oh, the problem I am having is the core problem facing web development in this framework.” And it’s definitely not: “I can neither comprehend the problem I just had, nor the solution I just discovered.” Those moments may exist, but that’s not the majority of what gets us stuck. 

So we know that problem solving is possible (because we’re good enough and smart enough), yet we we get impossibly stuck sometimes. What is going on here? We did have a simple problem: to find a pineapple. But it just spiraled way out of control. 

How to keep problems from spiraling out of control

I think the competency of problem solving is what’s lacking clarity. If we envy great problem solvers, we may wonder, “What can I learn to be like that?” “Where do I get started?”

The Ancient Greeks may be able to shed light on things for us. Get ready to Google. In the dialogue Protagoras, Plato argues that virtue is knowledge. He means that being a good person is a matter of knowing what makes things good. And being a bad person means someone is missing knowledge. If only this murderer knew XYZ about his actions, he wouldn’t have killed that person. In practice, we can relate to this. “I’m sorry, I hurt you because I didn’t know...” 

This encourages the view that knowing more is the answer to being a better problem solver. Just read all the books and your days of getting stuck are over. 


(Sorry, Plato.)

Aristotle changed the game in his Nichomachean Ethics when he denied that being good was simply a matter of knowing what is good. Being good is not just about opening a book and reading about how to be a good person. Based on Plato’s view, as long as people know what’s right, it’s impossible for them to be a bad person.  

Aristotle believed knowledge and virtue were not related that way. Being bad intentionally and knowingly are possible. Aristotle believed being good is about habit. You have to develop the habit of being good. Which makes virtue a matter of training, rather than learning. A good person (more plausibly) is trained to be good. They work for it—they didn’t just learn it FFS.

How is this related to getting unstuck when programming? It means that you won’t find the solution in a damn book. Even though knowledge helps us be good people and good programmers, what really matters is our psychology. Our habits. Our context. Our state of mind. In other words, I know you read “Intro to Programming” and I know that didn’t instantly turn you into programmer. It took some practice. 

Back to our pineapple finder, we won’t find all the answers by strictly being rational, even though everything we do is subject to rational analysis. Being a great problem solver is about understanding the habits of solving problems, and the habits of preventing problems in the first place. 

Habits of highly effective problem solvers

So, what are these prized habits? Slow down, Speedy Gonzalez. First, digest what we just talked about and decide if you buy it. The force of it is this: it’s tempting to believe that we can learn our way to better skills as problem solvers. It’s so believable, it’s ridiculous. It does help to know more, in a sense. However, the problem most of us have with the pineapple finder (that age-old foe) is in how we approach the problem. It is how we react to the problem. And it’s how we got into the problem in the first place. 

It’s empowering to believe that we level up simply by knowing more. Read this. Conquer that. That’s so 2-dimensional and simple and beautiful. It’s comforting, and I like comfort. But as so often is the case, it’s not that simple. Our programming practice is what makes us great. 

You’ll find the entry on the substantial habits of good problem solving in the next installment.

Get Updated