Knowing what I know now, I wonder how I avoided depression for as long as I did:

Stress causes depression. Perfectionists are more prone to depression. Isolation reinforces depression.

As a software developer, those frequently go along with the job description. Seasonal Affective Disorder has gotten the rap for at least some of the funk, because many software guys spend most of their time indoors, duty-bound to their office chairs. But surely SAD can’t take all the blame. Long hours of solitary work in front of a computer screen, the amateurish demands of tech-heads-turned-managers, the over-constrained projects, the intolerance we have toward bugs, the widespread myth that software is “free,” and (most importantly) how we as developers respond to these pressures, all these must take some share of the blame for developers’ depression.

Several years ago, I experienced my first major bout of depression. I had been working at a small company for umpteen years. If you’ve never worked at a small, tight-knit company, you may not understand the camaraderie that grows between its members, which keeps the company going, even through the lean times. This is not just some abstract “teamwork” concept, but an inspiration and effectiveness that comes from years of solving problems together. We literally loved our work environment, and we loved working together. I loved working there so much, I had remained there all during the dot-com boom years, turning down headhunter after headhunter, even with the promise of exciting work and a higher salary.

In retrospect, if I have one big regret, it is that I didn’t pursue other jobs and higher salaries during the dot-com years. Because just before the company was bought out and I finally got laid off, I was making about 25% less than the going rate for engineers of my experience and skills. Meanwhile, recent layoffs at the company had saddled those of us who remained with more work than ever. And because of family demands, I was struggling to find enough hours in the day to get my job done.

As a family, we were stretching to make ends meet, and our credit-card debt was mounting. My wife was also working part-time, and starting her own business the other part of the time. The kids were in daycare, and each day I drove through rush-hour traffic to pick them up before 6 PM. Then on the way home, I sat bumper-to-bumper with the other cars on the road, while the kids shouted and fought, much too loudly for the interior of our small family car.

Everyone at work was in the same boat. Some of the most senior employees had even taken a pay-cut to keep the company afloat. And we all wanted the situation to continue, because we all loved working together. But I was still not earning enough to support my family, and there were too few hours in the day to accomplish what I needed to accomplish.

I should have been interviewing for other jobs. But my current employer had been more than flexible with my schedule, to allow me to see to family demands, and I didn’t see how I was going to find another job that got anywhere close to what I needed.

That winter, I felt particularly down. I was having trouble focusing on my work. I found I loved to watch TV, and I often had the TV on in the background while I was working at home. I suffered from frequent headaches, and I developed a nervous twitch in my left eye. One late-winter day, I sat down in my cubicle at work, in front of my computer monitor, and I simply began to cry. I blamed Seasonal Affective Disorder.

In a supreme twist of irony, I was laid off that April-fools day. Getting laid off was the best thing that could have happened to me, because one of the most powerful weapons against depression is hope. When they told me I was among those laid off, I remember feeling euphoria, because a great burden had lifted off me.

That day, my left eye stopped twitching.

(Continued: click here for part 2 of “Depression and the Software Developer”.)