Grade by Grade
D. Topics in Computer Science · Topics in Computer Science: Sustainability, Ethics, Emerging Technologies and Careers

Codes of Ethics for Computing Professionals: ACM, IEEE and Beyond

D2.2About 70 minutes
Learning goals
  • I can explain why computing professionals need a code of ethics, using examples such as plagiarism, backdoors, viruses, spyware and logic bombs.
  • I can describe the structure and key principles of the ACM and IEEE codes and the Software Engineering Code of Ethics.
  • I can identify the essential elements shared by codes of ethics and apply them to a workplace scenario.
  • I can explain how a structural code-similarity checker works and its limits.

Words to know

code of ethics
A public statement of the duties and standards a profession's members accept.
backdoor
A hidden way to bypass a system's normal authentication or security.
logic bomb
Code that performs a harmful action when a condition, such as a date or event, is met.
spyware
Software that secretly gathers information about a user or device.
virus
Malicious code that copies itself into other files or programs and spreads.
Jaccard similarity
The size of the intersection of two sets divided by the size of their union.
whistle-blowing
Reporting wrongdoing inside an organization to people who can act on it.

Power needs rules

Programmers build systems that run hospitals, banks, cars, elections and schools. A small decision in the code, such as how carefully input is checked or whether a hidden password is left in, can affect millions of people who will never see the code. Professions with this kind of power, such as medicine, law and engineering, write codes of ethics: public statements of the duties their members accept.

Expectation D2.2 asks you to describe the essential elements of a code of ethics for computer programmers, using the ACM and IEEE codes as examples, and to explain why such codes are needed.

Why codes are needed: what can go wrong

  • Plagiarism: copying others' code or ideas without credit (see Intellectual Property).
  • Backdoors: hidden ways into a system that bypass normal security, sometimes left "for testing" and later found by attackers.
  • Viruses and other self-spreading malware.
  • Spyware: software that secretly collects information about users.
  • Logic bombs: code that does damage when a condition is met, such as a date or a programmer's account being deleted.
  • Deceptive software: in 2015 Volkswagen admitted that software in millions of its diesel cars detected when the car was being tested for emissions and changed how the engine ran so it passed, while emitting far more pollution on the road. Engineers wrote that code.
  • Unsafe software: in the 1980s, software errors in the Therac-25 radiation therapy machine contributed to patients receiving massive radiation overdoses. The case is still taught as a lesson about testing, honest reporting of problems and safety-critical design.

Laws forbid some of these, but not all, and laws can't anticipate every situation. A code of ethics guides professionals in grey areas and tells the public what to expect.

Malicious code a code of ethics forbidsBackdoora hidden way to bypass normalsign-in, left in by a developerViruscode that copies itself into otherfiles or programs and spreadsSpywaresoftware that secretly collectsinformation about usersLogic bombcode that does damage when acondition is met (a date, an event)
Four kinds of malicious or deceptive code named in the curriculum. Each one abuses the trust users place in programmers.

The ACM Code of Ethics and Professional Conduct

The Association for Computing Machinery (ACM), one of the largest computing societies in the world, updated its code in 2018. It has four sections and 25 principles (7 + 9 + 7 + 2), each with guidance:

  1. General ethical principles, such as 1.1 contribute to society and to human well-being, 1.2 avoid harm, 1.3 be honest and trustworthy, 1.4 be fair and take action not to discriminate, 1.5 respect the work required to produce new ideas and creative works, 1.6 respect privacy, 1.7 honor confidentiality.
  2. Professional responsibilities, such as high quality work, competence, knowing the rules that apply, professional review, thorough evaluation of risks, working only in areas of competence, accessing systems only when authorized, and 2.9: design and implement systems that are robustly and usably secure.
  3. Professional leadership principles, starting with 3.1: ensure that the public good is the central concern during all professional computing work; it also covers caring for systems when they are changed or retired, and taking special care with systems that become part of society's infrastructure.
  4. Compliance with the code: uphold and promote it, and treat violations as inconsistent with ACM membership.
Structure of the ACM Code of Ethics and Professional Conduct (2018)1. General ethicalprinciples1.1 to 1.72. Professionalresponsibilities2.1 to 2.93. Professionalleadership principles3.1 to 3.74. Compliancewith the code4.1 to 4.2Examples: 1.2 Avoid harm. 1.6 Respect privacy. 2.9 Design and implement systemsthat are robustly and usably secure. 3.1 Ensure that the public good is the central concernduring all professional computing work.25 principles in all, each with explanatory guidance.
The ACM code's four sections. Principle numbers make it easy to cite the exact principle you are applying.

The IEEE Code of Ethics and the Software Engineering Code

The Institute of Electrical and Electronics Engineers (IEEE) code is shorter. It is organized in three sections. The section headings below are quoted from the code; the items after each heading are paraphrased summaries, not the code's exact wording:

  • I. "To uphold the highest standards of integrity, responsible behavior, and ethical conduct in professional activities": put the safety, health and welfare of the public first, protect others' privacy, help society understand technologies (including intelligent systems), avoid conflicts of interest and bribery, accept and give honest criticism and correct errors, credit others' work, and work only within your competence.
  • II. "To treat all persons fairly and with respect, to not engage in harassment or discrimination, and to avoid injuring others": this includes not harming others, their property, reputation or employment by false or malicious action.
  • III. "To strive to ensure this code is upheld by colleagues and co-workers", including supporting those who report violations.

The Software Engineering Code of Ethics and Professional Practice (developed by the ACM and the IEEE Computer Society, 1999) has eight principles named for those a software engineer owes duties to or must care about: Public, Client and Employer, Product, Judgment, Management, Profession, Colleagues and Self. The first principle, Public, says software engineers shall act consistently with the public interest.

In Canada, the Canadian Information Processing Society (CIPS) has a code for IT professionals, and in Ontario the title "professional engineer" is protected and engineers licensed by Professional Engineers Ontario (PEO) must follow a code of ethics set in regulation.

The essential elements

Comparing codes, the same core elements appear again and again:

  1. The public good comes first, ahead of employer, client or personal gain.
  2. Avoid harm, including to the environment and to people outside the project.
  3. Honesty and integrity: no deception, honest claims about what software can do, admit and fix errors.
  4. Competence: only take on work you are qualified for; keep learning.
  5. Privacy and confidentiality.
  6. Fairness: no discrimination, in the workplace or in the software.
  7. Respect for intellectual property and credit for others' work.
  8. Quality and security: thorough testing, secure design, no backdoors.
  9. Accountability: report problems, support colleagues who raise concerns, and accept review.
Worked example

Example 1: Applying the codes to a request

Your manager asks you to add a hidden account with a fixed password to a school-records app "so support can always get in if a customer locks themselves out". It won't be mentioned in the documentation. What do the codes say, and what should you do?

  1. This is a backdoor: a hidden way to bypass normal sign-in. If it is discovered, attackers can get into every school's records.
  2. ACM 2.9 (systems that are robustly and usably secure) and 1.6 (respect privacy) are violated: student records are exposed.
  3. ACM 1.3 (be honest and trustworthy) and IEEE section I (honest, responsible conduct) are violated because customers aren't told.
  4. ACM 3.1 and the Software Engineering Code's Public principle put the public (students, schools) ahead of the employer's convenience.
  5. Action: explain the risk to your manager in writing and propose a safe alternative: a documented, audited account-recovery process that requires the customer's verification. If you are overruled, use your organization's escalation process.

Decline to add an undocumented backdoor, explain the specific principles and risks, and propose a secure, documented recovery feature instead.

Detecting plagiarism with Python

Teachers and companies use software to flag possible code plagiarism. Renaming variables doesn't fool a good checker, because it compares the structure of code. The program replaces every name with ID, cuts the code into overlapping groups of three tokens (trigrams), and measures overlap with the Jaccard similarity: the size of the intersection divided by the size of the union.

import keyword
def tokens(code):
out = []
for word in code.replace("(", " ( ").replace(")", " ) ").replace(":", " : ").split():
if word.isidentifier() and not keyword.iskeyword(word) and word not in ("print", "range"):
out.append("ID")
else:
out.append(word)
return out
def trigrams(toks):
return {tuple(toks[i:i + 3]) for i in range(len(toks) - 2)}
def similarity(a, b):
ta, tb = trigrams(tokens(a)), trigrams(tokens(b))
return len(ta & tb) / len(ta | tb)
original = "for i in range(10): total = total + i"
renamed = "for k in range(10): s = s + k"
different = "while x > 0: x = x - 1"
print(round(similarity(original, renamed), 2))
print(round(similarity(original, different), 2))

Sets make it easy: & is intersection and | is union. A score of 1.0 means the structures are identical.

1.0
0.12

Output of the program above (what Python prints).

Just for fun

The ACM code contains 25 principles. "Avoid harm" made the list.

"Never deploy on a Friday afternoon" did not, though many programmers treat it as unofficial principle number 26.

Hands-on activity

Write your own code of ethics

You need: paper or a document, and the ACM and IEEE codes (search for "ACM Code of Ethics" and "IEEE Code of Ethics" on the official acm.org and ieee.org sites).

  1. Read both codes. Highlight three principles from each that surprise you or that you think matter most.
  2. Write a one-page code of ethics for student programmers at your school with 6 to 9 principles. Each must include one of the essential elements and a concrete example (for example "We credit adapted code in comments with source and licence").
  3. Add a section on what happens when someone breaks the code and how a person can report a concern safely.
  4. Test your code on two scenarios: a friend asks to copy your assignment; your group's app collects more data than it needs. Does your code give clear guidance?

What to look for: principles tied to the essential elements, concrete examples, an enforcement and reporting section, and a test showing the code gives usable guidance.

Your turn

1

Define a backdoor and a logic bomb.

2

Name the four sections of the ACM Code of Ethics.

3

What does ACM principle 1.2 say?

4

Name the eight principles of the Software Engineering Code of Ethics.

5

Give three essential elements found in most codes of ethics for programmers.

6

Why was the 2015 Volkswagen case a software ethics issue?

7

What does the plagiarism program print for original and renamed, and why?

More practice: warm-up

1

What do the letters ACM stand for?

2

What do the letters IEEE stand for?

3

What is spyware?

4

Which ACM principle says to respect privacy?

5

What is the Jaccard similarity of two sets?

More practice: on your own

1

Find the Jaccard similarity of {1, 2, 3, 4} and {3, 4, 5}.

2

A developer quietly adds code that deletes the company's files if her account is ever removed. Name the type of code and two principles it violates.

3

Why is "the public good comes first" placed above loyalty to an employer in these codes?

4

A free game app secretly uploads players' contact lists to sell to advertisers. Which kind of software is this, and which principles are broken?

5

Why does the plagiarism checker replace names with ID before comparing?

Challenge

1

Compute by hand: tokens("while x > 0: x = x - 1") and the number of trigrams it has.

2

The plagiarism checker gives a high score to two students who both wrote a standard 3-line loop to sum a list. Explain why a high score is not proof of plagiarism and what a fair process should include.

3

Compare how the ACM code and the Software Engineering Code are organized. Why might each structure be useful?

Check your understanding

Quiz

1.

Which is the best description of a backdoor?

2.

Which ACM principle states that the public good should be the central concern of professional computing work?

3.

The Software Engineering Code of Ethics is organized around…

4.

What is the Jaccard similarity of {a, b, c} and {b, c, d, e}?

5.

Why do codes of ethics exist when laws already forbid some harmful acts?

6.

In the 2015 Volkswagen case, what did the software do?

For parents and teachers

Big idea: D2.2 asks students to describe the essential elements of a code of ethics for programmers (such as the ACM and IEEE codes) and explain why such codes are needed (plagiarism, backdoors, viruses, spyware, logic bombs).

How to help: If your own profession has a code of ethics, share it and compare it with the ACM code. Discuss Example 1: what would your teen do if a boss asked for something unsafe? Help them practise saying "no" with reasons and an alternative.

Common difficulties:

  • Mixing up the types of malicious code (a virus spreads itself; a logic bomb waits for a trigger; a backdoor bypasses sign-in; spyware collects information).
  • Listing principles without applying them to a situation.
  • Treating a plagiarism checker's score as proof. It only flags code for a human to review.
  • The Therac-25 and Volkswagen cases involve real harm; discuss them respectfully as lessons about responsibility.