Star Student Builder logoStar Student Builder
← Code Makers Lesson 6Std 6-8

Plan Before You Type

Big programs are not typed from start to finish. They are planned. List the parts of your picture, decide where each one sits, write one block per part, and test each block alone. Then joining them up is the easy bit.

πŸ’‘ The idea

Plan a big drawing on paper first, then build it one tested part at a time.

  • Sketch the picture on paper and label every part.
  • Write down where each part sits, as a goto position, before you code.
  • Build one part, run it, fix it. Only then start the next part.
  • Comments help: a line starting with # is a note for humans, not the turtle.
  • If the finished picture is wrong, you already know which block to look at.

πŸ“˜ Words to know

plan
decide what to build before you build it
comment
a note in the code that the computer ignores
scene
a picture made of several parts

πŸ‘€ Watch this

Only one part of the scene so far: the sun, tested on its own in the top corner.

# part one of the scene: the sun
to sun
colour yellow
fill on
circle 35
end
penup
goto -140 110
pendown
sun
What this program draws
What it draws

✍️ Your turn

  1. Run it. One part working is better than four parts half working.
  2. Move the sun by changing the goto numbers.
  3. Add a comment of your own with # at the start of the line.
  4. Write a second block called cloud and test it by itself.
  5. Only when both work, call them one after the other.

🎯 Challenge: Plan a garden: write one block for the ground and one for a flower, test each on its own, then run them together.

Show me one answer
to ground
right 90
forward 220
back 440
end
to flower
repeat 6 [ forward 25 dot 20 back 25 right 60 ]
end
ground
goto 0 0
flower

Your program
Ask GuruAcharya Samayeshwar