Seasoned software industry specialists seem to be aligned in thinking that visual programming will never be a significant trend. Sure, it can be useful on the outskirts of the main playground, but nothing beats pure, old, plain text, right?
I’m not so sure…
Block-shaped future
Changing the way we tell a machine what to do is closer to a paradigm shift than a one-season fad. It requires a fresh look, an open mind, and a lack of prior biases (aka best practices). In other words, it requires the mind of a child. And this is exactly what visual programming gets nowadays in the form of Scratch.
In case you have not heard, Scratch is a wildly successful free programming platform and language for kids. As an idea, it stands on the shoulders of giants and has proved its teaching capabilities in several studies. It looks like the transition has already started.
To keep things in perspective, I am not saying that C (all time top 3 in Tiobe’s index) will fade away, and every programmer will be placing blocks to build a REST endpoint. I just see a great possibility that future computer users will be very familiar with visual programming in a Scratch-inspired form. For them, this can be the easiest way to get things done, closer to the role that Python plays today for us.
How durable are these blocks?
You may think that Scratch, as a platform designed for kids, can only teach the basics. How does it fit real-life programming? Can a block-based language have more advanced structures and abstract concepts at all? Here it gets more interesting. It turns out that Scratch paved the way for several other platforms and languages. I will touch on few…
Snap!
Snap! is like a child of Scratch and CS Curriculum. Here you find all that Scratch has to offer plus anonymous functions, lambdas, and lists. All of this is in a visual form and works in a browser. Snap! is a natural step in evolution after Scratch, allowing users to learn more advanced topics in a familiar environment. Just like Scratch, it is also open-source and publicly available. If that is not enough, Snap! also offers a large library of plugins and language extensions like exceptions, function composition, lazy lists, etc. Of course there is also a clone of Doom built with Snap!
There is also an interesting spin-off called NetsBlox where the whole mix is spiced up with access to external REST APIs and elements of distributed computing. Like all established technologies, you have the opportunity to visit the Snap!Con conference. Watching the videos is truly inspiring, as they illustrate how a block-based system enables non-CS users to implement advanced CS concepts in their work. All talks are available on YouTube.
GP Blocks
Finally, my favorite - GP Blocks.
As most of us know, every sufficiently advanced programming language will sooner or later be used to recreate itself. For some, this is seen as the ultimate proof of virtue. You, my patient reader, probably know already where I am heading now… yep, GP Blocks is a block-based language built in a block-based language. Simply put, blocks all the way down, including stdlib, IDE, debugger, and even the compiler. Source is here.
It may sound a lot like the Smalltalk system made of blocks. That’s OK, one of the GP Blocks authors - John Maloney, is the original creator of Morphic and co-author of Squeak. For the sake of completeness, the remaining authors are Yoshiki Oshima and Jens Mönig, co-creator of Snap!
To ease bootstrapping, a program source in GP has two equally valid representations: blocks and text. This way, it was much easier to write the whole system (pun intended) from scratch. As a result, you can do crazy things like this:
MicroBlocks
Due to the large functional overlap between Snap! and GP Blocks, the authors decided to take a spin on microcontrollers. This is how MicroBlocks.fun was born. In essence, it is an IDE enabling block-based programming for a wide range of microcontrollers. Unlike other solutions, however, it is not a mere visual representation of autogenerated C/Python code. The user’s blocks are compiled to the GP-based VM bytecode that runs directly on a microcontroller board. This approach allows users to create much more advanced programs, including basic preemptive multitasking.
Allow me to quote one of the MicroBlocks authors Bernat Romagosa:
(…) To sum up what’s different about MicroBlocks:
- It is block-based.
- It is live. That means you can change scripts in real-time while they’re running. You can see the result of running any block in real-time. You don’t have to wait for any compilation/upload cycles.
- It is autonomous. You can disconnect the board at any point, and the program will keep running on it.
- It is parallel. You can run multiple tasks at the same time.
- It is portable. It runs on several boards thanks to our VM approach.
And again, the whole IDE and compiler are written in GP Blocks!
Google Blockly
As a last example, let’s explore Google Blockly. It is primarily a JavaScript library used to create visual programming editors, rather than a language in itself. It can be customized to generate code in any textual language and operates within a browser. This flexibility made it the foundation of a myriad of different visual languages and platforms, to name just a few:
It is also easy to start building something tailored to a particular problem or domain. For example:
- PiBakery tool to set up a Raspberry Pi,
- ANTLR Blockly
- Node Blockly
- StockBlocks
The last time I checked, there were over 230 projects on Github tagged “blockly”.
Conclusion
When I started exploring this topic, I knew the origins of Scratch (tip: Alan Kay’s EToys), but I never suspected how large the ecosystem had become. Block-based programming, while significant, is just a small subset of visual programming as a whole. Visual programming encompasses a variety of approaches and tools beyond just blocks. For example, there is a whole domain of flow-based programming environments. From Node-RED, which allows users to wire together devices, APIs, and online services in a visual way, via visual programming in game development, media processing, 3D graphics to system design in engineering.
As for my personal journey, I’ve experimented with various visual programming environments. These experiences have shown me the potential and versatility of visual approaches in programming. However, to balance the excitement, not everything is perfect. Visual programming, and flow-based programming specifically, can quickly become too complex to read or reason about. Programs can be hard to compare and integrate with version control tools. These problems are not unresolvable; text-based programming has been around longer and therefore has more developed tools.
Looking at the broader perspective, it’s clear that visual programming, including block-based programming, is here to stay. As more users become accustomed to these interaction models, it’s reasonable to expect visual programming to become a modern way of scripting systems, automating tasks, and processing data. Observing tools like Apple’s Shortcuts app, it’s evident how inspirations from Scratch and other visual programming languages have started to influence mainstream software development.