◀ 11.1a11.1b11.1c ▶

11.1b — Create PT: Build Day 1

Build day one, PT rules: write the LIST-CENTERED core. The list is the requirement graders poke hardest — today it goes in first, works alone, and prints so you can SEE the data move (input, behavior, output, remember).

Build Day ~50 min

The day's contract:

  1. The program RUNS — even if it only prints
  2. The list EXISTS and participates: add, remove, access, or traverse — not a decoration
  3. A Debug.Log(...) rendering of the list's state after each change, so "behavior" is visible NOW (graders see a VIDEO later; you see the console today)

Starter-voice template for a list-centered core (adapt to your program — names matter for your WR answers):

private List<string> inventory = new List<string>();

public void AddItem(string itemName)      // procedure + parameter!
{
    if (!inventory.Contains(itemName))    // selection
    {
        inventory.Add(itemName);
        Debug.Log("added " + itemName + " → " + ListContents());
    }
}

private string ListContents()
{
    string s = "";
    foreach (string item in inventory)    // iteration
    {
        s += item + " | ";
    }
    return s;                             // output of a procedure
}

That one method pair already has: procedure, parameter, selection, iteration, list participation, observable output. Your 10.2c muscle, aimed at a rubric.

The WR2a pre-answer (5 min, write it NOW while coding): "The list ___ stores ___; the program appends when ___, removes when ___, and traverses to ___." Write the sentence the same day you write the code — future-you will not remember why the list exists; today-you does.

Close of Day ~5 min

Socratic: The List Goes In First

  1. The list went in before anything that uses it. What did printing the list tell you that reading the code would not have?
  2. Your list is the requirement graders poke hardest. Which of your list operations could a grader point at as proof, and does your code show it clearly?
  3. Today the program only had to work alone, with no user. What did you postpone, and how do you know the list will still hold when the input arrives?

Checkpoint — before moving on, you must be able to:

  • Run the program with the list visibly participating
  • Point at a procedure with a parameter and its CALL site
  • Show selection and iteration inside one algorithm
  • Read your WR2a sentence out loud and nod

Reference Docs

Need a deeper explanation? These pages cover the same concepts:

Next: 11.1c — Create PT: Build Day 2

0/3 answered

Answers save on this device as you type. At the end of class, click Download and upload the file to the Canvas assignment.

Saved on this device only — the Dashboard tracks your progress.