I'm 49 and I'm a programmer.
Well actually I'm a DBA, IT consultant and Business Analyst too. But in my heart I'm a coder - and I think I'm getting better with age. And I make a nice living at it, thank you - but I put a lot of effort into setting myself up that way.
There has always been ageism in IT. I entered commercial IT relatively late in my mid-20 after being a research scientist (biological - but writing scientific code for analysis). WHen I went to move jobs at 28 looking for an Analyst/Programmer job one recruitment company told me I was 'too old'.
Ha. Since then I've done a rollercoaster so far as coding is concerned - followed the big corporate trail up though systems analyst to project manager by my mid-30s before deciding I really missed coding. Went to a small organisation as senior developer then morphed into DBA for 7 years - but started writing code at home which grew contacts and income until I started running my own consultancy a little over 10 years ago. I purposely don't grow larger because I don't want to spend my time managing other people, but I do have a large network of other consultants in complementary fields (graphics, management consultancy etc) I can collaborate with.
My clients are nearly all in the SME sector, most I talk to the boss directly and they no or limited development support inhouse. Age in this case is an advantage as experience with systems in business means that people trust me as I can both deliver software, and deliver the right software for the business context. There is something awfully satisfying about being able to go to a client and say 'you need to spend $10k on this hardware and software development to support this' and the client does it because they trust your abilities and the experience you bring to recommend that decision.
So I spend about 50% of my time writing code, 25% doing 'business IT consultancy' and 25% general purpose IT to support that - for instance several of the systems I've developed for my clients are web based - and I run the web servers to host them.
And lastly it's a great job for fitting with family life and commitments. I have my office in the house (large room, lots of computers and screens) and I work probably 10 hours a day, but it fits with family. I've been at home when my kids were small and when they've come back from school as they've grown older. I don't even have to be in one place - last week I had to see a client on site at the same city when my son is a student, so I go in, see my client at lunchtime, sit in Starbucks all afternoon coding on my laptop, then take him out for dinner. Perfect mix :-)
So ageism - phah. Ageism is only a problem if you associate with people who are ageist - and as a society we're growing older and many of those older people who do have work going are not going to be comfortable with giving it to ageist whippersnappers like DrPizza. There's plenty of opportunity for older developers, but you have to play to the strength of the experience you've accumulated and adapt. If you don't learn new technologies and stay excited by what's happening then that's your problem, not ageism.
Myself I see myself coding until I drop. I'm actually looking forward to being more flexible as I get older - when all the kids have left home we've plans to equip a camper-van with all the tech I need and wander around europe nomadically for a year or three working remotely as needed.
Coding is the best occupation ever invented. Who on earth would want to give it up?