Block Based Languages Are Best
Wednesday, 31 May 2017

If you program and have ever looked at a block-based language such as Scratch you might not have been impressed. The immediate impression is that it isn't programming. If you have tried to teach programming, on the other hand, you may well think better of block languages. A new study suggests that they are better than you think.

It can be difficult to take block languages seriously because they look more like a child's game than a programming language. How can you possibly do anything useful in that! However, if you look at some of the things that beginners create using nothing but block languages you can see at once that it is very possible to create non-trivial programs using one.

A new study by David Bau, Jeff Gray, Caitlin Kelleher, Josh Sheldon and Franklyn Turbak from MIT CSAIL, University of Alabama, Washington University and Wellesley College provides evidence that block languages have an edge over more traditional text-based ones:

 We believe the learnability of blocks languages arises from how they address the usability challenges underlying these three learning barriers:

1. Learning a programming vocabulary is hard. Blocks simplify this problem because picking a block from a palette is far easier than remembering a word: blocks rely on recognition instead of recall.

2. Code is hard to use because it presents a high cognitive load for new programmers. Blocks reduce the cognitive load by chunking code into a smaller number of meaningful elements.

3. Assembling code is error-prone. Blocks help users assemble code without basic errors by providing constrained direct manipulation of structure (e.g., two incompatible concepts do not have connecting parts).

This is great for the beginner but once you start to write real programs there are disadvantages. For instance, to enter a simple arithmetic expression using blocks is harder than simply typing it out. Making small changes is also harder.

...researchers observed that visual programming languages can have a higher viscosity than text code because they make small changes harder

Beyond viscosity, blocks environments can have several other usability disadvantages compared to textual programming languages: 

Low density: blocks take more space on the screen than equivalent text code.

Search and navigation: it can be challenging to find and navigate to the relevant part of a blocks program in a 2D workspace, only part of which may be visible. 

Source control: collaboration and version control systems are difficult to use without a text representation.


The solution to these problems is to use either a text style entry with block manipulation or a bidirection text/block mode switching.

 

stride

Greenfoot’s Stride editor combines textstyle editing for expression-level details with drag-and-drop blocks for higher-level program structure.

 

pencil

 

Pencil Code provides bidirectional switching between blocks and text. Mode switching allows users to learn with blocks and edit quickly with text.

The paper gives some examples, but an omission is the recently announced Microsoft MakeCode, which features a mode switching between blocks and JavaScript for the micro:bit, Minecraft and others.

There is a tradeoff between the two approaches to unifying blocks and text. While the dual-mode editors provide direct support for learning traditional text syntax such as JavaScript or Java, they also impose the cognitive overhead of working with syntax errors that that can only be introduced in text mode. Visualization research on multiple coordinated views suggests that the benefits of providing more than one view need to be balanced against the cognitive overhead imposed by switching between views

Single mode structured editors have the advantage of a conceptual model free of syntax errors, because the primary object being edited is the abstract syntax tree. However, to maintain consistency, many kinds of textual edits must be prevented, and other edits may require special tree editing commands. These constraints raise editing viscosity, and they may present additional cognitive barriers.

Block code editors have uses other than just making languages easier to use. For example, by using a toolkit such as Blockly you can implement drag-and-drop configuration setting apps and other utilities. They make a good freeform user interface.

The last word should go to the study:

The art of programming is the original human-computer interaction, and it remains an unsolved usability challenge. We can still do more to make programming available to all.

 

bounce22

More Information

Learnable Programming: Blocks and Beyond

Related Articles

Minecraft Code Builder In Beta

Stanford CS Moves To JavaScript

Choosing The Best Beginner's Programming Language

Getting started with MIT App Inventor 2

A Programmer's Guide to Scratch 2

Blockly Games Introduce Kids To Code

The Working Programmer's Guide To Language Paradigms

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

 

 

Banner


CSS Ecosystem In the Spotlight
06/11/2024

The 2024 edition of the State of CSS has been posted, revealing that the latest features of the language not only do away with extra tooling, but even start taking on tasks that previously requir [ ... ]



52nd Mersenne Prime Found
27/10/2024

It has been nearly six years since the last Mersenne prime was discovered. Now, at last, we have Mersenne prime number 52 and it has 41,024,320 digits!


More News

 

espbook

 

Comments




or email your comment to: comments@i-programmer.info

 

 

Last Updated ( Thursday, 01 June 2017 )