Please change the font. The word "meme" looks like "mcmc".
As a developer that is much closer to 50 than many here are, I can say that it's a crapshoot whether I will be programming when I'm 50. I tired of it after a handful of years, but decided to stay on with it because I can't afford the paycut, and am still am going with it, getting close to 15 years now. But everyday, and I've tried another employer, I still can't stand it. I enjoy the freedom and art and creativeness, but when things don't work, which happens a lot, I waste time on it and feel stupid and depressed. Feeling smart 1% of the time and stupid 99% of the time and worrying about whether you will be able to continue it without getting fired is a horrible way to live. It has affected my health, my attitude, and makes me drink more than I should at times. But, we justify this with "we are making a good living".
Common things I think about doing are (1) buying and running a bar, but then I would have to deal with the alcoholics, prostitution, drugs, and other crap that goes with it (not worth it) and would feel that I was contributing to an evil in our society even though I love beer and good times, (2) selling old computer equipment and games (there is little money here, and I'm not a hardware expert, so screw that), (3) getting involved with my church (but they don't need more IT, I'm a developer anyway not IT, and I have no idea what else I have to offer), (4) helping humanity get into space (but I have little to offer there also), (5) developing Indie games (which I've done in the past to some extent, but I think that writing games just means that people will waste time away from their family and solving problems playing them), (6) going to work for a non-profit development group (but I'm a conservative, and I can't work with tree-huggers even if I have a very liberal opinion that software should be free or open source, which I realize is not the same). So instead, I take care of my family.
Unfortunately, I am very familiar with all that you just described. That was me not so many years ago. Something I came to realize is that taking care of your family means more than bringing home a big paycheck.
I would suggest teaching programming to those who may never have the chance to learn. It would benefit society and your own spirit. There's plenty of ways to go about this and many of them can provide a nice living.
Above all, I would suggest that you find one thing (outside of work) that makes you happy/fulfilled and jump headfirst into it. Community service, outdoor sports, painting, drums... whatever. You'll be less frustrated and more pleasant to be around at work and at home.
My love for programming changed some years ago into a "brass tacks", utilitarian method of mostly just scripting (python, ruby) and moving on. Gone are the days that I spent hours making my code faster, more beautiful, more compact. And you know what? I still get as much done, I make more money, and I haven't missed "the good old days" barely any!
The pain in programming is that we have this 21st-century superpower but the only way we can make money is to suit 19th-century industrial masters who don't understand what's possible with technology. They just want us to point our magical tech wands at their existing machines and make them run faster. If we do this kind of thing for too long (and it's the only way to get a reliable income) we lose that "superpower" and become ordinary due to creative atrophy. Then we're fired and replaced by young idiots who think the all-nighters and low autonomy are paving the way to millions, and who will therefore tolerate more bullshit because they haven't seen yet that all the suffering leads nowhere.
Markets and capitalism are supposed to fix this fundamental problem (archaic, stupid leadership) by reallocating resources where they can be best put to use, by this isn't a problem that mere computation (as in a market) can solve. The problem is that power is held by the wrong fucking people, most of whom are total imbeciles with no vision, and the runaway feedback loop where power and wealth beget same is too far gone for talent to break in and change things.
US-style corporate capitalism is an outright disaster but, while EU-style socialism makes life suck a lot less for average people, it doesn't solve the underlying problem either.
Eventually, the discrepancy between what's possible with technical creativity and what's being actually done out there will reach a critical point and, like an insulator breakdown, sudden and powerful change will happen. I have absolutely no idea when that will happen, though. We have to purge and recreate the whole industrial ecosystem in order to get to the kind of world that people like you and me want-- a world driven by creativity and challenging problems rather than subordination and nonsense.
Huh, what's all this capitalism talk... as far as I know, his main pain in programming was just this:
> I enjoy the freedom and art and creativeness, but when things don't work, which happens a lot, I waste time on it and feel stupid and depressed. Feeling smart 1% of the time and stupid 99% of the time
Yeah guess what, that same thing gets at me ever since I started programming. I still like doing it, but that aspect is truly increasingly an issue in the activity since late 20s / early 30s now. How enjoyable you spend big chunks of your lifetime does matter after all, and you increasingly get that horrible nagging "time's flying faster every day now, I'm running out of a fixed resource one compiler error at a day" feeling..