Recently I ran into a thread about salary comparison for software engineers compared to the general population. Some comments quickly gravitated towards engineering salaries as compared with other individual professions, with the first mentions being law and medicine.
In my experience, these comparisons (as opposed to salaries of, say, teachers or chemists) are commonly made by those in the software industry. It seems to suggest the expectation that many in tech might reveal: "If I weren't a programmer, I might be a doctor or a lawyer." Doctor and lawyer are two professions those of a certain age heard about or aspired to the most, so this perhaps makes sense.
At least a couple of commenters referred to a lack of respect for the software profession by the general public. It was suggested that the shortage of developers (if you believe this is a real thing) could be attributed to a "rational response" to the software industry's pay, working conditions, and job security being less than optimal.
I found that line of thinking a bit surprising. Within the industry there is obviously a significant amount of discussion about the topics of fair compensation, disfunctional company culture, and unwelcoming envirnonments, but are these topics widely discussed outside the industry? When you introduce yourself as a software engineer to non-technical contacts, are you greeted with "Oh, you poor thing! Let me buy you a warm meal."? Does programming have a reputation problem held by those in other industries? I'd encourage you to comment on your experience.
This is just a theory, but I don't think the industry has a widely-accepted reputation as being marked by abuse towards a contingent of thoroughly underpaid and overworked employees. I expect the image of the Googler eating free sushi in a bright and airy sun-kissed California building complex is more likely to be conjured, and I would be surprised if a survey of typical high school students would detect any significant negative stereotypes about pay or conditions. I might be wrong.
A Simpler Explanation?
The technology boom period of the late 90's coincided with the increased availability and affordability of home computers and the growth of the web as a source for an abundance of information. This period may have been the first time the general public was widely exposed to the software industry at all. As a child born in the early 70s who had great access to computers from an early age, a mother who taught programming classes, and above average math skills, I can't say I was ever directed towards programming as a potential career option.
Baby Boomers and their parents were probably infinitely more likely to encourage their children and grandchildren to "Be a doctor" or "Go to law school" (or the generic "go into business") than "Learn C". My generation grew up with plenty of television shows and films featuring glamorized depictions of doctors and lawyers, but no notable examples about software or computers (though I did see the original Tron in theaters).
I would theorize that any current shortage in software development could be at least partially attributed to two factors. The first and most obvious is an enormous spike in demand. The second factor would simply be ignorance. My generation (Gen X as it's usually known) is arguably the first generation of adults that has any significant population that would encourage their children to "Learn C" in lieu of law or medical school.
Unlike commenters in the aforementioned threads, I can't imagine the industry's reputation is a major factor in repelling potential entrants. Actually, I think the industry's reputation is likely attracting many more than it is turning off, although I expect some will contest whether those being attracted are the ones the industry wants or needs.
Stereotypes and generalizations about the value of different professions can take years or even generations to develop within cultures. Generations that were raised without computers may be unlikely to suggest technical careers to youth. As the generations raised using technology reproduce and guide their children while the software industry continues to gain visibility in pop culture and entertainment, one can expect to see more students entering the field. It takes time.