There are growing complaints that Silicon Valley companies discriminate against middle-aged engineers. But it might not be just ageism, it might just be aggregation error.
Engineering comprises mainly two things: a body of knowledge and a problem-solving mindset. To be a good engineer one needs an up-to-date body of knowledge in the relevant field and a facility with different problem-solving approaches used in the field (and possibly outside it as well).
(For the moment let's leave aside the problem-solving mindset; its dynamics are complicated and very situation-dependent: while some engineers acquire and develop problem-solving skills with experience, other fossilize their thinking, for example due to organizational practices.)
As part of what I do is continuing education, I have observed the dynamics of the body of knowledge as engineers' careers progress.
- The largest group by far (sadly), makes little attempt to keep up-to-date with their field after formal education ends. In conversation, after a corporate training event, a member of this group told me that keeping up-to-date was "very nice in theory, but we don't have the time." All of us would like more time; but this person spent tens of hours per week watching TV. One of those hours per week spent updating their skill set would mean 52 hours per year, which would be more than enough (most of the participants in that event had fewer than 20h/year of training or study, and self-paced learning can be much more effective than group events.)
- Most of the remaining engineers realized their technical obsolescence would become a problem and were retooling themselves for a management job. The main problem with this attitude is that there will always be fewer management jobs than engineers who plan to go into management. Secondarily, firms have both partially replaced management jobs with consultancy engagements and started prioritizing management-trained applicants over engineers.
- A few engineers fell into a third category: those who keep up-to-date either because they realize the job implications of doing so or because they really love their engineering field. The problem, for those in this group, is that their small number makes them liable to be categorized into one of the other groups.
Placing ourselves in the position of Google, for example, the decision to consider a candidate who's been out of formal education for several years versus considering one that's just graduated --- even if Google believes that the energy of youth can be balanced by the temper of experience --- comes down to which of the three groups above the older candidate will fall into.
In the absence of good information, statistically the older candidate will be in the first group, in other words, aged, not experienced, a distinction that most of the engineers can but will not make (as it defeats their case).
(The younger candidate's type is irrelevant, because being fresh from school means an up-to-date skill set, at least for the near future.)
There are obviously many confounds: consider a choice between a newly minted computer engineer from Idaho State - Tubertown with no code to show (not even from school projects) versus a 45-year-old Caltech graduate class of '95 who has code on GitHub that is particularly relevant to the job, for example.
For the other engineers, who have been lax in their updating of skills, there's a solution: it's never too late to learn. And then: show, don't tell.