A Scratch project that draws shapes and pretty spirograph pictures.

Uses a code block to draw a shape with parameters for number of sides and length of sides.

It shows how thinking about the general case. eg. a shape has a number of sides and all the angles in the shape must add up to 360 degrees.

Firstly write the code to draw a square (move 100, turn 90, move 100, turn 90, move 100, turn 90, move 100, turn 90). Then write the codes to draw a triangle (move 100, turn 120, move 100, turn 120, move 100, turn 120).

Then look at the similarities between the two examples and work out the general code that will allow you to draw an ‘any’ sided shape. You can ask the pupile what a 2 sided shape would look like.

By creating a generic DrawShape code block and then calling it repeatedly you can create a spirographe effect.

In my lessons I always explain that all programmers are lazy and we always want to write the least amount of code possible to solve a problem. I then go onto discuss why its a good idea to write less code (faster, easier to debug, easier to adapt inn the future). Writing good code is much more like writing poetry than writing a simple list of instructions.

Good programmers are effectively paid more to solve the same problem in less code than someone else might.