Many programmers and entrepreneurs are bipolar or borderline. "The Bipolar Edge" is a book with some interesting research on this if you filter out some of the sensationalism.
I think one of the best strategies when depressed is to text someone and pair program. Also helps to keep the internet out of the house so you have to leave to get food eventually :)
The biggest thing though is remembering that it's biochemical, not "real", and that you'll snap out of it.
There're two kinds of depression, to me. There's the depression that's chemical, and that kind can be predicted and dealt with. Then there's the kind that comes from things not being right in your life, and that's the kind that both fascinates and consumes me.
I'm in the middle of one as I type this, actually. Sometimes when depression hits it's in reaction to a mania: There's a big high followed by a crash. But frequently that depression comes in the form of apathy; I'd even say contentment. I have periods of huge excitement, followed by much chiller periods that I'd call a biochemical depression. But that's a depression that doesn't have the pointed emotional aspects that I associate with the word.
When that second kind of depression hits, almost always it has to do with something mental. When those really bleak periods hit, I can almost always find a cause that's tied in with something in my life: Core situations and circumstances that are subtly bringing down other parts of the way I feel. And I've found that if I react swiftly to deal with whatever it is that's causing it, I can end the feeling quickly and get back to a more balanced state of mind.
Getting a balanced, "happy" life isn't easy, because everybody has to deal not only with all their many wants and needs but with the wants and needs they think they should have that they're given from other people. Growing up, I feel many of those problems are problems with actual, logical solutions, but that the answers are convoluted and twisted many many times over. So I'll feel as if I've figured something out, and indeed I'll have gotten farther than I had previously, but a year later I'll realize there's another, much subtler issue related to the one I thought I'd figured out, and then I have to rethink everything.
The result, I find, is that over my life I've managed to stabilize myself quite well. I now face these feeling much less frequently than I once did, and for less of a duration. The cooler, more casual depressions are frequent for me, but those are more relaxing and less worrisome. So in one way you're right, and depressions do snap, but in another way the content of the depression is what matters, not just the depression itself.
I think one of the best strategies when depressed is to text someone and pair program. Also helps to keep the internet out of the house so you have to leave to get food eventually :)
The biggest thing though is remembering that it's biochemical, not "real", and that you'll snap out of it.