3 min read

Before Raising Your Hand

Before Raising Your Hand
Effortfuly investigating a problem before asking questions

Learning Problem Solving
Published Oct 19th, 2024

Since joining programming communities, I’ve noticed a common pattern: when faced with errors or tricky bugs, students first instinct is to immediately ask someone to have a look at their code. There’s nothing wrong with seeking help, but learning programming involves effort, trial and error, and the process of understanding your own mistakes. After all, what will you do when you’re debugging ancient code from a colleague who left years ago, with no one to ask for help?

Some Approaches for Problem Solving

There isn’t a one-size-fits-all process as lots of factors depend on the context, but following these general approaches should make it easier to identify exactly where is the problem.

  • Actually read the error message: this one is pretty obvious, the errors are usually very informative regarding what has happened and can give you a good grasp on what to change to fix the issue (not always, but this is the very first step).

  • Use a debugger: with a debugger it’s much easier to track down the piece of code that has problems. It gives you an overview of the values that are being stored in each variable and also being passed to function, everything in runtime. While using logs can help solidify your understanding during the learning process (my personal experience, no scientific confirmation here), debuggers become essential as the software grows in complexity.

  • Divide and Conquer: go there and start ripping out your code’s guts piece by piece, then execute it to see what have changed. When you do this, you narrow down the possible parts of the code where the problem could be. You might get new errors, but lots of times in the life of a programmer, getting a different error message is considered progress.

Ask Questions at the Right Time

It’s natural to feel stuck and want to reach out for help when your program doesn’t work as intended, but before doing that, take a moment to reflect: what have you already tried?

Have you:

  • Reflected on the problem and approached it from different angles - Your brain is not a straight line, it’s made of curves.
  • Read the documentation - It was made for a reason.
  • Googled it - Chances are someone already faced the exact same problem.
  • Asked ChatGPT - It usually has the answer to common problems and is able to explain it.
  • Framed a clear and concise question - Framing a clear and concise question often forces you to rethink the problem, sometimes even revealing the solution.

If you couldn’t find the solution after going through this process, that’s probably a good moment to share this with someone else. At least now you have a better overview of the problem, you know what you have tried and didn’t work. This saves time for both of you and significantly narrows down the problem.

I hate to sound like a “coach”, but get out of your comfort zone. If you don’t get used to try learning stuff by yourself before asking others for help, your growth will be much slower and dependent. How can you learn from your mistakes if you don’t allow yourself to understand the mistake? No one is supposed to have an answer ready when a problem happens, lots of times it involves investigation, experimentation and logical reasoning

Be curious about finding and understanding the solution

When you find a quick fix to a problem, do you simply accept it and move on? Well, you can, and a lot of people will, but that might not be the best approach. For example, if you copy-paste a solution from StackOverflow without fully grasping it, you might miss out on key insights that could help you avoid similar problems in the future. Curiosity leads to deeper understanding, which over time will help you build long-term professional experience.

Approaching problems with curiosity turns them into a learning opportunity. Explore how things work, don’t just accept “ready to eat information” and move on.

No rules, just guidelines

There are no rigid rules to problem-solving, but having these guidelines can give you a directions when you’re stuck, allowing you to approach it in a smarter way.

It’s a common saying: “There’s no such thing as a dumb question.”. I agree, but some questions are a missed opportunity. You learn more when you seek knowledge instead of passively waiting for it to be served on a plate! Learning isn’t just about getting the answer, there is pleasure in connecting the dots.

Before asking others, ask yourself. Question your assumptions, experiment and enjoy the learning process!