Computer Science concepts you can learn from block-based programming
I have signed up to volunteer for the Swedish nonprofit organization Kodcentrum this autumn. Kodcentrum introduces kids to programming and digital creation free-of-charge. We will be using Scratch in the coding labs, and I've played around with Scratch previously on a couple of occasions. In this post, I'll share what I learnt by taking a course on Snap!, which is closely related to Scratch.
A course on Snap!
To prepare myself for the volunteering, I signed up for the MOOC Programmieren mit Snap!, which was offered free-of-charge by openSAP this summer. Snap! is an extended re-implementation of Scratch and the two languages as very similar. The user creates programs in a visual drag-and-drop environment.
The course took about ten hours to complete, and I'm impressed by how much content and how many fundamental as well as more advanced computer science concepts the instructors were able to explain and demonstrate.
Concepts covered
Let's have a brief look at the concepts covered.
Fundamentals
A lot of the fundamentals were illustrated by creating images and art. The first example illustrated positioning, loops, and visual effects by creating a digital wildflower meadow.
The basics of color theory were explained in an exercise to create geometrical forms of different types and colors. I found it interesting that Snap! uses HSV (hue, saturation, value) instead of the RGB color model, which I'm more familiar with. According to Wikipedia, HSV was "designed in the 1970s by computer graphics researchers to more closely align with the way human vision perceives color-making attributes."
The use of variables was introduced in the context of for-loops, and the outcome was spirals of different sizes and forms. At a later stage, lists were introduced for grouping several related values.
Advanced concepts
The principle of parallel computing was introduced by letting the student create a simple drawing program, in which the user creates two mirrored images by having two scripts executing in parallel.
Messaging between objects was introduced by creating a simple game where a character navigates through a maze. The objects communicated when something happened in the game loop.
A Sierpiński triangle was created by applying a chaos game method. Fractals and emergence were also introduced. There are really a lot of interesting graphical representations which can be generated by a very small amount of code.
Snap! can be used for more advanced use cases by importing libraries. A neat example was the use of a text-to-speech library for generating and reading out loud different newspaper headlines.
Cloning was used to create somewhat psychedelic graphical animations.
As you see, a lot of ground was covered already, but no computer science programming introduction is complete without introducing the student to recursion. I really enjoyed this part of the course, and the output was a tree image with very detailed branches.
Conclusion
I was familiar with most of the concepts covered in the course, but some of the graphical applications were new to me since I don't do any graphics programming in my day job. I very much enjoyed the course, and I'm impressed with the instructors as well as with what can be achieved in a block-based programming language.
If you have children, and you want to introduce them to programming, I think that Snap! and Scratch are both excellent choices. They are most likely also great introductory tools for adults who want to get an initial idea of what programming is all about.
I highly recommend the course, which is available both in German and in English. I have only taken the German version of the course, so that is what this blog post is based on. You can sign up for any one of the courses free-of-charge. Happy coding!
If you would like to comment on this post, please head over to dev.to.