I don't have an answer to that question that I'm completely satisfied with, but I can give you my thoughts on it.

I'm extremely wary of formal ABA or AMA style licensure. It's not that I oppose it in theory, but requiring (for example) three years of formal law school (about 50k a year at UC Irvine, less at some publics, more at some privates) isn't something I'd want to see happen to software development. I also worry about who would control licensing. I've butted heads with the "no code in JSP" crowd that wanted to replace everything with tag libraries (until Rails, with ruby code in the page, more or less swept them aside), and I watched the test-driven development crowd start suggesting that people who even questioned the value of the methodology should be unemployable, likening this to a physician questioning whether washing hands is important. I imagine what software development would be like if these people got control over licensing, and I don't like it. I also really like the fact that a math major or similar can become a programmer, that you aren't compelled to do a very specific degree or path.

There is the actuarial approach - a series of exams that don't require a specific degree, but you will need to acquire substantial math (calculus, differential equations, linear algebra, vector calc, numerical analysis, and more, followed by more industry specific topics) to pass. I like this because you can major in whatever you like, or even self study. Senior actuaries with a decade aren't quizzed at the whiteboard on whether they can do a complex integration by parts, partly because it probably doesn't matter, and partly because they have already passed a proper exam. This one doesn't scare me the way the "law school" style licensing does.

Other ideas floated are unions along the style of Hollywood unions, which provide some worker protection but allow the flexibility for high variance in talent and compensation.

All said, though I'm not sure any of this is necessary. What I actually think we need to do is just let the market work. I think we need to accept (well, powerful Silicon Valley companies and investors need to accept) that if smart and talented people don't want to become software developers in SF/SV, that's the market's answer. People respond to a wide range of variables - working conditions, quality of work, nature of work, career stability, job flexibility, compensation, the risk of age discrimination, barriers to entry, and so forth. It appears that many of the people who are able to become software developers are choosing to do something else. That's not just ok, it's great. It's human freedom.

What we have, though, is a government that, at the behest of these powerful tech companies and investors, created a shadow immigration system run by and for the interests of these corporations. We actually set up a system that creates a large pool of workers who aren't free to engage in that decision making process I described above. And I want to be clear here as I have been in the past - I am perfectly happy to see talented people move to the US! I'm not happy to see Facebook empowered to decide who is - and isn't - allowed to come here. That prevents the market from working, and it's why we continue to have "shortages" that, well, aren't.

I enjoy talking about this on HN, but I'm actually at the point where I think there is no possibility of any of the above happening. Software Developers will not organize. Congress will continue to hand Silicon Valley control over the immigration system. Immigrants who come here under tech work visas will not have the right to become florists, dental hygienists, or drywall installers, they will have to do the job Facebook says the have to do as a condition of living and working in the US. The green card system is designed to take forever, so that by the time these immigrants have freedom, many career options are closed or come at a much higher cost. That's the intent of the system, it really is. Billionaires like it, which is why it will not change.