The only problem for being a programmer in 40s and 50s is that it is really hard to find a job. This pretty much the only problem, but I guess that is a big problem :(
I'm in a second-class tech job market (not in a big city, even), and my skills got me two interviews and a job offer in DAYS.
And I'm in my 40s.
And I've been turning down full-time employee offers for years. Contracting suits me better. That or a "founder" role.
You need to specialize. And to be good at your specialty. Mine has been games for years, but this time I leveraged my Android experience to get a contract doing embedded Linux software.
For the record, my job is "good paying": Nearly $100/hour. And it's hourly, so the one time I had to work a long day to meet a deadline (nearly 10 hours! Oh no!) I got paid for it. :)
So keep your skills fresh and relevant and age doesn't matter -- except in one important way. People will see you and think "this guy has a life, so he isn't going to be pulling constant 12 hour days," and they (foolishly) think that's a drawback. But at least for me, I'd laugh at them for not wanting to hire me -- because I sure-as-hell wouldn't want to work for someone who expected that.
That really depends. On the internet nobody needs to know that you are 40 or 50. Finding a permanent job at a SV company may be harder, but freelancing / contracting is not.
I would argue that a company that rejects a competent 50-year-old on "cultural fit" is not worth considering unless you're desperate. That's douchey even by VC-funded startup standards.
That comment says nothing about what percentage of companies are like that. I don't have enough data to know if they're common or rare.
I'd guess that the signal:noise ratio of jobs available at age 50 gets better. Ninety percent of software jobs are shitty, but I also think that companies offering shitty jobs are more likely to age-discriminate, because older people are not likely to fall into the premature emotional investment trap.