DEV Community

Cover image for How Do You Get Unstuck from A Difficult Problem?
dev.to staff for The DEV Team

Posted on

How Do You Get Unstuck from A Difficult Problem?

Welcome to Code Chatter, your go-to series for conversational coding insights. What makes this series of questions different from all the others? Well, truth be told, not much, but they're still thought-provoking and fun. Join us as we explore the coding world, one witty question at a time.

When facing a particularly difficult problem, bug, or design issue, what strategies do you use to 'unstick' yourself?

Follow the DEVteam for more discussions and online camaraderie!

Top comments (7)

Collapse
 
manchicken profile image
Mike Stemle

I usually try to break it into pieces. If Iโ€™m having a problem with code, Iโ€™ll usually try to write a test to exercise the problem. Small test programs are much easier to use a step debugger with. I usually go there pretty quick since itโ€™s so effective.

I also, unironically, love rubber duck debugging. ๐Ÿค

Collapse
 
sarahokolo profile image
sahra ๐Ÿ’ซ

When trying to solve a difficult problem, I usually take a break. I walk away from the problem for a while. During that time, my mind is more settled and Ideas to solve the problem just easily flow in.

Collapse
 
ryencode profile image
Ryan Brown

some of all of these, in no particular order, within a loop (not shown here)

  • ask if anyone else has solved it (ddg, your co-workers, your friends, even the documentation or relevant literature when desperate)
  • walk away from the problem for a while (do other tasks, literally walk away and get a coffee/tea/soda/water)... extend to the next day if needed.
  • Rubber-Duck it... if no actual duck is available, substitute other non-technical resource. Explain the situation as you would to a non-technical resource. Listen to their interpretation of the problem and their ideas for solutions. (this also works better if the non-technical resource is a human you have good relationship with, like a spouse or bar-tender)
  • Break it out into smaller pieces, ensure each smaller piece does what toy think it's doing. (this is part of "check your assumptions", don't take your instinct's word for it that the value you expect to be passed is actually what was passed and so on)
  • Add more logging/tracing, perhaps something is coming out of order when NOT in a debugger. (I've had this where the act of hitting a break point gave an asynchronous task the time to complete as expected while when run normally it had not yet; Also I've encountered cases where a framework [dotnet 1.1! ] would behave differently under some cases when walking though with the debugger attached than it did normally.)
  • Invert the issue if you can. Try to accomplish the opposite, see how that works. Get the idea for it. Trying to block a specific connection? Instead block all and try to allow it. This could give you the perspective to re-reverse the solution to what is intended.
Collapse
 
mainarthur profile image
Arthur Kh

The key to solving difficult problems is communication. Communicating with your team or friends always provides a different point of view and can suggest effective solutions.

Collapse
 
jmfayard profile image
Jean-Michel (double agent)

I take a break, write down why I'm stuck, and talk with a human about it.

Collapse
 
ranggakd profile image
Retiago Drago • Edited

in no particular order:

  • take a step back from the problem
  • ask ChatGPT / BingChat for the problem
  • applied the final solution

Until I solve the problem

Collapse
 
akash_dathan profile image
Akash Dathan

Take a break, going for a walk, to gym, or swimming helps.