In the last 5 days we’ve run through a super fast tutorial of Events, Variables and Arrays/List. Today we’ll look at how to make a block, which is kinda like a “method” but I get into arguments with friends whenever I make that analogy (don’t worry – none of them read this blog so I’m safe).
July 11th – A Week With Scratch
With the recent partnership announcement of Google and Scratch, the press release states that more blocks (computer based and physical) will be open source which means more creative possibilities – but Scratch already headed this way with the “Make a Block” feature.
Personally, I’m a huge fan of SNAP! which was built from Scratch 1.4. SNAP allowed you to build your own blocks, allowing for levels of abstraction and recursion, and higher education computing concepts. Scratch introduced the “Make a Block” option and a lot of my high school students were drawn to it when they realized it could make their code more efficient.
One of the sections available is “More Blocks” and when you click on it you get the option to “Make a Block”. Once you click on it you can name the block, and you have options to make it a number, a string, a conditional or just a label. I named mine square as its the classic example I use.
In programming, the computer doesn’t know what a square is unless we program it. the computer knows how to draw points and lines but we tell it to connect them. A square is something pretty simple that a computer should know how to do, and we could use it frequently in our programs – so let’s make a block that will draw a square everytime we click it.
So a square is pretty simple, four right angles and 4 equal sides. The trick is to make sure you use the “Pen Down” block to draw it. But with our advanced knowledge of Scratch, we know we can loop something 4 times, so we use the “Repeat 4 loop”.
Then we attach the code to the “define square” block, then use the “square” block and viola! A square, and as since in the GIF above, you can change the definition and it automatically affects the “square” block.
We’ll jump into creating blocks in more detail in SNAP as we do the Week With series in a few weeks.
Tomorrow we’ll look at the community and how you can share, “hand out” templates and easily grade your students work.