Ask HN: How do you code when you're not feeling well?

15 points by santy-gegen ↗ HN
I find coding to be hard. Particularly, if I'm not having my best day my productivity while coding plummets significantly.

During days like the ones described, I find exercise and breathing exercises help me get back on track but only moderately.

If anybody has better techniques I would like to learn about them. I am grateful for any advice.

All the best, Santy

22 comments

[ 4.7 ms ] story [ 59.8 ms ] thread
For me, I recently got into drinking Yerba Mate (unsmoked, traditional way) and it's made me able to stay productive even in bad days.

Not really a technique, but something that worked for me.

EDIT: This is for when I'm feeling unproductive/down, not when I am feeling ill. The best thing for illness is rest and the right meds and nutrition.

hahaha, I'm from Argentina curiously so I have that solution quite handy.

It's good to know your opinion on rest, thank you very much

Are you asking about coding when you're sick?

I don't. When I get sick, I get stupid. If I try to code in those conditions, I'm very likely to just make a big mess of everything. Big picture, I get better productivity and code quality if I stop coding until I have recovered.

Ok, it's kind of what I experience but it's good to know I'm not alone
My health varies unpredictably; some days I'm not really fit to be out of bed, some days I'm pretty good.

Bad days, if I feel i can try working on something, I tend to stick to smaller "side" parts of a bigger task. Grooming dotfiles, editing docs, that kind of thing. Limit the possible impact of mistakes, and do things more amenable to non-thinking "change and try again" approaches.

Ok, it's an interesting technique. Working on less challenging stuff when not on your best
(comment deleted)
I don't. I learned long ago to code when I am feeling like coding, and not code otherwise. This is why I am an advocate of coders having flexible work schedules - sometimes you just aren't feeling it, but you can make up for that when you are.
Let's make a distinction.

If you're sick -> take care of that first. Don't work.

If you're just having an off day, trouble focusing, not feeling in the mood, that's different. I can suggest a few things that's worked for me.

1) Focus on just doing one thing.

Pick your most important project, then pick one specific piece of that, and shut down everything else until you at least complete that.

2) Set a timer.

If you're problem is getting started on a new or challenging project, do something like the pomodoro technique where you just promise yourself you'll work on it for X minutes and then stop. This removes some of the barrier to entry and can help you get started.

3) Remove distractions.

Similar to the first point, but is Slack always on? Are you getting notifications from your phone? Checking e-mail? This is a problem with our current life, we have too much competing for our attention. A lot of what we need to do to be successful is blocking out the noise so we can focus.

Hope this helps!

> If you're sick take care of that first. Don't work.

This leaves the chronically ill, and medically under-served, no options doesn't it?

Sometimes you gotta do things. Even when you're several twinkles short of glittering.

[flagged]
(comment deleted)
I hear you.

I'm not a doctor.

I don't know how to advise the chronically ill and medically under-served, so I can't speak to those circumstances.

What would you suggest?

:)

I like the distinction. Yesterday was a mix of days 1 & 2. Agree with all suggestions (I have a quiet desk with notifications turned off usually, so I guess that wasn't the problem).

I'll implement the just focus on one part of one project thing though, sounds like a smart strategy.

Thanks for sharing your wisdom

We all have "off" days from time to time.

Happy to hear, thanks!

Best of luck.

If you are talking about low energy days, my trick is to write documentation and unit tests. They don't require a lot mental focus, failure has limited impact. This is a trick I've taught to other juniors over the years.
My first manager out of college told me "you can't always perform at 100%, it's okay to have off days". That's gotten me through a lot of meh days at work.

I usually just try again tomorrow when I can't get anything done. Or I try at 5pm and work later than usual because I didn't do anything all day lol.

thanks for the honesty, it makes me feel so much less worse about having days where my productivity is not peak
When you aren't up to coding do review of what you have written, make notes on corrections needed as well as any ideas for improvement.

Good time to review user experience from your diminished perspective.

I just take a shower and go to sleep. Sleeping makes me feel way better and usually I can code better after that.
Those are the days where you clean up all your email backlog, do mandatory yearly corporate BS training, update status reports, clean up Jira, etc. I also find that on those days, root-causing bugs is easier than trying to actually write code (that either fixes problems or creates new features).
very funny and on point, specially the mandatory BS training