Your food shortage example isn't relevant to programmer shortages. Food shortages typically only occur when governments impose price controls that artificially force prices below the market price. Then farmers stop growing and distributors hoard supplies. Total worldwide food production is far in excess of what it would take to adequately nourish all 6.5B+ people; for practical purposes food production capacity is unlimited. Major famines now are typically caused by breakdowns in the distribution system due to wars, natural disasters, or active governmental malice (c.f. North Korea and Zimbabwe); this is not a market issue.
The fundamental point is that if there really were a shortage of programmers then programmer compensation would be rapidly increasing. However, industry data shows that average compensation is increasing at only slightly more than the rate of inflation. Therefore, there can't possibly be a shortage right now.
I am thinking in more abstract terms, not making any claims about todays actual food production. Historically, I think most of the time food shortage was caused by climate problems (bad weather, eroding soils, etc). I just wanted to make the point that the market will not always be able to provide what everybody needs, simply because the market can not provide more than what is available.
Interesting point about the compensation rates, but I'd like to think more about the issue before accepting the argument (note that I don't claim that there is a shortage of programmers).
The fundamental point is that if there really were a shortage of programmers then programmer compensation would be rapidly increasing. However, industry data shows that average compensation is increasing at only slightly more than the rate of inflation. Therefore, there can't possibly be a shortage right now.