A Scratch program that, when clicked, redundantly updates a character’s speech bubble to say “editor!” 28 times.
When I say block-based, you say editor. Block-based! Editor! Block-based! Editor!

Block-based what? Differentiating programming languages, environments, and editors

Amy J. Ko
Bits and Behavior

--

I’ve been writing about some heavy things lately—race, gender, politics. As passionate as I am about these large issues in society, I occasionally need an intellectual palate cleanser. Something light, small, maybe even trivial, maybe even pointless. Tackling these little things like like a cool down after a workout: it’s a way to slow down in a measured way from something intense, before finding a more peaceful resting state. Like Thanksgiving weekend.

What better than a rant about word choice? I am an academic after all, and so this wouldn’t be an academic blog if I didn’t at least occasionally get far too annoyed about the words that people use. So bear with me while I get this pet peeve out of my system.

With that, let the rant commence: I despise the phrase block-based programming language. Over the past decade, it has become ubiquitous, to the point where there are conferences, teacher professional development, books and more that use the phrase. It’s meant to casually refer to programming systems like Scratch or App Inventor, or their many dozens of precursors like Alice of the 2000's, or the Cornell Program Synthesizer from 1981. The idea that binds all of these systems is that people construct and edit programs by manipulating the structure of programs through interaction techniques like drag and drop or menus, rather than manipulating a program’s structure indirectly by modifying a text buffer and interfacing with a parser.

The use of the word “language” is what annoys me. There is no such thing as a programming language that is “block-based”! Programming languages are syntax and semantics; they are abstract, formal notations that describe computation. They do not have a shape! Scratch’s syntax isn’t “blocky” just like Python and Java aren’t “blocky”: they all have a syntax defined by an abstract formal grammars that dictates what program is considered valid. And Scratch’s semantics aren’t “blocky” either: what is “block-based” about the Scratch statement “move 10 steps”? Nothing.

I can prove this with a single example:

when myTimer fires
move 10 steps

See? I just wrote a Scratch program, but in a text editor. There’s no parser to parse it, nor is there a runtime to run it, but it uses the same Scratch syntax and has the same Scratch semantics. Nothing “block-based” about it, and it’s still Scratch. Well, I guess it kind of traces a block shape, so let’s render it differently:

when myTimer fires: move 10 steps

See? Now it’s not a block, it’s a line. Should we call Scratch a line-based programming language? Or, if we are to be so bold, a “text-based” programming language? No. Scratch is Scratch; there is nothing text, line, or block-based about it.

Of course, to understand this, there are several ideas that students and teachers have to know:

  • Programming languages are syntax and semantics, and can be discussed and used independent of any particular tool. In fact, many students in India, without computers on which to learn CS, learn to code C and Java on blackboards! We don’t call C and Java “blackboard-based programming languages.” So when we refer to Scratch the programming language, we shouldn’t be describing it as block-based, because the language has nothing to do with the editor.
  • Programming environments are collections of tools used to write and run programs in one or more programming languages. The Scratch programming environment is really the Scratch website. It’s where new projects can be created, programs can be edited, run, and shared. The environment is what lets us use a programming language to create things. And even though there’s only one main Scratch programming environment, there could be many: I could create a Scratch programming environment that runs on my smartphone, or an augmented reality Scratch environment that takes things in our physical environments as inputs. The Scratch programming language would still be the same language, but the environment would be different.
  • Code editors are a specific class of tools that we use to edit programs. The Scratch editor—which lets us drag blocks around and enforces the Scratch syntax—is just one of many possible editors. I could write Scratch on a blackboard, on a whiteboard, on paper, in a text editor, in Microsoft Word, in Google Docs, in the sand on a beach, or even create an elaborate set of cardboard tangible manipulatives representing Scratch code. All of these editors would have different strengths and weaknesses. For example, text editors of various kinds would require some parsers and impose confusing syntax errors on students (which is why we invented block-based editors). And a tangible code editor would require moving a lot more, and we might run out of physical “when” blocks. All of these editors would be editing the same Scratch programming language, just using a different user interface.

So what do we call things like Scratch? It’s a programming language that comes with rich web-based programming environment that features a block-based editor. If we’re talking about the language, we use the word language; if we’re talking about the website, we use the word environment; and if we’re talking about the website’s editor, we can say block-based editor. If we’re talking about all of them, we might call the entire collection a programming system, or just Scratch. What we should not say is block-based language because that doesn’t make any sense and we shouldn’t use words don’t make sense.

Now, remember that this was just a rant about words. In no way do I despise block-based editors themselves. In fact, I love them! I spent a year doing research on them. I spent a wonderful year with the late Randy Pausch and his team tinkering with their editor and modifying it for fun. And I think that the idea of block-based editors (and their earlier incarnations in the 1970’s and 1980’s, which inspired the drag and drop editor in the 1990’s, which inspired Scratch’s editor in the mid-2000’s) are one of the major innovations that have lowered barriers to learning to code by making syntax errors impossible and making a language’s grammar visible. In fact, it’s because I find block-based editors so powerful that I get so annoyed when people use the word “language” instead of “editor”—it takes attention away from what’s powerful about a block-based editor’s user interface, and wrongly attributes it to whatever language it’s associated with.

I doubt this rant will end the use of the phrase block-based language. It’s too ubiquitous, and for good reason: the editor is the most salient thing about environments like Scratch, and people learn them at the same time they are learning about programming languages. I can’t expect teachers or students to understand the difference between a language, environment, and editor when they’re busy trying to comprehend code itself. I certainly didn’t in my first programming environment—my TI-82’s TI BASIC environment. To me, there was just a “keypad-based language” that let me make animations and text adventures. Only once I discovered roughly the same language in QBASIC in MS-DOS did I realize that languages and editors were different things. That realization can come with time for students too. All I can ask is that teachers understand this difference and that they eventually make this difference clear to their students by exposing them to different languages, environments, and editors.

What about visual programming languages? Bahhh, don’t get me started!

--

--

Amy J. Ko
Bits and Behavior

Professor, University of Washington iSchool (she/her). Code, learning, design, justice. Trans, queer, parent, and lover of learning.