Tag Archives: Programmer

Scratch as a Programming Environment

By Robert Walsh

I have been programming for a long time. I started writing commercial applications in the middle 1990s, but my first exposure to computers was in middle school. Whether it be on the TRS-80 Color Computer or a TI99-4/a, I could

10 PRINT "HELLO"
20 GOTO 10

RUN

with the best on them. In high school, I learned a bit of Pascal using the Apple IIe, graduating to Turbo Pascal 5 on an IBM-compatible 80286 in college. From there, a whole host of other languages, including C/C++, C#, Java, JavaScript, and so on. One thing they all had in common was that they were text-based. Even though Visual Basic and rest of the languages available in Microsoft’s Visual Studio supported a visual editor for the GUI, the code to do things in response to user interaction was still written in text.

Programming with Puzzle Pieces

So, when I first learned about Scratch, I was not particularly impressed. “What can a programmer do just by dragging puzzle pieces around,” I thought. I tried to interest my daughter in Scratch, but we didn’t get much farther than moving the cat around the screen and switching its costumes.

Now that I have looked more closely at Scratch and how it can be used to introduce programming to those that have never done it before, I have gained newfound respect for Scratch as a programming environment. Yes, it is colorful and cartoony, but that does not mean it should be limited only to kids under a certain age.

Scratch as a Teaching Tool

To me, Scratch does two things that make it a great tool for teaching programming.

First, Scratch frees the programmer from having to remember what are often obscure syntax rules and language constructs. For example, even though I can write essentially the same program in Java, C#, or Python, the punctuation I use, the standard conventions for naming things, and even the physical structure of the code will be different. As a result, the programmer can quickly become overwhelmed trying to learn both concepts and semantics. By giving programmers an organized toolbox of available commands and operations, Scratch lets them focus on what they want to accomplish rather than the language-specific details for how to do it.

Second, Scratch allows the programmer to see the structure of the program being created in ways that are not necessarily obvious in text-based environments. Conditionals and loops are two examples. In C-like languages, the curly braces do denote blocks of code, as do indents in Python; however, these can become challenging to match when there is more than one level of nesting (and infinitely more challenging without proper and consistent indenting, something Python at least enforces).

With Scratch, the color coded shapes clearly show the pieces of code that belong inside because they are literally surrounded. Some might consider the fact that the if/else construct in Scratch does not support multiple else clauses to be a limitation. In my view, though, this emphasizes the fact that an if/else construct is really just an either/or. The “if” condition is either true or it isn’t. In the case that it isn’t, any other tasks that need to be done are part of the “else” clause of the initial check. The if/else if/else construct is really just shorthand for what should be considered a nested set of binary choices.

Give Scratch a Try!

If you are wanting to learn to program but you aren’t sure where to start, give Scratch a try. There are many self-guided tutorials that will walk you through creating all kinds of programs. Or, contact us! Even if you are an experienced programmer, take a look at Scratch and see if it changes anything about the way you think about your programs.