The Art of Problem-Solving
Solving any problem is a simple three step process.
We took a family vacation to Puerto Rico a couple of summers ago. I had found us a beautiful house to rent. It had a spectacular view of the ocean and was nicely secluded. Of course, the first problem we had with the house was finding it. The GPS app on my phone worked great in Puerto Rico but was hopeless with the address to such a secluded place. The directions from the rental owner were akin to "take the second left after you pass the Johnson's place that burned back in the big drought of '97."
Setting out from the airport, I warned my family that it was a 2-hour drive to get to our rental, but it might take me an extra 30 to 60 minutes of searching. I reread the owner's directions, gave them to my wife for her to review and then set off. One hour and 58 minutes later I pulled into our rental. I didn't miss a single turn. My wife looked at me and said: "If I'm ever stuck on a deserted islanded, I want you with me." I gave her my best "I'm amazing" smile in return, but I was just playing along.
A few weeks later we were reliving our adventures from that vacation, and my wife asked me how I had found our rental that first day. I shrugged and told her that I'd just gotten lucky. She politely called BS on me and told me I pulled off things like that too often to just be lucky. As she pressed the topic more, I found that I couldn't give a better explanation than I'm just meticulous.
My wife was right. I do have a knack for figuring things out. And now she had presented me with something else to ponder on and ponder I did. Eventually, I realized that I have been solving problems so long that it has just become my go-to tool. My super power if you will. Over the past two decades, I have honed my problem-solving skills to the point that they are just a reflex. If I hear the word 'how' my problem-solving reflex kicks in automatically.
I didn't intend for this to happen. It is just an unwritten rule. If you want to be an exceptional developer you need to be an exceptional problem solver. There is a quote by General Robert H. Barrow that I like. "Amateurs talk about tactics, but professionals study logistics." The same applies to building software systems. Amateurs talk about programming languages, but professionals study problem-solving. After all, logistics is just another way to say problem-solving.
"Once you can state the problem in such a way that anyone can understand, then anyone can solve it..."
How do you study problem-solving? I'm glad you asked!
Step one, understand the problem. It sounds simple, but in reality, it is the hardest step. For example, let's go back to finding the secluded rental. Most will think the problem at hand is how to locate the house. But finding the house is the goal, not the problem.
Ok, so what was the problem that needed to be solved then? Take a few guesses before you read the answer. Ready? Here it is. The problem that needed to be solved was how to integrate the information from my GPS and the owner's written directions. Hopefully, now that you've read my answer, you think that it seemed not only obvious but also pretty trivial because that is the big secret here. Once you can state the problem in such a way that anyone can understand, then anyone can solve it, yourself included.
This act of getting from the stated goal to the underlying problem(s) is not going to feel natural to start. I am not exaggerating when I say this is the hardest part. It is awkward and not easy to explain. The best advice I can give you just to keep trying. Failure is the best teacher.
Step two, find the obvious solution. If you've done step one correctly, this is going to be easy. For the secluded rental problem, the solution was to actively look for matches between the GPS app and the directions. It sounds like a dumb solution doesn't it? Like any idiot in the world could come up with what I just said. That is my point. The answer is so obvious as to sound stupid. The same goes for magic tricks. Once you learn the secret to a trick, it is no longer magical.
Step three, implement. Again, if you've done steps one and two correctly, this will be trivial. If implementing isn't easy then you are probably better off going back to step two, or maybe even step one, and trying again. For the secluded rental problem, implementing was just me watching the GPS app like I normally would and then also asking my wife to reread parts of the owner's directions so I could keep them fresh in my head. I wouldn't say my implementation was elegant, but it didn't need to be. When you make it to implementation, functional often beats elegance.
That's it. The 1, 2, 3s of problem-solving. If you want to be a better developer and you haven't mastered problem-solving, then this needs to become your top priority. But, even you never intend to write a single line of code, give this a try. You will be surprised how much more capable you will become. And if you find yourself stranded on a deserted island, you will thank me.