You know, people worry about age discrimination a lot because there aren't a ton of older programmers around. But when the discussion comes up, people don't talk much about the reasons you describe.
Sure, bad programmers age out because they were never great at programming in the first place. But I would assume the HN crowd falls in the top half of competence because there are so many people here who seem smarter about programming than me. If you're good, you don't have to worry.
Maybe good programers age out because the technical side gets too repetitive, their jobs become more about politics, and they have enough money to change tracks later in life.
The changing nature of the job is definitely part of it. When you're on the steepest part of the learning curve, that makes up for a lot. I still learn plenty, but less than I used to. Instead, I spend a good deal of my time correcting mistakes made by those who hadn't learned yet. Mistakes happen, that's OK, but it's still less fun than learning new things myself. At my age/experience there's also an expectation that I'll do more "force multiplier" work - for me it's often fixing broken infrastructure - so that others can stay more productive with straight coding. Again, nothing wrong with it, but still less fun.
When it gets downright tiresome is when being the project janitor puts me in conflict with young "tech leads" who denigrate those contributions because they've only ever worked on that one project where other people took care of those things for them. It's like the difference between living in a college dorm where everything's taken care of for you, vs. having a house and kids and bills of your own. Being a strict individual contributor with no cares beyond the one piece of code in front of me is just a fond memory.
Unfortunately, few companies will hire someone with 30+ years' experience just to write code, even for a salary appropriate to that role. Companies want to pay those lower salaries not only for direct work product but also for growth potential. The worst part is, I know they're not wrong. The only way to do the kind of work I really enjoy, and only that work, is as a hobby.
You don't have to worry about keeping your current job, but getting a different one becomes a lot harder. Your 27 year-old interviewer might be thinking "You're my dads age, and my dad is crusty. No way you can wrap your head around lib-of-the-week.js"
> You don't have to worry about keeping your current job
Depends on the job. There are employers who recognize the value of somebody who has broad experience, and who can/will do things that are necessary but not fun. There are also employers who only measure hands-on-coding skills, and/or who insist that everyone should be on a "growth path" even if they're already at a higher level than most will reach. Good people don't have to worry at the first kind, and very much have to worry at the second.
Sure, bad programmers age out because they were never great at programming in the first place. But I would assume the HN crowd falls in the top half of competence because there are so many people here who seem smarter about programming than me. If you're good, you don't have to worry.
Maybe good programers age out because the technical side gets too repetitive, their jobs become more about politics, and they have enough money to change tracks later in life.