If it were possible to commit programmers to a code of ethics, it would be possible to do what most professions do an organize to protect the careers and incomes of professionals. On top of the code of ethics would soon be refusing to work on any team with H1-Bs, just as doctors, lawyers, and accountants don't work with any peers who haven't passed the same qualification hurdles as they have.
I don't like the idea of extensive central regulation, but it might well be better for programmers' lives.
I don't like the idea of extensive central regulation, but it might well be better for programmers' lives.