file-243119101

Today’s Smalltalk: A Second Look At The First OO Language

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.

stalltalk

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:

 

subscribe-2

  • http://redline.st James Ladd

    I think you should have covered Redline Smalltalk as well. I’m a little biased but we are attracting/creating new Smalltalkers and making the JVM a deployment platform. 
    - James. 

  • http://redline.st James Ladd

    Forgot to mention: 
     
    Website: http://redline.st 
    Campaign: http://www.indiegogo.com/smalltalk/x/1366536

  • Dan Howard

    No we should not look at Smalltalk again. Why do we keep going back and repeating the same stupid mistakes over and over again? Smalltalk was a FAIL for good reasons so let’s all move on.

  • Stephan Eggermont

    @dan Probably because it is the language giving the best development experience. Fast feedback rules. What is the alternative? Newspeak, yes, but that is still a bit early.

  • http://www.anonymousartofrevolution.com/ Anonymous

    @stephan I think newspeak is the way to go

  • Blake Watson

    Dan– 
     
    I can see that argument applying to COBOL or PL/I or some other language competed with others of the same sort, had its moment (or didn’t) then faded away. 
     
    But most of the reasons Smalltalk never had its moment were because the industry hadn’t caught up with it. 
     
    -> It was OO before anyone got OO, while OO has been mainstream for 20 years now. 
     
    -> But it was =too= OO for people used to using objects in 3GLs, which isn’t really an issue with languages like Python, Javascript and Ruby. 
     
    -> It was also too resource-intensive, but it’s actually pretty speedy compared to Python and Ruby. 
     
    -> It was too expensive, costing $2-$5K a seat 20 years ago. Now there are tons of free and cheap options. 
     
    -> Portability, one of its great strengths, wasn’t worth the trade-offs in a homogeneous Windows world, but ideal for a splintered world of Windows/iOS/Android/Linux/etc. 
     
    I’m not sure what “mistakes” you’re talking about that are inherent to the language, the environment concept, and so on. Can you back that up?

  • http://www.runbasic.com Carl Gundel

    @Dan, 
     
    The mistake you refer to was IMHO the switch to Java from just about everything else. The entire industry followed Sun off a cliff. Nobody would touch anything that wasn’t Java for years, which is just ridiculous. Software developers didn’t abandon Smalltalk. They abandoned *everything* that wasn’t Java.

  • Thomas Lukasik

    I’m curious why you never mentioned anything about security. Where is Smalltalk today with respect to the ability to write secure code? All of the cool stuff that you mention is attractive for the hobbyist programmer, but in today’s virus and hacker prone environment is not going to attract professional mainstream developers who need to write secure software. 
     
    As a software architect and developer, and ex-Smalltalker (mostly VisualWorks and IBM Visual Smalltalk) I miss Smalltalk, but can’t justify picking it up again if there is no market for Smalltalk development — a situation that likely will not change if it’s impossible to write very secure Smalltalk code due to the very qualities that make it fun to use. 
     
    BTW: At the time that I worked heavily with Smalltalk, the cost for VisualWorks was ~ $10k per developer seat, so when Java – an affordable (read: free) O/O alternative – arrived in 1996, I immediately switched. But I can’t say that I’ve never looked back. I do miss Smalltalk development. 
     
    TJL 

  • Thomas Lukasik

    >> “Finally, security comes in many different flavors.”  
     
    But unfortunately, all security breaches tend to taste pretty much the same. 

  • http://goran.krampe@gmail.com Göran Krampe

    As a long time Smalltalker but also a language freak I just wanted to fill in a few things: 
     
    Smalltalk was NOT a “fail for good reasons”. In fact, it was not a fail at all, back in early 1990s Smalltalk was used to build a lot of advanced systems successfully. It had about 30% of the OO market, C++ had around 60%. 
     
    There has been a strong trend “reimplementing” Smalltalk. Python but especially Ruby is a clear Smalltalk “clone”, but still missing a few important things. The current crop of new languages still borrow heavily from Smalltalk – Traits for example which was developed first in Smalltalk is “hot” in new languages. 
     
    Two of the latest new languages – Dart and Julia are even more Smalltalk-like, and with very good performance. 
     
    Finally, security comes in many different flavors. Seaside for example, the premier web framework for Smalltalk – is VERY secure compared to most other frameworks out there. So without any closer qualification as to what “security features” you are referring, it is very hard to answer that. 
     
    Personally I think that Smalltalk is doing quite well – and there is TONS more than this article covers.  
     
    At the same time I think that eventually the rest of the world will “catch up” and create something very similar – and it will be a huge success. :) 
     
    regards, Göran

  • blake

    No joke that there is TONS more. The initial article was twice as long, after editing. I took out all the commercial stuff because I couldn’t do it justice in a short article. I took out all the samples, too. 
     
    As a 20 year vet, I was still astounded by how much I found that I didn’t know about in researching this.

  • Agressor

    You are dumb. Move on.

  • Pingback: In the News: 2013-06-28 | Klaus' Korner

  • kilon

    So how many security breaches it takes to figure out that “computer security” is a bad joke ?

    If languages like Javascript and Java are considered success , then why people are so annoyed with them ?

    Also why all this negativity towards smalltalk ? Most of the things smalltalk invented, or push forward when few others did are the very foundations of modern coding and software. IDEs , GUIs, mouse , VMs , OO , version control , live coding , TDD and the list is just almost endless.

    Is the whole deal how popular smalltalk is ? And why this even matters ?

    Take objective C , back in 2001 objective C according to tiobe index was the 40th most popular language in 2001 . Where is object C now I hear you ask ? Well it is in the 3rd place. Yeap you heard correctly objective C is the 3rd most popular language in the world ranking RIGHT NOW after C which is first and Java second. Quite an impressive climb. And objective C is the undisputed child of smalltalk.

    Did it climb so far , did it became a superstar because its an awesome language , or maybe because it became so much more awesome ? Eh not really.

    It only dependents on the sucess of iOS which in turn depends on the huge success story , marketing wise, sale wise of iphones and ipads.

    Java is another big marketing trick as well, Sun made sure to push Java everywhere on planet commercially and did an awesome job at marketing it.

    Now how much Java or Objective C have affected the modern world , compared to smalltalk ? Well it happens their effect is from small to non existent. They are nothing more than big recycle bins that badly recycle old technologies.

    The hard truth is that most people are as one person once said “I love progress I just dont like change”. The problem arises with the fact that change is brought to them gradually with big marketing tricks. The problem is that that progress is bad implementation of older progress because of legacy code.

    Dont pity smalltalk, pity the rest of the world still after decades trying to catch up. This is not a coding problem or a software problem.

    This is the human condition.

    I enjoyed your article and its a very good introduction to what modern smalltalk really is. Well done, keep them coming.

  • Pingback: Link roundup | Kind of Digital

  • Pingback: Link roundup – Kind of Digital | Public Sector Blogs

  • foobar

    simula was the first OO language

  • Jan Robinson

    So for a delivery leader in a large IT company who would like to add Smalltalk resources but is having a hard time locating them offshore – what is the most likely ‘more widely available’ language skillset I can look for in trying to find developer(s) who will be successful in quickly picking up Smalltalk and likely to enjoy it?