DEV Community

Kayley
Kayley

Posted on

What do you do when you're stuck?

Right now, I'm sitting at my desk staring at an error - it doesn't make sense whats going on or why this error occurred. If you're working with a language that has a huge cormmunitity, it's likely that you can just google what problem you've come across. For me that's not really the case, I work with ColdFusion. Of course, after a while - if I can't solve the error I will reach out to my coworkers for help, but I'm trying to do that as a last resort now.

Out of habit, I reach for my phone. Check twitter, facebook, instagram.. or even writing this post. Most of the time I don't really realize I'm doing it. I was talking to a colleague recently who mentioned that I spend a lot of time on phone, and I was pretty surprised. Out of this discussion, I became more aware that grabbing for my phone is something I do what I get stuck or even uncomfortable with a ticket. I use it for a distraction or outlet even to get my mind off what I'm struggling with.

Since becoming aware of my constant phone use I've made an effort to keep my phone in my bag. But now I still need an outlet to let that feeling of being stuck pass.

What is the right approach for issues like this? Obviously we all get stuck, from junior to senior dev - we won't automagically know the answers or always how to source them. So, how do you handle these types of situations?

Top comments (25)

Collapse
 
maxdevjs profile image
maxdevjs

Plenty of amazing suggestions and examples in these comments.

I leave my overall (not so different) approach too, never knows :)

TL;DR

It is personal, but I do think that for me it is necessary a radical "cut" from the issue. I find it is counterproductive to check social, etc. At a certain point, I take the screen (pixels, fonts, IDE/editor, sites, etc) out of the equation.

So...

  • when really stuck and with not much help from online searches, I try to dive deeper in the stuck situation: for a few minutes, I deliberately go through the issue "thinking" the same exact way (that I know, generally is wrong and will not bring any solution)
  • I open a few tabs (A) resulting from a search with that way of thinking
  • I quickly scan those pages
  • afterwards, I change a bit the point of view and I open a few more tabs (B) exploring an error in a different way, etc
  • quick scan to the new pages
  • I take a break from technology: if possible going for a walk, exercising a bit. Whatever allows me to not stare at a screen and mainly physically demanding activities
  • in the meantime, a background job in my brain scans the issue from different points of view
  • when back, if I do not already have some clue to follow, I often (basically, always) realize that I was anyway looking at the issue with a wrong assumption, doing the wrong questions
  • I take a glance both to the A and B tabs, often I spot some detail that brings me on the right path

This process helps me a lot.

It is not always viable if being in a hurry: can help in a few minutes, hours, or not. A few weeks ago I was stuck (luckily enough, with a personal project) and a solution arose after three days ;)

Points I take in account:

  • to look at the issue from different point(s) of view
  • if nothing solves, going for a different implementation (often comes out to work well and to be way simpler that the previous one)
  • I remix the steps based in current situation
  • and, generally, I do not care much if I can not solve it alone and immediately!
Collapse
 
krl87 profile image
Kayley

Thank you for your perspective Max! I appreciate you going through that. Very thorough, will have to try and adapt some of your practices.

Collapse
 
maxdevjs profile image
maxdevjs

Paraphrasing A.E., if I had an hour to solve a problem I'd spend 55 minutes thinking about the problem (mostly indirectly) and 5 minutes thinking about solutions.

Take care, Kayley :)

Collapse
 
thatonejakeb profile image
Jacob Baker

Taking a break or looking for a distraction to focus on something isn't the worst thing. It's usually what I do if I'm in that rut of just not being able to figure something out, then when I come back to it (a nights sleep is usually best!) I tend to have that "oh, duh..." moment.

Collapse
 
krl87 profile image
Kayley

I totally agree, though I do feel like I've become reliant on looking for some sort of distraction and my go to is my phone/social media. I can see how this would look to my coworkers if they're all heads down, I assume it looks like I'm not doing work? I think maybe I just need to find a different type of distraction, which will definitely be easier in the summer when I can take a walk around the building etc.

Collapse
 
thatonejakeb profile image
Jacob Baker

Depends on the culture of the place you work I suppose. Certainly where I am you’ll see people on all sorts when they’re thinking things through or taking a break. At the end of the day the way I look at it is everyone is a professional so I’ll treat them as such and not police what they’re doing.

Thread Thread
 
krl87 profile image
Kayley

That's very true and a very good point, perhaps I'm more cautious because I'm still a new employee.

Collapse
 
zubairmohsin33 profile image
Zubair Mohsin

I can totally relate to this. And I work remotely which makes it even more difficult, since there is no accountability.

When get stuck, I try to write things on paper. Thought process is like:

  • Okay so this is the problem statement
  • Obvious ways to debug it
  • Line by Line debugging (Scripting language) and writing output on paper

And sometimes just take a walk and think about it.

Collapse
 
krl87 profile image
Kayley

This is super insightful Zubair! I'm definitely going to steal this from you, I think there's something special about writing things down, somehow changes the perspective of the problem.

Line by Line debugging (Scripting language) and writing output on paper

Do you have an example of what this looks like by chance?

I can't wait until the weather here get's warmer! Talking walks will definitely be my goto for when I get stuck.

Collapse
 
zubairmohsin33 profile image
Zubair Mohsin

I work with PHP and JavaScript. Both are scripting languages and are interpreted as one line of code after the other.

So I just start at the beginning and then go on logging/dumping things.

Thought process example:

  • form is submitted
  • okay so its hitting Controller class method just fine
  • before validating we had this input ( note it down roughly )
  • okay something changed during validating the input ( note it down )
  • compare these outputs and try to make sense what could go wrong

I hope this helps :)

Thread Thread
 
krl87 profile image
Kayley

Definitely! Thank you for showing me how you work through a scenario like that!

Collapse
 
katnel20 profile image
Katie Nelson

Make Google your best friend. 😊

Collapse
 
krl87 profile image
Kayley

That's definitely a great option for those working in popular languages! For someone like me who's working in ColdFusion there's not really much out there.. Anytime you google something the solution is from 2012 and no longer viable.

Collapse
 
katnel20 profile image
Katie Nelson

Ok. I don’t know what that even is. Good luck.

Thread Thread
 
krl87 profile image
Kayley

Haha, 6 months ago I didn't either. If you want to check it out Learn CF in a Week for a quick run down on the language.

Thread Thread
 
katnel20 profile image
Katie Nelson

NO! Not another Mark-up Language (CFML). I'm still trying to keep track of all the others in my head. 😊

Thread Thread
 
krl87 profile image
Kayley

Totally feel that! I wouldn't recommend going near it anyways ;)

Collapse
 
drm317 profile image
Daniel Marlow

I call these situations “question queues”. You can be stuck in the queue if there’s nobody to help. You can even distract yourself from joining the queue in the first place.

Pair and mob programming were invented to address this very issue. 🙂

Collapse
 
krl87 profile image
Kayley

Good point! I do love pair programming, I really believe I benefit and learn quite a lot from it.

Collapse
 
dabrorius profile image
Filip Defar

Rubber duck debugging works surprisingly well. Before going to your coworkers make a plan how you will explain to them that the error makes no sense and show that you tried all possible solutions.

It's likely that you will stumble on a solution while doing this. If you don't, well at least you will have a plan how to explain the problem to your coworkers.

Collapse
 
krl87 profile image
Kayley

I'm definitely trying to implement this more before I ask for help.. Think about what I'm stuck on, and is there another resource/way I can solve the problem I'm facing. This approach has certainly cut down on how much I'm asking for help for sure.

Collapse
 
ryansmith profile image
Ryan Smith

ColdFusion can be a pain to work with, especially in old and messy codebases (which most ColdFusion codebases probably are). My advice is to stick close to the stack trace and put in dumps/aborts for variables/scopes at those points and load up the page to see what you are working with. It takes a certain type of stubbornness or tenacity to debug some ColdFusion issues, just keep at it and it will get easier over time.

As long as you have put in the effort and provide background information or what you have tried, you should be okay to reach out to your team. I think seeking out information on how they would troubleshoot the issue is valuable. As a senior member on my team, it is tempting to give out answers to help another developer instead of sharing my methods of getting to those answers which won't help the team grow. The other developer will solve their issue, but they may not have learned anything. I would keep that in mind when reaching out to not just ask about the solution to your problem, but seek out guidance on how they would troubleshoot it.

I feel you on wanting a distraction when something is painful to do, I am the same way. It might just be working in ColdFusion that causes that! 😄 Feel free to reach out if you need any ColdFusion help or need to vent about that language.

Collapse
 
krl87 profile image
Kayley

I ended up doing that after lunch! I don't want it to be my only option though, I need to be able to figure out things on my own.. What if next time I'm at home or no one is at the office?

Collapse
 
galloaleonardo profile image
Leonardo Gallo

A coffee can maybe help.

Collapse
 
krl87 profile image
Kayley

Ohh, super good suggestion! I need to bring in some more caffeine free tea for those afternoon struggles!