Consider doctors, dentists, lawyers, CPAs, or other higher-prestige professionals. They engage in protectionism to restrict competition and drive up their earnings and rarely if ever give away their services for free, and they are much, much more respected than we are. And on the rare occasion that they do perform some act of charity, such as working as a public defender or providing discounted dental care to the poor, they usually still get paid for it, just not as much, and they make a big show of it so everyone knows that they're taking a huge paycut for a good cause and thus deserve even more respect than they get already.
Programmers by contrast are rapidly conditioning the public to expect software to be cheap or free, regardless of how long and difficult it is to produce, to the point where iPhone devs complain they can't sell their apps for the price of a cup of coffee.
Programmers need to worry about their future and should probably spend their 20s and 30s making as much money as they can writing proprietary software before they hit 40 and become increasingly unhirable due to ageism instead of performing unappreciated acts of charity in the form of open source for an ungrateful public.