AP Computer Science Principles · Study guide

Program Design and Development

AP® Computer Science Principles · Big Idea 1 · Creative Development

Program Design and Development

How programs get built: development processes, finding out what users need, writing a specification and a design, documenting code, and giving credit for code from others.

1Development processes

A development process is the way a person or team gets from an idea to a working program. It can be ordered and intentional, following a plan step by step, or exploratory, trying things out to see what works. There are many development processes, but most use these phases:

PhaseWhat happens
Investigating and reflectingFind out what users need and what limits the program has; look back at what worked.
DesigningPlan how the program will meet its specification: layouts, parts, and how to test it.
PrototypingBuild a rough working version to try ideas out.
TestingRun the program on chosen inputs and check the results against what was expected.
Figure 1. The common phases of a development process. In an iterative process, results from testing or feedback can send the team back to any earlier phase.

2Iterative and incremental

An iterative process keeps refining and revising the program based on feedback, testing, or reflection all the way through. That may mean going back to an earlier phase: a test that confuses users can send the team back to designing.

An incremental process breaks the problem into smaller pieces and makes sure each piece works before adding it to the whole.

Figure 2. An incremental process breaks the problem into smaller pieces and makes sure each piece works before adding it to the whole.

Real projects are usually both. Here is a quiz app over four weeks:

WeekWhat the team didWhich idea
1Build only the screen that shows one question and checks the answer; test it until it works.incremental
2Add the score counter, test it on its own, then connect it to the question screen.incremental
3Classmates find the font too small to read on phones; go back to the design phase and change the layout.iterative
4Add a timer and test it before adding it to the whole; testing shows the score resets wrongly, so revise the score code.both

The test for iterative: is the team revising based on feedback, testing, or reflection, possibly by going back to an earlier phase? The test for incremental: is the team building and checking one smaller piece before adding it to the whole?

3Investigation and requirements

The design of a program starts with investigation to find out what it must do. Investigation identifies the program’s constraints (limits such as time, budget, or the devices it must run on) and the concerns and interests of the people who will use it. Ways to investigate:

MethodExample for a school club sign-up app
Surveys (collecting data)Ask every student which clubs interest them and what device they use.
User testingWatch five students try an early version and note where they get stuck.
InterviewsTalk with the club advisers about what information they need.
Direct observationWatch how students sign up on paper at the activities fair.

Program requirements describe how a program should work, and may include the user interactions it must provide, such as “a student can sign up for at most three clubs” or “the adviser sees a list of members.” A program’s specification is the document that defines its requirements.

4The design phase

The design phase outlines how to meet the specification. It may include:

  • brainstorming ideas;
  • planning and storyboarding, sketching each screen in the order a user sees it;
  • organizing the program into modules and functional parts, such as a sign-up part and a member-list part;
  • diagrams of the user interface layout, showing where buttons and text go;
  • a testing strategy, deciding ahead of time how the program will be checked.
The key idea

Investigate (surveys, user testing, interviews, observation) to learn users’ needs and the constraints; write requirements into a specification; design how to meet it. Iterative means revising from feedback, testing, or reflection, sometimes going back a phase; incremental means building and checking small pieces one at a time.

5Documentation and comments

Program documentation is a written description of what a code segment, event, procedure, or program does and how it was developed. Comments are documentation written inside the program for people to read; they do not affect how the program runs. In many text languages a comment starts with //. These two versions produce the same output, 84:

Without comments
PROCEDURE average(nums)
{
  total ← 0
  FOR EACH n IN nums
  {
    total ← total + n
  }
  RETURN(total / LENGTH(nums))
}
DISPLAY(average([84, 91, 77]))
With comments
// average(nums): returns the mean of a nonempty list of numbers.
// Adapted from the class example by Ms. Ruiz, Sept. 2026.
PROCEDURE average(nums)
{
  total ← 0
  FOR EACH n IN nums      // add up every score
  {
    total ← total + n
  }
  RETURN(total / LENGTH(nums))
}
DISPLAY(average([84, 91, 77]))

Document throughout development, not at the end. Documentation helps you and your teammates build correct programs and keep them correct later, when someone has to fix or change code they did not write or no longer remember. Not every programming environment supports comments (some block-based tools have none), so other documentation, such as a separate written description, may be needed.

6Giving credit

Acknowledge any code that was developed collaboratively or by another source. The acknowledgment can go in the program documentation and should include the origin or the original author’s name, like line 2 of the commented version above. Using someone else’s code without credit presents their work as yours.

7Worked examples

Worked Example 1 Iterative or incremental?

The recipe app

Label each as iterative, incremental, or both. (a) A team builds the search feature, tests it alone, then adds it to the app. (b) After user testing shows people can’t find the save button, the team returns to the design phase and moves it. (c) The team adds a shopping list feature after checking it on its own, and testing it reveals that the search feature needs a change, which they make.

  1. 1
    (a) one smaller piece checked before joining the whole: incremental.
  2. 2
    (b) revision based on feedback, going back to an earlier phase: iterative.
  3. 3
    (c) a new piece checked before joining (incremental) and a revision driven by testing (iterative).
Answer: (a) incremental, (b) iterative, (c) both.
Worked Example 2 Choose an investigation method

The bus-stop app

A team wants to know why riders miss buses at a busy stop. Which investigation method fits each question? (a) How many riders own a smartphone? (b) What do riders do in the minute before the bus arrives? (c) What does the transit planner need from the app?

  1. 1
    (a) a count across many people: a survey.
  2. 2
    (b) behavior people might not describe accurately: direct observation.
  3. 3
    (c) one expert’s detailed needs: an interview.
Answer: (a) survey, (b) direct observation, (c) interview.
Worked Example 3 Write requirements

The club sign-up app

Interviews show that advisers need to know who joined, clubs have size limits, and students sign up on phones. Write three requirements.

  1. 1
    From the advisers: the app shows each adviser a list of the students in their club.
  2. 2
    From the size limits: the app does not accept a sign-up once a club is full, and tells the student so.
  3. 3
    From the phones: every screen works on a phone-sized display.
Answer: Each requirement describes how the program must work or what interaction it must provide; together they form the specification.
Worked Example 4 Document and credit

Borrowed code

Dev adapts a sorting procedure written by a classmate, Hannah Lee, for his project. What should his documentation include, and will adding comments change what the program does?

  1. 1
    A description of what the procedure does, its inputs, and what it returns.
  2. 2
    An acknowledgment naming the origin: written by Hannah Lee, adapted by Dev.
  3. 3
    Comments are read by people, not run by the computer, so the program behaves the same.
Answer: Describe the procedure and credit Hannah Lee by name; the comments do not change how the program runs.

8Common mistakes

Common Mistake 1 · Treating development as a straight line

Testing and feedback often send a team back to designing or investigating. That is how an iterative process is supposed to work.

Common Mistake 2 · Mixing up iterative and incremental

Incremental: small pieces, each working before it joins the whole. Iterative: refining and revising from feedback, testing, or reflection.

Common Mistake 3 · Writing documentation at the end

Document as you go. By the end, you have forgotten why you made choices, and teammates needed the notes earlier.

Common Mistake 4 · Thinking comments change the program

Comments are for people. The computer ignores them, so they never change output.

Common Mistake 5 · Crediting code without a name or source

“Found online” is not enough. Give the origin or the original author’s name.

Describe a development process like this

“We built the app incrementally: the question screen first, tested on its own, then the score counter. The process was also iterative: when classmates said the text was too small on phones, we went back to the design phase and changed the layout.”

Name the process idea and point to the specific step that shows it.