Program Development Cycle: From a Request to a Checked Program

A program begins with a request, but a request is rarely detailed enough to translate straight into code. The Program Development Cycle connects four activities: understand the problem, plan a solution, implement the plan and test the program. For a small calculator, game feature or classroom application, these activities help you turn an intended behaviour into a result you can check. You may revisit earlier work when a test exposes a gap.

Understand and plan

Start by identifying what the program receives, what it should produce and which rules connect the two. Ask about permitted inputs, units and special cases. For example, a request to calculate admission charges needs ticket prices and a rule for any fixed booking fee. Choosing these details yourself could produce working code that solves the wrong problem.


Planning records how the program will meet the clarified request. You might outline the necessary calculations and decisions in ordinary language before writing code. Keep the plan specific enough that another person could follow it, without getting distracted by the spelling rules of a programming language.


Stage

Main question

Useful evidence of progress

Understand

What should the program do?

Clear inputs, outputs and rules

Plan

How will it produce that result?

An outline of calculations and decisions

Implement

How will the plan become executable instructions?

Code that follows the plan

Test

Does the observed behaviour meet the rules?

Expected and actual results compared


Four connected stages show understanding, planning, implementation and testing, with a return path to earlier work.



Implement the plan

Implementation translates the plan into instructions in a programming language. Use meaningful names, represent quantities consistently and check that each calculation or decision matches the planned rule.


A syntax error can prevent code from running. Fixing it is necessary, but successful execution does not establish that the program calculates the right result. Code can run normally while using the wrong price, leaving out a fixed fee or applying a discount to the wrong group.


Keep the requirement available while you implement. If an important detail is missing, return to understanding the problem instead of silently inventing a rule.

Test against the requirement

A test case specifies an input and its expected result so that you can compare the program's actual behaviour with the requirement. Work out the expected result independently; copying the program's answer would make the comparison meaningless.


Example: A ticket program must charge CAD 3.00 per booking plus CAD 1.50 per ticket, including the booking fee when zero tickets are requested. Its governing rule is


C=3.00+1.50n,C = 3.00 + 1.50n,


where nn is the number of tickets and CC is the charge in Canadian dollars. For four tickets, the expected charge is 3.00+1.50(4)=9.003.00 + 1.50(4) = 9.00 CAD. An actual result of CAD 6.00 suggests that the booking fee was omitted.


Choose ordinary inputs and inputs at the boundaries of the permitted range. If the program should reject invalid inputs, test that behaviour too. A zero-ticket case checks something that an ordinary booking may not reveal.



When a result fails, compare the requirement, plan and code. The cause may be a coding mistake, an incomplete plan or an unclear requirement. Correct the relevant work, then check the resulting behaviour again.

What to remember

  • Clarify inputs, outputs and rules before coding.
  • Plan the calculations and decisions you need.
  • Implement the plan and check actual results against independent expectations.
  • Use test evidence to decide which earlier work needs attention.

Example: Check a Workshop Reservation Calculator

A community centre needs a program to calculate a workshop reservation charge. Every reservation costs CAD 4.00 plus CAD 2.50 per attendee. The CAD 4.00 fee applies even when the attendee count is zero. Valid counts are whole numbers from 0 to 20 inclusive; assume the inputs supplied here are valid. The program must return the total charge in CAD.


An expected result is the outcome required for a particular input, calculated independently of the program being tested. Use the Program Development Cycle to connect the centre's rule to the code and its results.


For counts stored in attendees, a developer writes:


Python
charge = 4.00 + 2.50 * (attendees + 1)


a) Identify the input and output, state a calculation plan, and find the expected charges for 0, 6 and 20 attendees.


The input is the whole-number attendee count, and the output is the reservation charge in CAD. The plan is to multiply the count by CAD 2.50 per attendee, then add the CAD 4.00 fixed fee. Writing nn for the attendee count gives


C=4.00+2.50n.C = 4.00 + 2.50n.


For zero attendees, the attendee portion is ________, so the total is


C(0)=4.00+2.50(0)=4.00 CAD.C(0) = 4.00 + 2.50(0) = 4.00\ \text{CAD}.


For six attendees, the attendee portion is ________, so the total is


C(6)=4.00+2.50(6)=19.00 CAD.C(6) = 4.00 + 2.50(6) = 19.00\ \text{CAD}.


For twenty attendees, the attendee portion is ________, so the total is


C(20)=4.00+2.50(20)=54.00 CAD.C(20) = 4.00 + 2.50(20) = 54.00\ \text{CAD}.


The expected charges are CAD 4.00, CAD 19.00 and CAD 54.00, respectively. The zero and twenty cases check the permitted count limits, while six provides an ordinary interior case.


b) Find the charge produced by the supplied code for six attendees. Compare it with the expected charge and identify the mismatch between the code and the plan.


First evaluate the parentheses. For six attendees, the supplied code uses an effective count of ________. Multiplying that count by CAD 2.50 gives ________. Adding the fixed fee gives


Cactual=4.00+2.50(6+1)=21.50 CAD.C_{\text{actual}} = 4.00 + 2.50(6+1) = 21.50\ \text{CAD}.


Compare this actual charge with the independently calculated expected charge:


21.50−19.00=2.50 CAD.21.50 - 19.00 = 2.50\ \text{CAD}.


The overcharge is ________. The code adds one to the count before multiplying, which charges for one extra attendee. The fixed reservation fee is already included separately; it does not justify increasing the attendee count.


The actual charge is CAD 21.50, so the six-attendee test fails. The mismatch is the extra + 1 inside the parentheses.


c) Correct the implementation and check its results for all three selected counts. State what those checks establish.


Remove the unsupported increment so that the code directly follows the planned rule:


Python
charge = 4.00 + 2.50 * attendees


For the selected inputs, evaluating the corrected expression gives


Cactual(0)=4.00+2.50(0)=4.00 CAD,Cactual(6)=4.00+2.50(6)=19.00 CAD,Cactual(20)=4.00+2.50(20)=54.00 CAD.\begin{aligned} C_{\text{actual}}(0) &= 4.00 + 2.50(0) = 4.00\ \text{CAD},\\ C_{\text{actual}}(6) &= 4.00 + 2.50(6) = 19.00\ \text{CAD},\\ C_{\text{actual}}(20) &= 4.00 + 2.50(20) = 54.00\ \text{CAD}. \end{aligned}


Each actual charge matches its expected charge, so all three selected cases pass. The corrected expression also matches the stated calculation rule for valid counts. These selected checks support the correction, but the three test results alone do not establish the behaviour of every possible implementation or any handling of invalid inputs.

A school needs a program that calculates the cost of hiring a bus. Arrange these actions in the order of a first complete pass through the Program Development Cycle, assuming no issue requires returning to earlier work.

  1. 1.

    Outline the calculations and decisions needed to determine the hire cost.

  2. 2.

    Run selected inputs and compare the actual costs with independently calculated expected costs.

  3. 3.

    Clarify the journey distance, passenger limits and charging rules with the school.

  4. 4.

    Write program instructions that carry out the outlined calculations and decisions.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A student is developing a program that calculates equipment rental charges. Match each development artifact to the information it should communicate to another developer.

Match each term
A.

A precise sequence of computational steps that can be expressed without choosing a programming language

B.

The inputs, required outputs, and charging rules the finished program must satisfy

C.

Instructions written in a programming language that implement the planned calculation

D.

A record of checks performed, expected and actual results, and any discrepancies found

Test report

Source code

Algorithm

Requirements specification

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A transport club requests a fare program with the instruction, Children should pay less than adults. It supplies neither age limits nor ticket prices. Which action best advances the Program Development Cycle at this point?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Extra Practice