The actual scale of the work certainly informs the compensation, like it might for other jobs like journalists for example, but that is only part of the story. If you need developers, you simply gotta pay them salaries the are competitive with what others pay for that particular role.
Using dkopi's example, at a company with 2M users, it's worth hiring a developer for each "penny per user per month" problem. A company with 1B users, it's worth hiring a developer for each "0.002 pennies per user per month" problem.
Or similarly, if you look at developers who work on internal tools that save other developers time. At a startup with 40 employees, each new tools developer must save everyone else two days per year. At a large company with 20 000 developers, each new tools developer must be able to save everyone else 6 minutes per year.
As the scale gets bigger, smaller and smaller problems become worth hiring people for.
Long term Efficiency versus short term gains is the issue.
A company like google can get away with this but not most.
How much impact does a laborer repairing a Dutch dike have? How much of that impact do they earn?
Most times the toll roads also have to compete with "free roads", limiting the amount of money you can charge per ride. http://reasonrail.blogspot.co.il/2011/06/do-toll-roads-make-...
However, there are infinite ways a developer can make something. 1 developer can make design a system that can save/make their company millions that most other developers would miss. The supply side of developers is more like a monopolistically competitive market. Thus, they can extract some of those savings/profits in wages.
It would be interesting to compare revenue or profit per employee for tech company, comparing to law firms and the like.
Another thing is that we believe (ie. The Mythical Man Month) in software, there is a limit of programmers per task before you just can't throw any more body into it anymore. Is this true (or still true), and does this apply to other fields of comparison?
Immigration could likely be a bigger factor than we thought. How long has developer compensation been skyrocketing? The immigration situation to the US has only been getting shittier for the past 5-7 years mostly (although it wasn't flower and pleasant before that, if you wanted to do startup or worked in the US with a job offer, it's several folds easier back then). And seeing that it takes like 5-7 years for a startup to mature, even longer for immigration "market" to catch up with reality (it takes a long time for people to decide or to immigrate in general), it wouldn't be a surprised that compensation is still lopsided for the US.
Apple makes about $2m/employee/year. Goldman Sachs makes about $1.2m. These metrics are easy to get for any public company.
This is important. The effect is that to complete the task you have to effectively scale the team up, you can't scale horizontally, which increases demand on top talent.
It means that if a programmer is (theoretically) 10x more effective than an average programmer he may get much much more than 10x the pay.
A programmer working at a large internet company may be impacting millions upon millions of people. Building a feature that lets you collect (or save) a penny from a user every month is worth $240K a year when spread out over 2 million users. $120M when spread out over 1 billion users.
That's really my answer to the common question at the end of the post: "I don’t understand this at all and would love to hear a compelling theory for why programming “should” pay more than other similar fields, or why it should pay as much as fields that have much higher barriers to entry."