These notes recap Topic 3.2. For explanations and worked examples, see the study guide.
Recap
- System reliability: a program performs its tasks as expected, under stated conditions, without failure.
- Programmers maximise reliability by testing with a variety of conditions: ordinary, boundary, extreme and special-case values.
- The creation of programs has impacts on society, the economy and culture. Impacts can be beneficial and harmful.
- A program built for one purpose can have unintended harmful effects beyond its intended use.
- Legal and intellectual property issues arise when creating programs. Programmers often reuse code that others have published as open source and free to use. Code not published as open source needs the owner’s permission and often payment.
Key relationships
| Idea | Question to ask | Good evidence in an answer |
|---|---|---|
| Reliability | Does it do what is expected under the stated conditions? | Tests covering ordinary, boundary, extreme and special values |
| Benefit | Who gains, and why? | A named group and a mechanism from the program’s design |
| Harm or unintended effect | Who loses or is affected beyond the intended use? | A second named group and a mechanism |
| Open source | Is it published and free to use? | The licence terms are followed |
| Not open source | Do I have the owner’s permission? | Permission obtained, usually with payment |
Worked reminder
Gauge.percentFull(used, capacity) computes used * 100 / capacity. For (50, 200) it returns 25 and for (200, 200) it returns 100. For (5, 0) it throws ArithmeticException: / by zero. For (30000000, 40000000) the product 3,000,000,000 overflows int, so the method returns −32. That last result is inside the stated condition and yet wrong, so the method is not reliable. Only an extreme test value revealed it.
Mistakes to avoid
- Saying “reliable” means “never crashes”. A wrong value is also a failure.
- Testing five similar ordinary values and concluding the method works.
- Writing a one-sided impact answer (“this app is bad”) or one with no named group.
- Treating a downloaded code file as free to use without checking whether it is open source and what its licence says.
- Confusing an unintended effect with a bug. The program may do exactly what it was designed to do and still cause a harm.
Quick self-check
- Name three kinds of test value that give a variety of conditions. Answer: for example ordinary, boundary and extreme values (special cases are a fourth).
- A programmer copies a company’s paid code into their app without asking. Which issue arises? Answer: legal and intellectual property: permission (and usually payment) was needed.
- An app built to help people share photos is later used to spread false claims. What kind of effect is this? Answer: an unintended harmful effect beyond the intended use.
- What does
Integer.MAX_VALUEhave to do with reliability? Answer: arithmetic that exceeds the range ofintoverflows and gives wrong results, which a test with an extreme value can reveal.