Living with a migraine as a software developer

Subscribe to my newsletter and never miss my upcoming articles

Migraine affects 1 billion people worldwide. It's the 3rd most prevalent and the 6th most disabling illness in the world. It's worse than an ordinary headache. The attacks usually last between 4 and 72 hours. Whoever has, or had a migraine knows about the pain they had to endure and the sacrifices they had to make because of it. Managing a migraine is not easy. You're pretty much forced to change and adjust your lifestyle and habits. There is no pill that you can take to make it go away forever. In this article I'll cover the four things I do to manage my migraine.

Disclaimer! I'm not a medical professional, so take this with a grain of salt. These things worked for me, but they might not work for you. If you're seeking a medical advice it's a good idea to talk with your doctor.

Drink plenty of water

Staying hydrated is a key factor in managing your migraine. You should aim to drink at least 2 liters (~8.5 cups) of water every day. Not only you'll get fewer headaches, but they will also be less painful. Always have a glass bottle on your desk and sip. You need to build a habit for that. Also, it's a well known fact that drinking plenty of water is good for your health. Having a migraine does not have to be the reason why you should start drinking water.

Drink ginger tea

Alongside with the water, I also drink one cup of ginger tea. I always drink it in the morning, and then proceed drinking water. Preparing it is not a hustle. I boil a liter of water, transfer it in a large jar and add sliced fresh ginger to it. Then I keep the jar in my frigde and fill my cup every morning until I go through the whole jar. Then I do it again. I'm not sure what it is, but it does help me get fewer headaches.

Get a good 8 hours of sleep

Getting enough, but not too much sleep is not only good for your migraine. It's also improving your life and your mental performance. We are software engineers. We do our work with our brains, and sometimes we tend to overdo it. That's why it is crucial to rest our brains and get enough sleep. When I don't follow that rule of mine I'm most likely to suffer a migraine attack. To ensure that I get 8 hours of sleep I started keeping a routine.

Keeping a strict routine

I noticed that keeping a strict routine plays a huge role in having less headaches. In my early years at university I didn't have a daily routine. I was sleeping throughout the day and I was coding and gaming throughout the night. That's when I started getting strong headaches. I was suffering many attacks per week. That lifestyle was fun, but the frequent attacks made me put myself in order, because it started to become unbearable. Today, I'm following an easy, but strict routine and I'm almost to zero attacks every three months. Here's my routine:

  • Wake up at 8 AM
  • Drink my first espresso at 8:30 AM
  • Start my work at 9 AM
  • Have breakfast at ~11 AM
  • Have my second espresso at 2 PM
  • Go about my day
  • Get to bed before midnight

The routine stops at 2 PM. After that it doesn't matter how much I work. There were days where I coded until 10 PM and still didn't suffered an attack. So the level of mental activity doesn't seem to affect the migraine in my case.

The key is to follow my routine, especially in the morning. If I miss my morning coffee, or get up earlier or later, I'm most likely to suffer a migraine that day. I'm not into drinking alcohol, but whenever I do, I'm having headaches the next day, so I tend to stay away.

Conclusion

Migraines are not fun. Managing them can be tricky and it requires changing your lifestyle and habits to make it easier. I find that these four things work wonders for me through research and experimentation. There is no definite formula, and these things might not work for you. But overall, try to live healthy, drink plenty of water and get enough sleep.

Corey O'Donnell's photo

Those are some great tips.

My go-to tips are:

  • lots of water
  • try and eat some food
  • Fresh air
  • Caffeine
  • Lay down and get some rest (My last resort)
Lazar Nikolov's photo

Drinking plenty of water is the most common advice because it definitely works. And that's true, when nothing works then you have no other option than to hit the bed. I hate when it comes to that because I have to leave everything that I'm doing at the moment.

JavaScript Teacher's photo

I think this is an important subject. The amount of mental work it takes to code is often underestimated. It can drain the last of your energy. Probably everyone who codes for a living (or simply interested in building innovative features for their own projects) deals with it.

Good call on drinking water:)

Also choose to rest for 30 minutes or take power naps (until the moment when your body actually starts to relax and you almost fall asleep.) This is actually effective and regenerative.

The worst situation IMO is reaching the "point of no return" stage. If you overwork and keep going you might be doing some major damage.

Lazar Nikolov's photo

Exactly! I especially feel drained when I put on some LoFi coding music and run the flow for a few hours. The amount of work that I do is surprising, but so as the amount of energy I've put into it. After a session like that I'd need an hour or so to wind down. We need to take care of ourselves. If we want to stay on track, we have to rest and hydrate.

Thank you for taking the time to read my article JavaScript Teacher! I'm so glad you like it!