The Development Process and Program Design
There are multiple development processes. Four phases are commonly used in them: investigating and reflecting, designing, prototyping and testing. The phases can repeat, as we will see.
The tutoring team
Wen, Adaeze and Tom build a program for their school's tutoring room. Students book a tutor, tutors post free periods, and Dana, who runs the room, prints the day's bookings.Investigating and reflecting: the team finds out what the program must do and for whom. They survey 180 students: most want to book from a phone the night before. They interview Dana: she needs a paper list each morning, as the tablet is rarely charged. They watch the room for a week, which is direct observation, and reflect: students cannot tell which tutor takes chemistry. Investigation determines the requirements and turns up the constraints and concerns of the people who will use the program. Surveys, interviews and direct observation are three of the ways to investigate. A fourth, user testing, needs a draft to try and comes up below.
Investigation ends in writing: the team writes down what the program must do. A student picks a subject and sees the open slots; Dana prints one day's list. These are the requirements: they describe how the program functions, and may include a description of the interactions it must offer its users. The document that defines them is the specification.
Designing: now the team outlines how to accomplish what it has specified. It brainstorms, storyboards the three screens, draws the layout of the booking screen, and organizes the program into modules: booking, free periods, daily list. It also writes a testing strategy: cases to run later, such as a full day with no slots left.
Prototyping: a prototype is a rough working version, built to be tried. Wen builds only the booking screen, with tutor names typed in by hand, and six students try it at lunch. A draft in users' hands is user testing, the fourth way to investigate. Two of the six book a tutor who is in a lesson at that time! They read "open" as "tutor is free".
Testing: once the whole program runs, the team tries every case in its strategy.
Incremental and iterative
Look at how it was built. Tom wrote the booking module and ran its cases until all passed. Only then did Adaeze add the free-periods module, and only after that passed did the daily list go in. A process that breaks the problem into pieces and makes sure each piece works before adding it to the whole is incremental.Now look at the lunchtime result. The team went back to the design phase and redrew the booking screen so each slot names its tutor. It rebuilt the screen, tried it on six more students, and redrew it again when one still got it wrong. A process that refines and revises its work after feedback, testing or reflection is iterative. Revising often takes the team back to a phase it had finished.
Note that incremental asks about pieces: was each part made to work before the next joined it? Iterative asks about revision: did the team change something because of what it learned? A team can answer yes to one and no to the other; "we did it in steps" answers neither question.
The program below is one piece of a ferry ticket program, the function
fare, together with the cases from its testing strategy. Each case is an age and the fare that age should get. The loop runs fare on every case and reports whether the result is the one expected. Run it, then change it and run it again:• Change
age < 12 to age <= 12. One case now fails, so this piece is not ready to join the rest of the program.• Press Reset, then add the case
{ age: 70, expected: 5 }, to cases, for a new requirement that riders 65 or older pay 5.• Keep that case, then add
if (age >= 65) { return 5; } as the first line of fare, and run it again.function fare(age) {
if (age < 12) {
return 3;
}
return 8;
}
// Cases from the testing strategy: an age and the fare it should get.
let cases = [
{ age: 5, expected: 3 },
{ age: 11, expected: 3 },
{ age: 12, expected: 8 },
{ age: 40, expected: 8 },
];
let passed = 0;
for (const test of cases) {
let result = fare(test.age);
if (result === test.expected) {
console.log("Age", test.age, "passed");
passed = passed + 1;
} else {
console.log("Age", test.age, "FAILED: got", result, "but expected", test.expected);
}
}
console.log(passed, "of", cases.length, "cases passed");
Output
Press Run to see what this program prints.
Note: This IDE is for experimenting with the code in this lesson. Your changes are not saved, and refreshing the page puts back the original lesson code.