One of the truisms of computer science and computer industry is that the practice in industry reflects things that were current in computer science one or two decades ago. If a SmallTalk or Lisp developer fell into a coma 10 or 20 years ago, they are not going to be shocked by how much progress has been made while they were out of commission. They are going to be amazed that the median developer still does not have as productive environment as they did when they were last conscious.
Give them a couple days to get up to speed on the general idea behind HTML and web browsers, and a couple more days to get the specific details of whatever C derived syntax is being used, and they will be ready to be productive. If you are a new developer, everything you are learning is new. For an old developer, it's just a matter of learning the diffs.
So even if the technology is "legacy" - there is a lot you can bring forward to almost any domain.
I went on a few interviews, and I didn't get either job. I passed a phone screening, long brutal technical quizzes, and a few hours with managers. These were for senior dev positions, but I suspect most of the candidates were younger, maybe late 20s early 30s.
I didn't feel any age-related discrimination at all, but I still felt something was wrong. I started asking myself, "why am I standing here, at a whiteboard, showing an interviewer how to recursively search a binary tree?" "Why am I creating the primal of the dual and proving that the min of one problem is the max of the other under optimal circumstances?" I solved the problems, but maybe they picked up on something from me that shows... maybe a slight irritation or exhaustion.
I realized that it's not ageism. I was irritated with myself. Sure, I "shouldn't" be doing this for the umpteenth time, but the shouldn't is directed at me, not them.
If you've been in the business for over a decade, yeah, maybe you "shouldn't" be taking technical quizzes, but that's because you "should" have a reputation to stand on, not because interviewers should see your grey hair and decide that it's a stand-in for testing your technical chops! (I got into programming late, so even though I'm 37, I've only been seriously programming for about 10 years).
I remember Joel Spolsky (a big proponent of having devs write code during interviews) still said (I'm paraphrasing here) "if you're an independent film maker and Uma Thurman is interested in your film, you don't ask her to audition, you try to sign her!"
The top celebrities in our world tend to be the leads on extremely successful open source projects. While very few devs can get this "celebrity" status, you can still a smaller useful network - and really, how many job offers do you really need?
Speaking at conferences, working on open source projects, working on side projects, writing interesting articles in a blog are all good ways to do this. On a much smaller level, just being very helpful and engaged in your job, and producing good software can help.
I'm on that smaller level, but I realized "why am I doing this?" I called up my network, discussed some jobs, and got a nice senior dev/architect position pretty quickly. No technical interview was needed, because these folks had already worked with me on code plenty of times.
It's not ageism to say that your career and approach to development needs to change as you get older. Another line I loved from a movie called "surfing for life" - "age is inevitable, it's the growth that's optional".
Use connections instead of competing.
Experience does matter. LOC per year dont matter; it's writing the right lines, or choosing the right architecture that does matter.
geebee hit the interview nail right on the head. Most interviews are structured to weed out incompetent new grads, hence the programming tasks and the language lawyer questions. When I'm in an interview, I really dont want to waste my time describing when I would use an abstract class over an interface. Why waste time with programming problems with someone who has been doning it for 20-30 years. The successful interviews discuss how I would tackle the real problems that the company faces.
If someone asks you to do something that seems "beneath" you or trivial, just do it as well and as quickly as you can so you can get it over with and talk about more interesting things, or use the problem itself as an excuse to start a conversation about something more interesting than the problem itself ("the interesting thing here, is that if you write it this way it's easier to test" or "if you used a language like X, you could write this more easily," or "realistically, I think this function would be more useful if you changed it to behave like this, so that it would then be useful for doing Y and Z as well as X.")
It's nothing personal, it's just the interviewer's job to be skeptical about your stated skills until you prove to him or her that they shouldn't be.
There is also shops which are driven by buzzwords rather than actual technology, who are just looking for bunch of kids who match a keyword list. I wouldn't want to work there anyway (whether at my present age, or in ten-fifteen years).
There's also the illegitimate worry: "some 22 year-old will replace me"; this is of the same genre as "my job will get outsourced to India". The answer to that is don't do simple, trivial work. Be something besides a byte pusher (incidentally, great deal of "web development" is indeed simply pushing bytes). Anyone can make a CRUD app with PHP and MySQL: learn something which isn't immediately listed in the craigslist jobs section, perhaps? I'd argue that, for example, no place that is hiring Haskell developers or developers with understanding of machine learning practices age discrimination.
The reality is, once you hit 30, if there's a tangible "layoff list" anywhere you work, you have a serious career risk you should mitigate.
But, in one defense industry company I worked at the average developer age was in the 40s. If anything there was reverse ageism there.
Point is just be good at what you do and dont worry about it.
I think that a problem a lot of aging developers face is that many of them went into "programming" because, like law or medicine, it was a respectable career choice that provided a middle-class standard of living and a cozy work environment. This is fine, but if you're not willing to dedicate serious energy to keeping your skills up to date, you are going to be forced to contend either with an income plateau, or a move into management.
Let me be clear; I do not think those traits are net positives overall. The fact that when we are young we are a bit too willing to defer to authority is an artefact of buggy monkeyware. Any Manager/CTO who hires youngsters because they are easy to browbeat and relatively cheap is on crack; it feels real good at first, but it destroys you sooner rather than later.
Most teams benefit from a diversity in age as well as in outlook. You need people who are experienced enough to be able to see through the bullshit, but you also need people who will stay up late hacking on a skunk works project because they are excited about the work.
A sailboat with no friction (keel) can only run before the wind; it is wholly unable to sail against the wind.
That is a large qualification. It is possible that quality of work and willingness to be browbeaten are inversely correlated.