Re ageism, it depends on where you are and what you are working on. I know and have known many who have 30, 35 and 40 years in and stayed in engineering.
For development, it's all about having your niche. If your niche is stable, age isn't an issue. If your niche is going away, there's little reason to keep a 50 yr old C cubicle guy to switch to consulting, 50% travel and code the latest flavor. There's just no cruising on your laurels anywhere anymore and the market turns over much more quickly.
My observation of recent layoffs is that it's ageism in that most of the people in these jobs are well into their 50's and some into their 60's. Young is 40, and if you weren't in a critical niche, you were just as likely to go as any.