Why Smalltalk is such a unique language, and how it evolved into modern variants like Scratch, Squeak, and Pharo.

Ever wonder where Scratch got a lot of its ideas? Where programming terms like “object oriented” come from? In this issue’s programming language spotlight, we’re going to answer those questions by learning about Smalltalk, a language from the 1970s that didn’t just influence Scratch but was used to make it. We’re going to learn about some of the history of Smalltalk and how it relates to Scratch, then look a little at modern versions of Smalltalk like Squeak and Pharo.

Scratch, if you’re not already familiar with it, is based around programming sprites. Sprites in Scratch are like little robots. Each sprite has its own code that it runs and code that responds to all sorts of events happen in the program, like the background changing or a sprite being clicked on, as well as messages that can be sent by other sprites.

Meanwhile, in Smalltalk, everything in the program—even things like numbers—are all entities called “objects”. Here, an object is a thing that can have its own code that runs and code that’s able to respond to messages from other objects in the program.

Sounds pretty similar to Scratch, right? There’s some pretty big differences though. In Smalltalk, everything is a message. An if-statement for making decisions is just a message to the Boolean objects true or false. Addition is just a message to a number. Every “function” call, which are “custom blocks” in Scratch, is a message.

This makes messages in Smalltalk far more powerful than messages in Scratch. They’re more flexible and can be used to do almost everything.

Also, in Smalltalk, everything is an object. Everything. This would be like if, in Scratch, you could add code not just to the characters in your game but could change the sprite editor, what blocks do, and even how the basic user interface works. That’s what programming in Smalltalk is like.

Now we’re ready to get started with Squeak and, in particular, a version of Squeak that has fantastic books and documentation written about it: Pharo.

So first navigate to the main Pharo website, download the Pharo installer, and run it. You’ll be presented with a slightly intimidating screen that looks like this:

What it’s asking you to do is pick one of these virtual computers with a ton of pre-built code to load. Pick the one that says something like Pharo (stable) 64bit and red starburst to download and make the “image”. Once it’s downloaded you can click on the image on the right-hand side of the screen and hit the play button.

You should now be looking at a screen that looks like:

If you’re following along, I recommend immediately trying out the ProfStef tutorial. It’s a fantastic interactive tutorial that teaches you both the basics of Smalltalk syntax and how to interact with Pharo in general.

As a bit of a spoiler, part of what’s so different about Pharo/Squeak is that you don’t run whole programs so much as you shape the program interactively, writing and running bits and pieces as you go.

To whit, if you have Pharo open hit Ctrl-o w in order to open a “playground” for running code. Now try typing:

heck := Morph new color: Color blue.
heck openInWorld.

Highlight the code you wrote and then hitting “Ctrl-D” to run it. You should see a little blue rectangle. Now you can do all sorts of things with it.

So type:

heck bounds: (([email protected]) corner: ([email protected])).
heck color: Color orange.

And “do it” in order to change the color of the object on the screen and move it.

This is obviously just a tiny taste of what programming in Pharo is like, but I recommend digging into the book Pharo By Example in order to really start learning more about programming in Pharo. If you want an example of what games programming looks like in Pharo, check out this video.

It’s a great language and I hope you have fun with it!

Learn More

Programming Games in Pharo











  • Clarissa Littler

    Clarissa has worked in mathematics, physics, and computer science research but spends much of her time now trying to make computer science education accessible to a broader audience.

Also In The February 2020 Issue

Can you figure out how to divide up coconuts between a group of sailors and a monkey? This puzzle mixes math and coding. Plus you can go online to try the code yourself!

Recreate the classic game in this simple Python tutorial. What whimsical stories can you write?

If you like ships, then you’ll love this easy-to-use website that keeps track of seafaring vessels around the world. Bonus: it helps prevent maritime collisions!

Ready for some good old-fashioned winter fun? In this article, build a digital snowman with Sketchup.

A fun, silly way to share your coding trials and triumphs with friends — because everything is better with kittens!

Should you learn Python, Scratch, Java, Assembly? If you’re feeling overwhelmed by too many options, this article is here to help.

Illustrating computational concepts like decomposition and algorithms with simple, hands-on, and occasionally messy activities.

In the old days, before video game systems had cameras and sensors, programmers had to get creative.

Six women were hired to use their math skills to program the ENIAC computer. They called themselves The First Programmers Club.

Learn about the key software that keeps your computer safe from viruses.

Programs are constantly being patched and improved. How do we keep track of all this new code?

Dive into the nitty-gritty details of binary numbers: how they work, why they’re used, and where they come from.

An easy way to code your own 3D graphics online. Dive into the world of pixels, triangles, textures, and colours!

Learn about the smallest, simplest computers and where they’re still used today.

Interesting stories about science and technology for February 2020.

Links from the bottom of all the February 2020 articles, collected in one place for you to print, share, or bookmark.

Interested but not ready to subscribe? Sign-up for our free monthly email newsletter with curated site content and a new issue email announcement that we send every two months.

No, thanks!