When your livelihood depends on what you can do with your brain, fighting depression and the fatigued fog that swirls around it is a frightening battle.

I read a post written by Noah Kagan of appSumo.com tonight in which he honestly and plainly described what that fight is like from the inside. He also shares some of the tools he uses like pursuing small wins, developing relationships with people you can talk to and taking a break from the stresses that are hounding you.

That post really spoke to me because I’ve been living through that reality for a long time. Most recently I went through a claustrophobic and dark winter where it took all of my strength to just keep plodding through day by day. A cold and gloomy winter, frustration about my job, stalled projects, constant lack of sleep and adjusting to living without 20 doses of nicotine a day all wore on my soul and sapped my energy.

The insidious thing about depression is that it takes determination and energy to beat it, but like an emotional infection it targets all the energy and determination you have. In a twist of dark irony, depression seems to specifically weaken the tools you need to stand up to it – your relationships, your ambition, your sense of humor.

So what do you when you’re at work sitting in front of a computer trying and failing to concentrate on the code in front of you? What if even the most straightforward requirements seem like impenetrable nests of complications and edge cases to your tired mind?

Well, if you have babies to feed, you just do the best you can. You muddle through. You pass up opportunities because you can’t muster the confidence or enthusiasm to succeed. You get quiet. You feel simultaneously lonely and harassed.

If you’re lucky, you have the support and resources to get through the darkest bit. If you’re lucky and smart, you fight back as soon as you can.

How Do You Fight Depression?

There are lots of books, blog posts and other resources written by people a lot more qualified than me. I don’t really have any special insights about mental health. I have been there though and these are the things that are helping me:

1. Connect With People

A typical day for me involves sitting in front of a wall of monitors with my headphones on, occasionally responding to instant messages and emails, but mostly alone. Some of my work time isolation is structural. I work on a very small team populated by other quiet people. I don’t get phone calls and I never have meetings. I know that sounds like a dream job for a lot of geeks out there, but it’s not healthy.

Our brains need interaction with other people. The human brain has evolved specifically to navigate complicated social groups just like dogs evolved to chase rabbits. Have you ever seen the nervous frustration of a dog that doesn’t get to run outside? That’s your brain when it’s not doing what it was made to do. If you don’t talk to other people a very old and deep trigger is pulled. As far as your brain knows, you’ve either gotten away from the tribe and are likely to starve or you’re of such low status that the tribe has exiled you. In either case, survival depends on getting back into the tribe and your brain will prod you with anxiety, fear and anger until you do something about it.

Connecting with other people also expands your access to ideas and tools that you use to get better. Your friends and family will give you the gift of perspective if you let them.

This is the hardest part for me. I’ve always struggled with a reflexive insecurity that keeps me from easily making friends. Some of that is rooted in my childhood rootlessness. I moved around a lot when I was a kid. I was always the new kid trying to wedge my way into the social circles that had been revolving since kindergarten in every new town we moved to.

When you’re that new kid you develop some emotional resilience and the ability to parse social structures from the outside. I’ve found that tremendously helpful when I’m analyzing how people communicate and interact on the web.

On the flip side, the perpetual new kid always feels like he’s on the outside. I’ve always found it hard, if not impossible, to “join” groups. It feels like everyone already has the friends they need. I don’t know how to fix that. As I said earlier, this is the hardest part for me. I’m still learning how to reach out to people and how to get over my fear of rejection.

2. Get Enough Sleep

One of the symptoms of depression is over-sleeping. That’s not one I’ve experienced. In another self-defeating feedback loop, my mental sluggishness slows my productivity. Faced with deadlines and frustrated with how little I’m producing, I stay up later to compensate. What ends up happening, however, is I get very little done for longer and longer periods of time.

Sleep is medicine for your brain. Without the chance to clean up and experiment, my brain gets increasingly disorganized and rigid. I end up less creative, less insightful and generally less able to solve problems. As a coder, that’s a serious liability. Not getting enough sleep as a programmer is like a chef dulling his taste buds with cigarettes. You can do the job, but you’re seriously handicapping yourself for no reason.

3. Chop Your Tasks Into Smaller Pieces

The frustration and panic I feel when I’m getting farther and farther behind just makes things worse. One of the key skills of a software developer is the ability to hold and navigate complicated models in your head. Abstract thinking is often one of the first casualties of a depressed brain.

As my projects would drag on, I would get more and more lost in them. It can be hard to keep all the details straight. When I’m in that situation I scribble lists. I try to get everything in my brain that’s related to the project on paper where I can see it. It doesn’t matter if it’s well organized or even legible. Once it’s on paper I can focus on one bit or another and get more detailed with my notes. Finally, with enough detail I can translate each chunk into committed code. Without that concrete plan I will run into a vague requirement and in trying to define it get distracted or so frustrated I just shut down.

Every time I get an item on the list checked off it feels like a weight lifted from my shoulders. You can only go for so long without a win. Small wins are always better than being stuck at 80% of a big win. They will encourage you, make your boss happy and keep you moving forward.

4. Just Say Yes To Drugs

I always hear people beg off trying medication for mental health because they “don’t want to rely on a drug for the rest of their life.” I never hear that statement when someone is talking about blood pressure medication or cholesterol pills.

You know what I hear most when someone does get evaluated and prescribed something? “Oh, so this what everyone else’s brain is like!”

There are good and bad prescription drugs and every one of them will act differently in each person. Some will make you sluggish, some will make you manic, others will make you cranky or tired, but some will make you healthy. Keep trying until you find that one.

Of course, there are other therapies available like counseling, CBT and others. I emphasize medication because drugs have definite, measurable results. If you’re in a state where you’re so frustrated and scared that you’re going to lose your job or your family, you don’t have time to be choosy. You need to get better. Once you’re doing better, talk to your doctor about trying alternatives if you like. Drugs don’t have to be the only tool you use, but they can get you to a place where you’re healthy enough to think clearly about alternatives.

5. Commit To Getting Better

Finally, despite feeling alone and worthless, even when you’re overwhelmed with frustration and confusing, you have to decide that you want to get better.

For me, I go back to this idea: you only get to live once and it’s a waste to do it while miserable.

I want to be happy. I want my kids to have a dad that smiles. I want to feel proud of what I accomplish in a day. The only way those things are going to happen is if I use all of the tools available and all the energy I can muster to beat it.

I’m going to beat it.