Star Student Builder logoStar Student Builder
← Young Developers Lesson 1Std 9-12

Break the Picture into Parts

Computational thinking starts with one honest admission: nobody can write a whole complicated program in one go. What you can do is break the problem into parts small enough to hold in your head, solve each one, and let the names carry the meaning.

πŸ’‘ The idea

Decomposition: split a problem you cannot solve into parts you can.

  • Decomposition means splitting a problem into smaller, independent parts.
  • A part is the right size when you can test it on its own in a few seconds.
  • Naming a part is real work: the name is the interface everyone reads.
  • Solve the parts in any order you like, then compose them at the end.
  • The same habit works for essays, experiments and school projects, not just code.

πŸ“˜ Words to know

decomposition
splitting a problem into smaller parts
abstraction
hiding the details behind a name
compose
join the finished parts into the whole

πŸ‘€ Watch this

One part of a robot, written as a block called body. Nothing else exists yet, and that is the point.

# step one: name one part and nothing else
to body
square 60
end
body
What this program draws
What it draws

✍️ Your turn

  1. Run it, and notice how little it does. That is a healthy first version.
  2. On paper, list every part your robot needs: body, head, arms, legs.
  3. Write a second block for the head and test it on its own.
  4. Decide the join: where does the head sit relative to the body?
  5. Call the two blocks one after the other and check the join is right.

🎯 Challenge: Split a flower into two parts, stem and bloom, write a block for each, then draw the whole flower by calling them in order.

Show me one answer
to stem
colour green
width 5
forward 110
end
to bloom
colour pink
repeat 6 [ forward 24 dot 20 back 24 right 60 ]
end
stem
bloom

Your program
Ask GuruAcharya Samayeshwar