Solving problems: How to deal with getting stuck
Being stuck is frustrating! Here are some useful approaches & resources for help
Writing code is all fun and exciting, unless we stumble upon a problem and get stuck for hours (or days!). Whether we're trying to solve something that hasn't been solved before, or no solutions from online seeming to work for us, this is a real problem every developer comes across once in a while. In this blog, let's look at a few useful approaches and resources to resolve problems whenever we're stuck on something.
Being stuck is an opportunity to learn
Most of the times we have been stuck on a problem or some bug, we have come out of it learning something in the way. (Okay, a missing semicolon doesn't count :p) But at most times, we'll probably learn something new, however small or big it might be. We're better prepared for facing this issue the next time. So, how about treating each period of getting stuck as a learning opportunity? Let's signal to our brain that "brace yourself, this is going to be a new learning opportunity", and then start working on it!
Few useful approaches to solve problems
Now that we've talked about the learning part of it, let me share some approaches which I find useful when I'm stuck on something, and I think these will help all of you as well in some way or the other -
Understanding the problem better
Before we try to resolve a problem, the first logical step would be trying to understand the problem fundamentally. This might be different based on what we're working on.
If we're building something new, we would do some research about the fundamentals - like reading the docs, seeing basic examples etc. If we're trying to resolve an issue or a bug - we might try do to something known as a "root cause analysis (RCA)", which means getting deep into the problem and find the root of what's causing it. However way we see it, understanding the problem better would certainly mean we are getting closer to the solution.
The brainstorming bit
Now, we have a clear understanding of the problem we're trying to resolve. We can start thinking about approaches to overcome it. We can note down whatever ways come to our mind, and then do a dry run to find out whether any particular way can actually solve the problem, potentially. If we have multiple potential approaches, we can think about the merits and de-merits of each approach, and then make a trade-off. Finally, we can go ahead and start trying out our chosen approach to resolve the problem.
If the problem is bigger, we can try to break it down into smaller pieces, and then try to resolve each problem sequentially, repeating the above steps for each one.
Taking a break
Taking a break when we're stuck on something helps in more ways than we might think.
It lets our conscious take a break from the problem, while our subconscious is still thinking about the problem at hand and ways to solve it. And some problems are better left to the unconscious to solve. That's why, rather surprisingly, some solutions might come to our mind while we're having a shower or taking a walk etc.
In this section of the blog, I'll share a few resources and communities which have been extremely useful for me to understand problems better, doing an analysis on any issue, and trying to resolve problems after getting stuck. These are not only helpful for solving problems when stuck, but also for self improvement as a developer and getting a deeper understanding of things.
Personally, I'm a big fan of good documentations. Docs are a great way to get started with something, or understand the fundamentals of any concept. And as we already know, understanding the fundamentals related to any problem better will actually help us in getting closer to the resolution.
So, going through the related documentations of the fundamentals related with a certain problem whenever stuck would definitely be helpful.
How many times do we look for answers from StackOverflow whenever we're stuck on some issue? All the time! Great StackOverflow answers provide good context, as well as helping us understand more about any particular problem and solving it. Or maybe a hint at least!
3. Github issues / discussions
If we are encountering some issue while working with a certain package or library or something that's on GitHub, there's a chance someone has already encountered that issue before and asked for help. GitHub issues or discussions is a great place to get more context or understanding of any problem.
If we don't find an issue related to our problem, we might as well raise one and ask for help from the community!
YouTube videos (many a times by underrated creators) have often come to my rescue whenever I'm trying to build something or understand how something is done. They might not be exactly how we want to do things, but even so, they might be very helpful in getting some idea of things.
If some other resources or communities have been of help to you, feel free to share them below!
In this blog, I have talked about some useful approaches and resources which have helped me so far as a developer while I have been stuck on solving a problem or trying to build something new. Not only have these helped me get closer to the solution, but also helped me get deeper understanding of fundamentals related to whatever problem I was working on. Hopefully, some of these will be helpful to you while you're stuck on some problem and looking for ways to resolve it.
Cheers, until next time!
Did you find this article valuable?
Support Sreejit De by becoming a sponsor. Any amount is appreciated!