← Back to course
5/6
Week 04 Β· Loops

Friday

Impact Friday: One loop, many greenhouses
// Doing a job many times, and knowing when to stop
⏱ about 20 min

Friday: Impact Friday: One Loop, Many Greenhouses

Word about Beacon spreads fast. By lunch, eleven other outpost greenhouses want a copy of the hourly check.

"Let's send it to all of them right now," Comet says, already reaching for the relay switch.

Wren holds up the old printout of the fill loop. "Remember this one? It never stopped."

"If we had shared that, twelve greenhouses would have the same bug at once."

Comet pulls her hand back slowly.

Nova floats between them. "Sharing is a gift," she says gently. "Testing first makes it a safer one."

They agree to trace the check one more time before anything is sent.

Big effects, fast

Programs spread quickly. Sharing a program fast, or running it with many users, can have big effects.

Those effects can go beyond what the programmer intended, or can control.

People also use computing innovations in ways their creators never intended.

Responsible programmers try to think about unintended uses and their helpful and harmful effects.

But no programmer can think of every way an innovation might be used.

Beacon shared withA possible helpful effectA possible problem
One greenhouseThe crew learns from itA bug affects one tank
Twelve greenhousesMany crews save timeOne bug repeats twelve times
Every outpost at onceEveryone gets hourly checksA bug spreads before anyone can test it
THINK IT THROUGH
  • Read the question.
  • Tap your answer.
Why does sharing a program fast with many users raise the stakes?
Can a responsible programmer foresee every way a program will be used?
What did the crew choose to do before sharing the hourly check?

Week review

Week reviewTrue or false?
Every algorithm can be built from sequencing, selection and iteration.?
REPEAT n TIMES runs its body a set number of times.?
REPEAT UNTIL checks its condition only after the body runs.?
An infinite loop happens when the ending condition never becomes true.?
Hand tracing is a way to find and correct errors.?
WHY THIS EXERCISEThese facts are the core of iteration, and Beacon uses all of them.
ORDER THIS WEEK'S BEACON WORK
  • Tap a card.
  • Then tap its spot.
1First
2Next
3Then
4Last
What do you call a loop whose ending condition never becomes true? Type two words.
WHY THIS EXERCISESpotting an infinite loop before sharing a program keeps a small bug from becoming a big one.
A repeating portion of an algorithm is called ____.
How clear a program is to other programmers is its ____.
HELPFUL, HARMFUL, OR BOTH?
  • Read the question.
  • Tap your answer.
Beacon's alert reaches every greenhouse instantly. One crew loves it. Another finds it too noisy at night. Is that one effect seen two ways?
A crew starts using Beacon's hourly photos to track how fast basil grows. The crew never planned that. What is it?
Try it
Ask a grown-up about a time a message, video or app spread very quickly.
What were its helpful effects? Were there any effects nobody expected?
On paper, make a poster titled Test Before You Share. Show one loop, one trace table and one checkmark.

What a week, developer. Tomorrow is Mission Quest: a loop game with your family.

← Thursday