If you haven’t paid attention to Smalltalk in a while, it might be time to catch up. Blake Watson traces its evolution, tells you the current state of the development community, and some of the cooler tools that the language has gained.
Smalltalk has always suffered from being ahead of its time. The programming language was object-oriented before object-oriented was cool. (Actually, it was object-oriented before there was anything called “object-oriented”). Smalltalk’s orientation was pure, making it especially “weird” to developers who were steeped in procedural languages (and most people were). It was dynamic before dynamic was cool, too.
A Smalltalk environment is its own little world, designed around a conception of a computer with a minimal operating system and populated with living objects. Environments were expensive to buy. They were also expensive to run in terms of hardware requirements.
Because Smalltalk designer Alan Kay’s primary obsession is education (not helping children so much as building better adults, he says), Smalltalk has often been seen as a child’s tool—a bad mix, for something so expensive. If you were to describe old school Smalltalk’s domains, you might bizarrely come up with “education and finance.”
However, most of the old objections to Smalltalk have been overcome by technology or the world catching up to what it offered. In this article, I share some of the reasons that Smalltalk is now relevant and why programmers should pursue it. For this exploration, I restrict myself to the biggest names in free and open source Smalltalk solutions, and offer my opinions about the domains in which they excel. But really, these are just the top few items.
Squeak: for Etoys and Collaboration
Any examination of modern Squeak necessarily begins with Squeak. In many ways, it is the first well fleshed-out realization of the ideas first pioneered by Smalltalk-80.
The first iteration of Squeak was a plain-ish clone of the Smalltalk-80 environment, but by the time version 3 was reached, Squeak had become a colorful, kid-friendly development environment with strong multi-media capabilities. The old ST-80 MVC model (oh, you didn’t know MVC came from Smalltalk?) was supplanted by Morphic, a prototype-oriented GUI cribbed from Smalltalk’s lesser-known sibling, Self.
Squeak also featured a new educational programming environment called Etoys. Etoys is also prototype-based and centered on immediacy, making it very easy to directly interact with objects and to see the results of code. Etoys is great for modeling things quickly and easily, and you can even upload Etoys projects to the Web, as seen at Squeakland.
As good as Etoys is, it suffers somewhat because, as with many component-based development tools, there’s a steep gradient between “consumer” and “developer.” This is antithetical to Smalltalk’s philosophy of being able to look at and manipulate anything in the system. However, the Etoys system has been steadily developed for over a decade, and improvements are constantly being made.
Also, Etoys isn’t really meant to teach kids programming. It’s to teach them how to model things with math and logic, and merge that skill with creativity. That’s great, and kids pick up a lot of important concepts from Etoys, but when it comes to teaching kids programming, I favor “Squeak: Learn Programming With Robots.” This (now free!) book by Stéphane Ducasse (remember that name!) exploits Squeak’s flexibility to create a very simple universe where the student needs only to issue commands to very simple “bots.”
Etoys created a certain amount of tension in the Squeak community: It was actually a prototype that took on a life of its own, so the implementation was less than clean. Trying to remove Etoys from the image was both technically and culturally challenging. Etoys taxed the Morphic graphic system, so a more flexible system, “Tweak,” was developed. It never actually took Morphic’s place—but ended up being used in many other cool systems (most notably the Smalltalk based 3D collaborative environment OpenCobalt).
Meanwhile, Etoys ended up as an integral part of the One Laptop Per Child project (very similar to Kay’s dream of the Dynabook), and another new Etoys-inspired environment,Scratch, recently emerged.
Pharo: for Business and Beginners... and iPads?
While Squeak continues to evolve, the tension in the community over what Squeak should be and how it should progress ultimately resulted in a number of forks. The most prominent fork is known as Pharo, started by Marcus Denker, Stéphane Ducasse (remember that name?), and Sven Van Caekenberghe.
Pharo doesn’t scream “fun” like Squeak 3.x did, but perhaps ironically, it can be easier to take up than Squeak was (beyond Etoys, that is). For example, one of the best tutorials for Squeak is Steve Wessel’s Laser Game tutorial, which covers test-driven development and is a good way to get familiar with working in Smalltalk. But make sure you download Squeak 3.9 to test it; there’s no telling whether it will work with the latest version.
By contrast, Pharo has probably less material overall, but it tends to be maintained with the latest version. Pharo By Example is a rewrite of Squeak By Example and has already been followed up with Pharo By Example 2. There are screencasts and “ProfStef,” which is a tutorial built into Pharo itself.
Pharo is relatively young as well, first appearing in 2008, It’s of course possible that the documentation could eventually succumb to rot, as much Squeak stuff has, but the “benevolent dictatorship” behind Pharo may also make that less likely than the cat-herding approach of Squeak’s board.
Pharo’s implementers have a clean, uncluttered website where you can find their roadmap and Pharo success stories. This may seem like mere promotion, but it can also be helpful if you’re trying to figure out what you can and can’t do. It’s one thing to know that there’s an ODBC connection package available in your environment, after all, and another to see an application on the success page that lists connecting to Microsoft SQL Server databases.
It’s especially cool to see the classic Smalltalk app, Dr. Geo, listed as one of the success stories—and available for the iPad! That beats trying to figure out if Apple’s current licensing requirements will allow you to use a VM or interpreter on iOS, I’d say. Dr. Geo is also available for Android.
Cuis and Spoon: for Pioneers
If you’re bold, and you have ideas about how things should work, two other implementations are of interest: Cuis is a sparse, small, clean Smalltalk that favors getting smaller and simpler with each release so as to facilitate those who want to experiment with the language, the VM, and so on.
If Cuis is a constant effort to get smaller, Spoon is an ambitious attempt to start with an absolute minimum of assumptions as to where an object might be or come from. Spoon is slated to be the starting point from which the next major version of Squeak is built.
Smalltalk on Rails
Smalltalk has three prominent web frameworks: Seaside, Aida, and Iliad. They have a lot in common. For example, unlike Ruby on Rails, which works off of HTML templates, the Smalltalk frameworks use methods that are turned into HTML.
Seaside is the best known and documented of these frameworks, and features a style of programming for the web that is component-based. In other words, using Seaside is much like programming a non-web application.
You develop Seaside in your Smalltalk environment, as you would any Smalltalk application. But when you launch your app in a Web browser, you have access (in browser) to a class browser, you can inspect any component, and you can make changes in the browser that you can immediately test. These changes go back to your non-browser development environment. This is very slick, indeed.
Seaside had one of the great Smalltalk success stories: Avi Bryant’s Dabble DB, an online ad-hoc database application generator. Dabble DB had a user-friendly front-end and intelligent back-end that was successful enough to attract the attention of Twitter, which bought it out. (And, unfortunately, shut it down in 2011.)
All three frameworks work in a number of Smalltalk implementations. Pharo is considered the reference framework for both Seaside and Aida.
The Persistence of Memory
The traditional Smalltalk approach to persistence is, well, just to persist. Because of the nature of the image, objects are created and live out their entire lives while the image is running. The image is either saved on exiting, or at intervals, and a changes file can be used in the event of a crash to restore an image that ended abnormally.
This approach is actually fairly robust and usable for small amounts of data. It has the advantage of being something you can use to delay your decision on what other system to use.
Smalltalk has a serializer called Fuel, which allows objects to be persisted, as which someone recently showed me with a very cool trick. Although it’s not without limitations, you can actually serialize a Pharo debugger, save it to disk, and load that back into another, different image.
If you want to get more sophisticated, you can use a database approach. If you want ORM, for example, you can use GLORP. Or for a straight object-database solution, there’s GOODS.
One thing the various Smalltalks have gotten very good at in recent years are “one-click solutions,” where you download a single development environment and it comes with everything you need for a domain (or a number of domains). One of the most powerful object databases, Gemstone, is available as the GLASS appliance. GLASS stands for Gemstone, Linux, Apache, Smalltalk, Seaside. You can download and start developing in this environment in a matter of minutes, and be dealing with a fully functioning, highly scalable development environment and deployment solution.
Smalltalk as JavaScript, JavaScript as Smalltalk
The concept of the Smalltalk image can strike even modern programmers as strange, and yet something very similar has arisen almost organically, albeit in a rather wan and terrible way: The Document Object Model of any webpage can be treated much like a Smalltalk image, although without any persistence (outside of a framework like Seaside).
That being the case, it’s not surprising that Smalltalk should have its own incarnation in the browser. One of my favorites is Minori Yamashita’s Little SmallScript, a JavaScript pre-compiler similar to CoffeeScript.
What I love about Little SmallScript is that the project appears to have been started two months ago by a guy who’s never coded in Smalltalk. He’s got a live interpreter on that site you can use to see how your Smalltalk becomes JavaScript.
By sheer odds, this project is unlikely to take off, but it’s hard to deny that this:
number := opposite ifTrue: [-42].is absurdly cleaner than this:
number = opposite ? (function () {return -42;
})() : void 0;
A more elaborate and complete effort can be seen in Nicolas Petton’s Amber. While conceptually similar, Amber features a genuine IDE within the browser, and can be used to create HTML5 pages or Node.js (or in any JavaScript VM).
Another very cool thing with Amber can be found under the Learnlink on that page: Stéphane Ducasse’s interactive Smalltalk tutorial has been translated into Amber so you can learn the bulk of Smalltalk syntax on the Web, in an interactive Smalltalk environment.
If Smalltalk can be JavaScript, it’s perhaps no surprise then that JavaScript can be (i.e. act as) Smalltalk. And it’s no surprise that members of the original Smalltalk team would try to take the larger ideas of Smalltalk programming and put them into an environment where everyone can get to them, and without having to overcome Smalltalk’s historical baggage as a language.
Thus: the Lively-Kernel. This amazing thing – coded by the first person to ever create a Smalltalk, Dan Ingalls – is well worth exploring. It is much like Squeak 3.0, running entirely in your Web browser, with drag-and-drop components and high-level-features, along with the usual class browser, workspace, and so on. It’s all in JavaScript, which makes me weep for aesthetic reasons, but certainly it increases the potential audience for Lively.
GNU Smalltalk: For The Timorous
For those who are a bit skittish of diving headfirst into Smalltalk, or even using something like Amber, there is GNU Smalltalk. Billed as “the Smalltalk for those who can type,” GST happily lets you code from a command-line.
Although I’ve always found that intriguing, a command prompt reading "st>" isn’t really conducive to the sort of exploration that Smalltalk is meant to encourage. Still, along with supporting the standard ST-80 base classes and some others (like Iliad) it also has a unique graphical interface. And its NCurses bindings may make it unique in the field for facilitating purely textual Smalltalk apps.
You can even split the difference and try Shampoo: a way to hook Emacs up to your GST or Pharo image for editing.
Summary
As someone doing Smalltalk for 20 years now, I’m not ready to pronounce Smalltalk as a “language on the rise” or “a hot trend” or any of the other things articles like this usually do. It’s still a weird outlier, it’s still going to be something at which executives look askance, and even with all the resources I mentioned here you will encounter headaches and puzzling things along the road.
But I will say: If none of these things here have piqued your interest, even a little, you are not really a programmer.
Blake Watson is a programmer and author living in Los Angeles.
See also:
[dfads params='groups=937&limit=1&orderby=random']