by David J. Malan <malan@post.harvard.edu>
Printer-Friendly Version of Tutorial

« Previous | Table of Contents | Next »

Introduction

Most programming languages, on first glance, "look like Greek" to the untrained eye, an amalgam of English and unusual syntax. Consider, for instance, the program below, written in a language called Java.

class Hello
{
    public static void main(String [] args)
    {
        System.out.println("hello, world!");
    }
}

All the program above does, when executed, is display "hello, world!" on the user's screen. You might have guessed as much just by looking over the code—and ignoring anything that didn't make sense! But what's with all the curly braces ({ and })? What's System.out? What does class Hello mean? And public static void main(String [] args)? Let's not even go there.

Suffice it to say that, when it comes to learning to program, there's quite a learning curve with languages like Java. Before you can begin to solve problems, you must first learn to read and write a new language, even if the task at hand is relatively simple (e.g., "hello, world!"). And whereas you might still understand a foreigner who mispronounces some English word, computers aren't so forgiving when it comes to mistakes. Leave out a semicolon, and the program above won't even work!

Learning to program is ultimately about learning to think logically and to approach problems methodically. The building blocks out of which a programmer constructs solutions, meanwhile, are relatively simple. Common in programming, for instance, are "loops" (whereby a program does something multiple times) and "conditions" (whereby a program only does something under certain circumstances. Also common are "variables" (so that a program, like a mathematician, can remember certain values).

For many students, the seemingly cryptic syntax of languages like Java tends to get in the way of mastery of such relatively simple constructs as these. Before we tackle a language like Java, then, with its curly braces and semicolons, we turn our attention to Scratch, a "new programming language that lets you create your own animations, games, and interactive art." Although originally developed for kids by the Lifelong Kindergarten research group at the MIT Media Lab, Scratch is just as useful (and fun) for budding computer scientists. By representing programs' building blocks with color-coded blocks (i.e., puzzle pieces), Scratch "lowers the bar" to programming, allowing budding computer scientists to focus on problems rather than syntax, to master programmatic constructs rather than syntax. Syntax, of course, will come later. But, for now, we focus on programming itself. It just so happens that programming, for now, will be more like putting together a puzzle than writing Greek.

This tutorial introduces budding computer scientists to the building blocks of programming by way of Scratch. It assumes that you are already familiar with Scratch's usage and, accordingly, have a general sense of how to program with Scratch. This tutorial aspires to formalize your understanding of programming, framing some basic programming constructs in the language of Scratch.

We turn our attention first to statements.

« Previous | Table of Contents | Next »