DEV Community

Aneeqa Khan
Aneeqa Khan

Posted on

How do you code when you are depressed?

Hello all, I want to know how you get yourself to code when you are depressed and sad and you can't do much about it, But you have office work to do.

Top comments (40)

Collapse
 
po0q profile image
pO0q πŸ¦„ • Edited

It might be a cultural shift but "depressed" can be considered as a persistent disorder with severe damages. In this case, go see a doctor quickly.

However, I think it's not what you mean here, and I understand it more as "what do you do when you're feeling low?".

There are already pretty good answers such as doing exercise or less screen time, but I would add the following:

  • if possible, talk to people
  • pause social networks as studies have shown there's a direct relationship between anxiety and notifications/likes, etc
  • run or take a walk in the early hours of the day
  • healthy diet

Note that junk food, too much social networking, lack of sleep, or isolation can be the very reasons of anxiety, sadness or worse.

Collapse
 
darkwiiplayer profile image
π’ŽWii πŸ³οΈβ€βš§οΈ

Also less coffee. People underestimate caffeine. A lot.

Collapse
 
po0q profile image
pO0q πŸ¦„

Totally agree with you and overconsumption is kinda encouraged in the IT business.

Thread Thread
 
darkwiiplayer profile image
π’ŽWii πŸ³οΈβ€βš§οΈ

Not just over-consumption, literally any of it can cause (or worsen) anxiety.

It's normally just a trade-off; but it always amazes me how people who are already stressed and/or dealing with anxiety will still drink one cup after another and wonder why they aren't feeling better yet.

Collapse
 
james_palermo_bc208e463e4 profile image
James Palermo

I know you're coming from a good place when you wrote that but just in the interest of a friendly exchange of how intent can go awry, that kind of response to a question like "I'm depressed, anyone wanna share how they cope?" is maddening to me. Don't tell me what depression is, don't tell me what I should do about it, and absolutely do not suggest junk food is the cause.

Again. Not actually angry at you, just letting you know how it feels when you want some personal connection and someone explains your own brain to you.

Best,

  • Jas
Collapse
 
po0q profile image
pO0q πŸ¦„

Hi, I only share my thoughts and experience on the topic. There's no condescending judgment whatsoever.

Junk food can actually be a root cause for various disorders, including chronic fatigue. Being tired all the time can affect your mental health dramatically.

These are practical means to cope.

Thread Thread
 
james_palermo_bc208e463e4 profile image
James Palermo

Nevermind.

Collapse
 
sherrydays profile image
Sherry Day

For me: Get something done first thing when you sit down.

That's it. Contribute something, anything to what you're working on, and sometimes that turns in to a really great day. And sometimes it doesn't β€” but that's the nature of the beast.

Collapse
 
tmchuynh profile image
Tina Huynh

I agree. It's making yourself start that's the hardest. That's why building good self discipline is key especially when you are motivated and on top of your game

Collapse
 
james_palermo_bc208e463e4 profile image
James Palermo

Sometimes I even start by just checking my local git repo folder or venv or docker etc and removing any experiments or clutter I don't need. Nothing more than looking through folders/containers and deleting what I don't need from local. That way I get some tiny momentum, and when you're depressed any momentum is good momentum.

Collapse
 
jballanc profile image
Joshua Ballanco

Reminds me of the famous adage:

How do you eat an elephant?

One bite at a time.

Collapse
 
michael profile image
Michael Lee πŸ•

Try going for a walk.

Coding is problem solving.

I often get epiphanies or breakthroughs while doing other things.

You could look at the work ahead of you and tell yourself you'll focus on this problem on my next walk.

Then while you're enjoying the outdoors, focus on solving the problem.

Collapse
 
darkwiiplayer profile image
π’ŽWii πŸ³οΈβ€βš§οΈ

Then while you're enjoying the outdoors, focus on solving the problem.

Or just focus on the outdoors. The solution will either come on its own, or it won't.

Collapse
 
michael profile image
Michael Lee πŸ•

Great point @darkwiiplayer !

Collapse
 
booboboston profile image
Bobo Brussels

There are no easy answers, but on the day when you can't get in to it, maybe it's 3pm and you feel like you should stay sitting down for 3 more hours and work through it, your best bet is to get out and stop in that moment, and start from scratch the next day. Those three hours spent trying to power through are not going to help.

Collapse
 
james_palermo_bc208e463e4 profile image
James Palermo

I take my MacBook and drive somewhere like an empty park or back road, park, and work. Driving helps clear my head.

You can only push yourself too hard though. Reaching out like you're doing is helpful. I wrote a post about how lonely coding can be and the replies really helped me.

Collapse
 
aneeqakhan profile image
Aneeqa Khan

Thank you James! 😊

Collapse
 
james_palermo_bc208e463e4 profile image
James Palermo

You're not alone in this lonely world.

dev.to/james_palermo_bc208e463e4/t...

Collapse
 
ernestvonmoscow profile image
VanPonasenkov

Wouldn't consider myself to be "depressed", but i can be sad from time to time, so i'll throw my 5 cents in. I do like 15 pushups, rest for 10 minutes, do another 15 pushups and after that i feel really energetic, don't know why, i just do. (If no one's looking) you can punch the air for a couple of minutes, it's strange, but for some reason it gives you a substantial energy and mood boost based on my experience. Listening to folk songs with jolly melodies can help too, my personal favourite in that regard is: "Wenn die Landsknecht trinken"

Collapse
 
aneeqakhan profile image
Aneeqa Khan

I can relate to you with music, I prefer to listen "feel-good" or "country" songs during a depression. It helps 😊
Thank you!

Collapse
 
geauxweisbeck4 profile image
Andrew Weisbeck

It's so hard. I know I just try not to be hard on myself and give myself breaks because honestly, there is a lot going on in the world that can flip us into that depressive mode really quick.

I just had a bad two day downer and I felt like I wasted a bunch of time. But once I finally was able to get myself back up and going, I made sure not to beat myself up about it. I felt like I got myself way behind in trying to find work/and or freelance projects, but taking care of mental health is always job numero uno for me.

Collapse
 
aneeqakhan profile image
Aneeqa Khan

Yup, I did same. I took a break when I was not feeling to do work and today I'm feeling much better and productive. Thank you! 😊

Collapse
 
webbureaucrat profile image
webbureaucrat

I gamify the GitLab contribution graph--goal of one commit per day, pushing for two or three. Even when I'm very much not feeling it, it's not hard to make myself open my laptop for one commit, which can take just five or ten minutes.

You end up with lots of very small changes over a long time, which is great for productivity because it keeps the state of the project fresh in your mind. It's also great for depression because even in the slow times when you're slogging through a difficult problem, you still have something very visible--a wall of colored-in squares--to show for it.

Collapse
 
aneeqakhan profile image
Aneeqa Khan

Yeah, even a small commit is a commit
Thank you! 😊

Collapse
 
ben profile image
Ben Halpern

I think it starts with positive self-talk. Guilt can be a vicious cycle, don't treat yourself worse just because you are struggling.

Collapse
 
aneeqakhan profile image
Aneeqa Khan

My positive self-talk takes a turn and convert into regret talks πŸ˜„
But yeah once should try that.
Thank you! 😊

Collapse
 
brunoj profile image
Bruno

Exercise helps a lot

Collapse
 
codewander profile image
codewander

I try to be patient and remember that it will be easier to understand and make progress the next day. A lot of times I measure my success by how much I finish each day, but with depression, it's much easier if you measure how much I finish each week.

Also, I try to shift to things I find very interesting or that are easier. So, I might write some unit tests or improve something about my developer workflow. I find that it's harder to create or write large blocks of greenfield code when I am down. It's easier to read existing code or do smaller refactors.

Collapse
 
aneeqakhan profile image
Aneeqa Khan

Thats a good idea to refactor old code and still get productive today.
Thank you! 😊

Collapse
 
aneeqakhan profile image
Aneeqa Khan

Thank you everyone for your time and solutions!
It really makes me feel I am not alone in this. However reason of my depressed mood was something personal but still you guys sent me all those advises which really helped me.

I want to share what I have done to cheer me up yesterday.

  • I took a long bath and organised my thoughts. Lot of crying happened but do you know tears contain a number of stress hormones and other chemicals so when you cry you release this stress.
  • I had my comfort food. I agreed junk food have many disadvantages but I believe if you are feeling sad then you have to give yourself some treats. (btw my comfort food is noodles 🍜)
  • I have watched my favourite show (nowadays I'm watching bridgerton). There are also stress reliveing videos on internet. Some like to watch kittens and some like to watch oddly satisfying videos.
  • In the end, I did some night yoga with light music. It was very soothing. 😊
Collapse
 
codewander profile image
codewander

I cannot get enough of the 11 month old snowboarding baby in China.

Collapse
 
cgifl300 profile image
cGIfl300 • Edited

I don't! I have a walk to the lac, well, I have to admit I don't really undestand depressives lol. regular breaks are as important as coding for hours (wich is highly not productive!).

Collapse
 
jwp profile image
John Peters

I just keep the faith that all things will work out for the good. Without fail, they do. It's just a matter of when and how it all works out.

Collapse
 
aneeqakhan profile image
Aneeqa Khan

Yup, After every sunset comes a new sunrise😊

Collapse
 
j0nimost profile image
John Nyingi • Edited

you don't, take a break ask for a 1-2week leave or atleast tell the hr to give you sometime off. Meet friend's, share what's bothering you with someone you trust and comeback to coding when calm.