Demo day at Mission Control. The whole crew gathers around the big screen, and Rocket feels his heart thumping. He has practiced, but he still feels nervous.
"What if it crashes in front of everyone?" he whispers to Raven.
Raven smiles. "What do you notice about your plan?" she asks. "You tested it, you fixed the edge cases, and you have a snapshot. You are ready. And if something odd happens, that is useful feedback."
Nova hovers beside the screen, ready to take notes. "Interesting," she says. "The best demos tell a short story: the problem, the tool, and one real example from start to finish."
Rocket takes a breath and begins with the problem.
One tester said: I only want to see my last few entries. Here is a function that gives the newest entries first. The small program below tests it before it goes anywhere near Mission Log.
# latest_check.py
def latest(entries, how_many=3):
"""The newest entries, newest first."""
result = []
index = len(entries) - 1
while index >= 0 and len(result) < how_many:
result.append(entries[index])
index = index - 1
return result
log = ["first", "second", "third", "fourth"]
assert latest(log) == ["fourth", "third", "second"]
assert latest(log, 1) == ["fourth"]
assert latest([]) == []
print("latest() passed its tests") | Statement | True or false? |
|---|---|
| latest changes the order of the original list. | ? |
| latest(log, 2) returns two entries. | ? |
| how_many=3 is a default value. | ? |
| A demo should hide the tests from the audience. | ? |
You gave a real demo and turned feedback into an improvement. That is the full cycle real teams use. Tomorrow is graduation.