Ask HN: Does coding give you brain fog?

71 points by shaydoc ↗ HN
Do you ever suffer from brain fog after a day of intense thinking/coding ?

Some days after intense working I leave the office spaced out, to the point I wouldn't drive. Thankfully I hop on the train.

I also find the whole prolonged screen exposure and posture just leaves me with a headache and neck ache.

I really notice how much better I feel after maybe 3 days off work..

72 comments

[ 2.3 ms ] story [ 82.3 ms ] thread
Do you take brakes and walk around? Do you exercise (I mean RUN) while not programming?
> Do you take brakes and walk around?

That's a novel approach to exercising.

I'd second this comment. I found lack of movement to be the problem for me. After several hours in front of the computer coding, browsing, whatever, I'd find myself feeling zombie-like and brain-fogged. I got inspired by the Walk and Code blog post[1] and bought a walking treadmill for work. Bye-bye zombie feeling.

I work in an open office environment, so I needed one that was quiet. I bought the Rebel Treadmill 1000 and it's so quiet me and my office mates can hardly hear it over the sound of the HVAC system. Not affiliated with the company that makes them, but I heartily recommend their treadmill if you get in the market for one.

[1] https://8thlight.com/blog/doug-bradbury/2010/02/25/walk-and-...

No,unless more than 10 hours a day.
I used to get this - it turned out that I was not breathing enough, which caused my blood pressure to go up. I would get so focused on a problem my breathing would slowly become more shallow.

Now I have a water bottle on my desk and I slowly sip it all day, it forces me to get up every 1-2 hours to use the bathroom and fill the bottle back up -- and I deliberately use the bathroom 1 floor down to force me to go up and down the stairs

> I deliberately use the bathroom 1 floor down to force me to go up and down the stairs

This is such a good idea that I'm stealing immediately.

I also visit the office kitchen 10 times a day, fill up a glass of water and go back. I don't necessarily finish it, next time just spill the remaining and refill. I believe developing these habits helps avoid burning out and other desk work consequences such as RSI.
> next time just spill the remaining

Get plants! Take the responsibility to water them. You will have another reason to walk around the office!

(comment deleted)
Years ago when I was just getting into the film/EFX industry, a grizzled old vet told me "when you're in production, drink lots of water because otherwise you'll never get up from your desk"
Hm, my breathing also varies somehow when I'm thinking. I'm not sure of the details, because it never happens when I'm thinking about my breathing!

I've occasionally pondered obtaining some kind of fitbit for lungs to see if I can spot said 'variation' on a graph. I'm not really sure I'm not just making it up.

No, but it could be that you are stretching your skills(good!). Exercise to make sure it's not a physical thing, and be sure to take regular time off to recover.

If you are working on challenging stuff all day, it's probably a really good thing.

I get this if I spend too much time programming. You just need to get up and take breaks, for example after every task you complete. Go do stretching or read a book, let your mind unwind, then get back to it after 20 mins. Not all offices allow for this so if yours doesn't consider changing job, for your own health.
Please get checked out by a doctor. Anytime you have really weird symptoms, it's best to be sure it isn't something serious.

Short answer: No, I've never had anything like that.

After concentrating for an extended period, I'm slightly out of it when switching to talking to someone. But it clears up quickly and has never been anything so bad that "I wouldn't drive."

Possibly eye trouble, bad air in the place where you work or a latent health issue.

I used to get incredible headaches after long bouts of coding, it took me a long time before I realized I needed glasses.

>it took me a long time before I realized I needed glasses.

I'm rather astonished how relatively poor my eyesight had become before even thinking I might need glasses. Boil the frog, I suppose.

Yep. And it's not as if I needed the hint, most of my family wears glasses. It's just that it changes ever so slowly day-by-day and then one day you wake up with a headache so bad that you can't see at all. Getting reading glasses was a major improvement in quality of life.
I've had the spaced out feeling after work as a recurring problem for over a decade. Most days I am OK enough, but others the only thing I want to do is go home and stare at a wall as all cognitive abilities are exhausted.

I run 10 miles a week and bike long distances, make all of my own meals, and have been working with various doctors for years. Nothing seems to help 'fix' the issue altogether.

I am the same, been like this for years. I recently cut out coffee and it's helped a little.

What I also find is my heart is always at its lowest at around midday.. drops to 49/50 before lunch.

I get up several times in the morning and walk around, but if I get in the zone with a problem I am always spaced out By the end of the day

I used to come home and slug a glass of wine or two down. Felt better fast but early in the evening I was tired. Now I just get quiet for a few minutes and then let the brain be what it is. My fog goes away more slowly but I have energy and clarity till I go to bed. In short I think the benefits of not drinking after work are better than if I was drinking. YMMV.
Aye I had to give up drinking last year. It worked wonderfully for a while.

You reminded me, I might try employing mindfulness more again. Let things be as they are for a bit. Thanks!

Yes mindfulness is helpful.
I do, but I also have fibromyalgia, which makes me an atrocious point of comparison. But that does mean I've gotten a lot of experience working around physical and ergonomics engineering.

Intense mental work can drop your blood sugar and oxygen content in your blood, as mentioned by others. Start checking your health and engineer health back in for better coding.

Walking to another floor's bathroom, stepping away from your desk to walk around the building, getting a sit-stand desk, regularly stretching... there's a bunch. Get a tracker, and start experimenting. The same thing for nutrition.

If you haven't, work on deep breathing exercises and consider getting a pulse tracker so you can find a pattern. This is any other data pattern, the effects are just very close to home. If you feel like you should be coding, consider if your life was a resource management game and at what point you would expend resources to get better productivity from your base unit (aka. you).

Good luck!

I usually get this after a stressful day but not to the extend of what you are describing, it lasts for ten minutes or so until I change environment. Do you consume a lot of caffeine while working? Maybe you should check that. Taking breaks every half an hour is always a good thing, never be stuck on the office chair for too long, it causes problems even if there's no underlying health problem. You don't need to run a marathon either as far as exercise is concerned,if you have the chance get down and do 15 - 20 push ups a couple of times a day, it's amazing how much difference it makes. Taking a walk also helps clear your mind, I feel really relaxed after walking my dog for 30 mins.
You're straining your brain over extended periods, of course it happens. Your brain is a living part of you and it too needs to rest. I get that semi-often partly exacerbated by bad sleeping habits (it's not good obviously) and I what I find helpful is to take breaks and drink more water. Sounds obvious but yea.
Not exactly brain fog but I often find myself in extreme left-brained mode after a challenging day of coding. If I meet friends after work I am a horrible conversationalist for up to an hour while my brain slowly (and reluctantly) stops actively churning on coding problems.

Related to the right-to-left thinking mode changes, sometimes the words that I am using at become eerily meaningless or unfamiliar. I've spent a few moments asking myself "is that really the way 'else' is spelled?". I recently learned this phenomenon is called semantic satiation [1].

[1] https://en.wikipedia.org/wiki/Semantic_satiation

Oh yeah! I have had that phenomena pop up on occasion. Didn't know it was a thing.

It isn't a result of repetition for me though. Since I have practiced meditation enough, I can watch how my consciousness shifts and changes. I remember watching a creeping doubt enter, and then a word loses meaning, or I'd forget how it is spelled, even while staring at it. Knowing that jusf a few seconds ago, I knew what it was. I also chalk it up as a state change. I sometimes google it just to be sure and if it shows up, let it go and move on. I don't remember if I ever tried sitting through and seeing how the consciousness shifts back -- would be interesting to watch what happens.

Left-brain mode after coding all day is certainly a thing.

I thought it would go away once I got into management, but the truth is I solve those problems with the same analysis, so even though I'm problem solving people, I'm still a horrible conversationalist right as I leave work.

Yeah, I noticed I have trouble conversing or paying attention to what the person is saying to me, particularly if the talk isn't geared to resolving a problem.
I've been experiencing language difficulties since I started programming more, usually during the workday, when I'm actually working on the code. I thought I was going crazy, but it sounds like you have similar experiences. Is this somewhat normal?
Sometimes.

If I am marathoning, though, I use a pomodoro timer and meditate or do something similar to tai chi in between coding sessions. If it isn't that intense, I tend to self-regulate in microdoses using techniques from meditation and an art like tai chi.

I only require multiple days of recovery when I burn out, often resulting from sustained interpersonal conflicts. I have noticed that has been improving since applying techniques from Crucial Conversations.

I've had a tendency of entering prolonged periods of focus throughout my life, and at this point I can feel my brain almost optimize to the task at hand, there is a type of shift.

For example, I played and performed music seriously for a period of time (no singing), and it was pointed out by a close friend that any performance that lasted more than an hour and my verbal center would basically crash. It would take at least 30 minutes or even hours before my brain would be able to start talking like a normal person again. Prior to this point in time I had purchased a pocket dictionary which I carried around, seemingly to combat this issue.

At present, when I have been working on something particularly engaging at work my wife notices because my ability to communicate does suffer.

It is interesting that you noted 3 days, just because I recently heard a researcher talking about how getting away for 3 days can have a cognitive benefit: https://www.rei.com/blog/camp/the-nature-fix-the-three-day-e...

As was mentioned, getting checked out by a doctor does sound like a prudent step.

Could be that you over eat or under eat while working. Or are snacking on something you have a food allergy to. Could be that you're not getting enough exercise. Could be an environmental factor like mold. I've had all of these issues at one time or another resulting in brain fog.
Could just be simple brain exhaustion from prolonged concentration (I occasionally feel something similar, usually after back to back heavy coding days and I'm running low on sleep).

Like others are saying, a few things that might help: stay hydrated (water, not coffee/soda etc.), get a good night's sleep ahead of intensive coding days, don't eat crap food at your desk and don't stay in the "zone" for 6+ hours without getting off your chair at least once and doing something different for 30-45 mins (ideally involving fresh air, outside of the building).

I experience something very similar. It turned out to be at least in part from eye strain induced headaches ("computer vision syndrome"). I started paying more attention to ocular health, including following the recommendation of a comment here [0] and lowering screen brightness. It does seem to be helping.

[0] https://news.ycombinator.com/item?id=12582810

My first couple years as a professional developer were amazing - 7-12 hours a day of coding to keep up. Every single day I left the office totally spent mentally.

I would often dream about coding, or solving a problem that I was stuck on.

I did not however, get headaches or neck aches. In fact, I found being spent mentally to be somewhat of a pleasurable state!

You need to set reminders to take a break once an hour, walk around, stare off into the distance for 5 minutes. This article is from 2012 but mentioned 5 of them: http://www.techrepublic.com/blog/five-apps/five-free-apps-to...

I also noticed this was a side benefit of having a good test suite- if your test is valid, thorough, and passing, then you don't have to remember as much mental-model (because it's encoded in the suite), which would normally discourage you from getting up at all

I actually built something like this for myself when I was learning javascript. It's buggy, but for the most part it works. http://okpeet.com/breaktimer/ if anyone wants to take a look.
I made myself a pebble app to do this that I never ended up publishing. Sadly I no longer have the code nor my pebble.
Oh yeah! My friend used to tease me every day after work when we worked together. "How's it hanging up there in the code fog" he would always say when I was grasping for words :) I never really noticed though: so no headaches or anything like that...
Have you tried cutting caffeine? I've had similar symptoms and cut coffee two weeks ago after drinking > 5 cups/day for years. Not sure if it's placebo but it looks like my brain fog is gone.
A lot of people here are saying take breaks and go for walks. I've felt what you described and something that I have just recently started doing that has helped 1000x over is meditation.

Check out the Calm app[1]. Its helped for me because I had no idea where to start. I have no affiliation with them and am sure there are alternatives out there, this just happened to be the first I had tried. I've just started using it the past few weeks and use it at least a couple of times during the work day, and I try and take a walk at least once a day during work as well. Its really helped with everything you listed above.

[1] https://www.calm.com/

I experience these symptoms from work days during prolonged periods of high stress. I don't usually get it from programming during less stressful times and I've had just the same issues during a month when I somehow ended up with a bunch of non-programming tasks.
I have only rarely have felt this from programming (at work or not).

But as a competitive chess player, I do usually experience it at the end of (especially) weekend tournaments, where there is generally 3 consecutive days of 8-10 hours of intense concentration. The fog is gone after a good sleep and day of rest.

Coding just burns me out. By the time I get home, I can't bear to even look at my laptop. I have a very hard time doing coding side projects because I'm just to burnt out too code outside of work.