# AP® Computer Science A 3.2 Impact of Program Design

Source: https://lockincs.com/ap-csa/unit-3/3-2-impact-of-program-design/  
Last reviewed against the College Board Course and Exam Description (CED): 2026-11-12  
CED codes: 3.2.A, 3.2.A.1, 3.2.A.2, 3.2.A.3

System reliability means a program performs its tasks as expected under stated conditions without failure, so programmers test it with a variety of conditions. Programs affect society, the economy and culture in good and harmful ways, sometimes beyond their intended use. Reusing code raises legal and intellectual property questions: open source code is free to use, other code needs permission and often payment.

## What you will learn

- 3.2.A Explain the social and ethical implications of computing systems.

## 1\. System reliability: test with many conditions

**System reliability** means the program can perform its tasks as expected under stated conditions without failure 3.2.A.1. Programmers should try to maximize reliability by testing the program with a variety of conditions 3.2.A.1.

Here is a method that turns a quiz score into a percent. It works on the first test, so it looks finished.

```
public class QuizScore
{
    public static int percent(int correct, int total)
    {
        return correct * 100 / total;
    }
}
```

```
System.out.println(QuizScore.percent(18, 20));
System.out.println(QuizScore.percent(0, 20));
System.out.println(QuizScore.percent(5, 0));
```

Output:

```
90
0
Exception in thread "main" java.lang.ArithmeticException: / by zero
```

The third test, a quiz with no questions yet, makes the program fail with a run-time error. A good test plan includes:

| Kind of test | Example input | Why |
| --- | --- | --- |
| Typical value | 18 out of 20 | The normal case works. |
| Boundary value | 0 out of 20, 20 out of 20 | The smallest and largest results are correct. |
| Unusual value | 5 out of 0 | The program does not crash on input it did not expect. |

The improved version states its behavior for the unusual case, so it works as expected under all stated conditions:

```
public class QuizScore
{
    /** Returns the percent correct, or 0 when total is 0 */
    public static int percent(int correct, int total)
    {
        if (total == 0)
        {
            return 0;
        }
        return correct * 100 / total;
    }
}
```

```
System.out.println(QuizScore.percent(18, 20));
System.out.println(QuizScore.percent(20, 20));
System.out.println(QuizScore.percent(5, 0));
```

Output:

```
90
100
0
```

## 2\. Programs have beneficial and harmful impacts

Creating a program has impacts on **society, the economy and culture**, and these impacts can be both beneficial and harmful 3.2.A.2. A program meant to fill a need or solve a problem can have **unintended harmful effects** beyond its intended use 3.2.A.2.

| Program | Beneficial impact | Possible harmful impact |
| --- | --- | --- |
| A route planner | Drivers save time and fuel (economy). | It sends heavy traffic through quiet streets next to a school (society). |
| A music recommendation app | Listeners discover new artists (culture). | It keeps showing the same popular songs, so small artists are heard less (culture, economy). |
| An online grade portal | Students see their progress quickly (society). | Students without home internet see it later than others (society). |

The route planner problem can start with one design choice in the code. This method only looks at travel time:

```
public class RoutePlanner
{
    public static String choose(int mainRoadMinutes, int sideStreetMinutes)
    {
        if (sideStreetMinutes < mainRoadMinutes)
        {
            return "side street";
        }
        return "main road";
    }
}
```

```
System.out.println(RoutePlanner.choose(14, 12));
```

Output:

```
side street
```

Every user gets the same answer, so thousands of cars go down the side street. A more careful design adds a condition the designers care about, such as avoiding a school zone during school hours:

```
public class RoutePlanner
{
    public static String choose(int mainRoadMinutes, int sideStreetMinutes,
                                boolean schoolHours)
    {
        if (sideStreetMinutes < mainRoadMinutes && !schoolHours)
        {
            return "side street";
        }
        return "main road";
    }
}
```

```
System.out.println(RoutePlanner.choose(14, 12, true));
System.out.println(RoutePlanner.choose(14, 12, false));
```

Output:

```
main road
side street
```

**Watch out:** on the AP® exam, an “impact” answer should name who is affected and how. “It is bad for people” is too vague; “it increases traffic danger near a school” is specific.

## 3\. Legal issues and intellectual property

Code is **intellectual property**: it belongs to the person or company that wrote it. Legal issues and intellectual property concerns arise when you create programs 3.2.A.3.

-   Programmers often reuse code written by others that is published as **open source** and free to use 3.2.A.3. Open source code comes with a **license** that says what you may do with it, for example that you must keep the author’s name and the license text.
-   To include code that is **not** published as open source, the programmer must obtain permission and often purchase the code before putting it in their program 3.2.A.3.

A good habit is to record where reused code came from, right in a comment:

```
public class TextUtils
{
    // The method below is adapted from an open source utility library.
    // It is free to use under that library's license, which asks us
    // to keep this notice and credit the original authors.
    public static String initials(String first, String last)
    {
        return first.substring(0, 1) + last.substring(0, 1);
    }
}
```

```
System.out.println(TextUtils.initials("Sam", "Rivera"));
System.out.println(TextUtils.initials("Lee", "Chen"));
```

Output:

```
SR
LC
```

| Situation | Can you use the code? |
| --- | --- |
| Open source library, free to use, you follow its license | Yes 3.2.A.3 |
| A company’s code you found in a leaked file | No: it is not open source and you have no permission. |
| A paid library you have not bought or licensed | Only after you obtain permission, which often means buying it 3.2.A.3 |

## Common mix-ups

- Not true: If a program works on the example input, it is reliable. Reliability means it works as expected under all the stated conditions. Test typical values, boundary values (like 0 or the largest allowed value) and unusual cases, not just one example.
- Not true: Code I find online is free to copy into my program. Code is intellectual property. Open source code published as free to use can be reused under its license terms. Code that is not open source needs the owner's permission, and often you must buy it.
- Not true: A program built to help people cannot cause harm. Programs made to fill a need or solve a problem can still have unintended harmful effects beyond their intended use.

## In 30 seconds

- System reliability: the program performs its tasks as expected under stated conditions without failure.
- Maximize reliability by testing with a variety of conditions: typical, boundary and unusual inputs.
- Programs impact society, the economy and culture; the impacts can be beneficial and harmful.
- A program meant to solve a problem can have unintended harmful effects beyond its intended use.
- Open source code published as free to use can be reused; other code needs permission and often a purchase.

## Checkpoint: 4 practice questions

### Question 1

Consider the following method, which is intended to return the average number of points per game. A programmer tests it only with `averagePoints(30, 3)`, which returns 10. Which additional test call would best help improve the reliability of the method?

```java
public static int averagePoints(int totalPoints, int games)
{
    return totalPoints / games;
}
```

- A. `averagePoints(60, 6)`
- B. `averagePoints(90, 9)`
- C. `averagePoints(12, 0)`
- D. `averagePoints(300, 30)`

**Answer: C.** Reliability improves when the program is tested with a variety of conditions, including unusual ones. A call with 0 games causes an `ArithmeticException` (division by zero), which shows the method does not yet handle a player who has not played. The other three calls are typical cases very similar to the first test, so they would all return 10 and reveal nothing new.

### Question 2

A city releases an app that lets residents report broken streetlights by taking a photo. Repairs in neighborhoods with many app users become faster, while repairs in neighborhoods where fewer residents own smartphones become slower. Which of the following best describes this situation?

- A. A program meant to solve a problem has an unintended harmful effect beyond its intended use
- B. The app has low system reliability because it fails to perform its tasks under the stated conditions
- C. The app is a violation of intellectual property law
- D. The app has only beneficial impacts because it was designed to help residents

**Answer: A.** The app was built to solve a real problem, but it shifted repair work toward areas with more smartphone users, an unintended harmful effect on society. Nothing says the app crashes or fails, so reliability is not the issue. Nothing is copied, so intellectual property is not involved, and good intentions do not prevent harmful impacts.

### Question 3

A programmer wants to add a chart-drawing library to a game. The library is sold by a company and is not published as open source. Which of the following must the programmer do before including the library's code in the game?

- A. Nothing, as long as the code is used without changing any of it
- B. Add a comment with the company's name above the code
- C. Rewrite the variable names so that the code looks like original work
- D. Obtain permission from the company, which often means purchasing it

**Answer: D.** Code that is not published as open source requires the programmer to obtain permission and often purchase it before integrating it. A credit comment is good practice but does not give permission. Leaving the code unchanged or renaming its variables does not change who owns it.

### Question 4

Consider the following class. The code segment below the class appears in a method in another class. What is printed as a result of executing the code segment?

```java
public class Ticket
{
    /** Returns the price; children under 12 pay half */
    public static int price(int fullPrice, int age)
    {
        if (age < 12)
        {
            return fullPrice / 2;
        }
        return fullPrice;
    }
}

System.out.print(Ticket.price(15, 11) + " ");
System.out.print(Ticket.price(15, 12) + " ");
System.out.print(Ticket.price(15, 0));
```

- A. 7 15 7
- B. 7.5 15 7.5
- C. 15 7 7
- D. 7 7 7

**Answer: A.** Testing the boundary (ages 11 and 12) and an extreme value (age 0) is how reliability is checked. Age 11 is under 12, so the result is 15 / 2, which is 7 with integer division. Age 12 is not under 12, so it pays 15. Age 0 is under 12, so it pays 7. The option with 7.5 forgets that `int` division drops the decimal part, and 7 7 7 treats age 12 as a child.

## Questions students ask

**What is system reliability in AP® Computer Science A?**

System reliability means the program can perform its tasks as expected under stated conditions without failure. Programmers improve it by testing the program with a wide variety of conditions.

**Can I use code from the internet in my program?**

Only if you are allowed to. Open source code published as free to use can be reused by following its license. For code that is not open source, you need permission from the owner and often have to buy it.

**What is an unintended harmful effect of a program?**

It is harm the program causes that its designers did not plan, often when the program is used beyond its intended purpose, such as a route app that sends heavy traffic through quiet streets.

---

© LockInCS, licensed CC BY-NC-ND 4.0. AP® is a trademark registered by the College Board, which is not affiliated with, and does not endorse, this website.
