I've heard this trope for decades, but the only time I've seen it manifest is when the 40+ people haven't learned anything in 20 years. Are there people in their 40s who've kept their skills up and still aren't getting hired?
Ok but how common is this? Can the average old developer expect to have "kept their skills up" to some arbitrary standard even though we know humans tend to calcify in their thinking, have lower risk appetite and worse memory as they get older? If my cohort consisted of John Carmack and Jeff Dean type outliers, I could also claim that they have no trouble getting jobs in their older age but it wouldn't be a particularly helpful observation for most developers. IMO it's a very realistic & plausible scenario for many to not have kept their skills up and end up unhireable as they get older.
In my experience, it's the norm. I'm pushing 50, and I'm more in demand every year than I was before. I have dozens of friends my age in tech, and it's the same for all of them. I don't keep my skills up to an "arbitrary standard;" I've learned continuously throughout my career. I haven't tried to keep up with modern technology, I've just done it. I'm always learning, I change jobs every few years to follow my interests, I look for challenging things because I'm motivated by the same quest for knowledge and enjoyment that got me started in my career in the first place. I think you have to go out of your way to stagnate, or at least be so passive that you probably picked the wrong career in the first place. This isn't just an issue with IT jobs; you can be a skilled laborer in any trade, and if you don't learn along the way, you'll become obsolete. But if you're not learning along the way, what are you doing it for?
Honestly I hope you're right. I think many people (especially nowadays) pick SWE as a well-paying stable profession without being motivated by a noble quest for knowledge and enjoyment. And even though I personally may have passion now, I think it's possible that I may lose it later as I run into negative experiences like burnout.
I wouldn't say it's a noble quest; it's just what I like to do. I agree, there are a lot of people who now get into SWE because they want a stable, high-paying job, and not because they actually want to do it. If they can't get hired in their 40s, I say good riddance. People who are only in it for the money--and do the minimum to get by--aren't good coworkers. I hope they find a career they enjoy.
It's unfortunate that tech eats so many people who would rather be academics, researchers, artists, craftsmen. I get it; tech pays stupid high salaries to smart people who can do it, but want to do something else. I've run into a lot of PhD physicists who are coders because there are only so many jobs for a physicist, and they invariably pay less than entry-level web coding jobs. Many of them find they enjoy software, and make for great coworkers. But there are a lot of people who only do it for the money, and science, art, and other fields are worse for it. Tech eats everything.
I'm fortunate, I guess, in that I started in a tech career because it was what I enjoyed as a hobby. When I started out, it wasn't the best way to make a buck. My first few jobs paid less than I was making working in construction, and far less than a teacher made. I got lucky, financially.