The rules for professional conduct, and the organization to enforce it for lawyers, did not prevent the NSA/DOJ lawyers from determining that mass surveillance was legal, and could be implemented legally.
In the face of that, what rules for professional conduct and an organization to enforce it like lawyers have, could engineers have implemented that would have prevented those engineers from building that system?
They didn't build the surveillance system, nor did they pass the laws in the first place that would allow for such a system to be legally built.
Regarding the engineers here, it's not black and white. Looking at the ACM code of ethics, #1 is "Software engineers shall act consistently with the public interest." Is building a mass surveillance system "in the public interest?" That's grey. My personal opinion is "no", but I can see the point of view of "Protecting my country from terrorists is in the public interest."
If we're going to look at the NSA surveillance systems, the first place to look is at the legislators. If we want to prevent the government from building such systems, step 0 is to make these systems illegal. That ripples down all the way through this: the lawyers' analysis would have come up negative instead of positive, and it's clearly not in the public interest to build systems that have been democratically-determined to be negative.
Note that I specifically mentioned mass surveillance because the original poster pointed it out as "field that enables mass government surveillance", then wonders about the implementation of a "rules of conduct". The natural implication being that those rules of conduct would have helped stop the enabling of mass government surveillance.
I'm not convinced that what the NSA/DOJ lawyers did here was unethical. One of a lawyer's roles is to answer the question: "Is what I'm about to do legal? On what grounds?"
The lawyer says, "This is legal, here are the grounds for believing it is so. I'll go into court and defend it". The engineer says, "This is technically possible, there are the grounds for believing it is so. I'll build it and maintain it". What is the reasoning for saying then that a lawyer has acted ethically (even though mass surveillance is not in the public interest), but the engineer has acted unethically (because mass surveillance is not in the public interest)? What is the quintessential concept that allows lawyers to ignore the public interest, but precludes the engineer from doing so?
And if there is nothing that we can point to that differentiates lawyers and engineers in this manner, then how would a professional code of conduct (like lawyers have) prevent the actions that the original poster specifically highlights.
> This is technically possible, there are the grounds for believing it is so.
I don't see an ethical conundrum here. Determining whether a system could be built is amoral at worst, or in the public interest at best. If an engineer says "this could be built" and a lawyer says "this could legally be built", that's when you get into a spot where you can have real societal discussions about whether or not it should be built.
If something is legal to build, but impossible to build (given current technology), then it's mostly an idle curiosity. If something's illegal to build, but technically possible, then there's reasonably compelling evidence that you probably shouldn't build it (save for, e.g. civil disobedience).
> I'll build it and maintain it.
That's where the ethics comes into play, and the grey area. If something is both legal and feasible, then it's up to you to decide whether or not it's something you want to be part of. I can look at the folks who built the mass surveillance system and say "I don't believe that was ethical", and others can look at it and say "I'm so proud of these people for defending my country".
An opposing piece of technology would be end-to-end encrypted messaging. In my world view, end-to-end encrypted messaging is perfectly moral. I believe that people should be able to communicate without having their conversations eavesdropped. But I also recognize that this does enable immoral/unethical activity as well; it's just that, to me, the balance leans towards private communication. Others may (and do!) disagree.
Among the various professions that do have an ethical code of conduct, generally speaking lawyers/solicitors are not seen by a large amount of people as being particularly compliant with it.
Now of course it is very possible that it is a wrong perception by the masses, but it is in my opinion quite unlikely that at the moment the argument "engineers lack a code of conduct, they should take lawyers as an example" will gain much popularity.
It just so transparently doesn't work in that field it's hard to even take the proposal as in good faith, since it has to ignore newsmaking and routine behavior. Rather, it comes across as a self-righteous comment: we have ethical standards (even if we routinely don't adhere to them and do terrible things as a matter of course) so clearly those engineers would be better if they were more like us!
The sarcasm likely wasn't constructive, so I'll apologize for that.
Having enforceable rules may improve ethical standards in the field without solving the problem entirely.
I'd also like to point out that I did not propose a solution. I think it should be considered, but I'm a long way from supporting the idea fully. There are a lot of negatives that come with license requirements that attorneys have.
The only rules I've seen applied to lawyers with any regularity are those governing decorum (eg, don't be an ass in court) or client obligations (ie, don't be a shitty contractor) or those that are also criminal (eg, if you commit fraud, we'll yank your license too). Technology could do better there.
But to call out government surveillance or cyber warfare, which are both overseen by legal departments that work diligently to inventively authorize the acticity? Or dark patterns and data collection, where lawyers go through contortions to authorize it in "agreements"?
I would say all four of your chosen examples are more failings of lawyers than engineers. (Though both bear some responsibility.)
It just seems strange to suggest professional rules for engineers would've stopped something that clearly professional rules for lawyers did not.