Arlo Guthrie and the origins of the Collection protocol

A bit of history to make you smile:

Rick DeNatale at Talk Like a Duck writes about
How Arlo got injected into Ruby [via Smalltalk].

During the interview he [Dan Ingalls] was asked about the origin of those enumeration methods of the Smalltalk collection classes. Alan Kay had told the interviewer that they had come from a song. At first Dan didn’t remember this but then remembered that there was a song which had a string of words like inject, select, detect etc. As far as I recall, though he didn’t name the song.

But I recognized it right away, here’s how “Alice’s Restaurant Massacree” transitions from the littering trial to the draft:

Came to talk about the draft. They got a building down New York City, it’s called Whitehall Street, where you walk in, you get injected, inspected, detected, infected, neglected and selected.

So that’s how the enumeration method names came into Smalltalk (and, later on, into Ruby)!

“Setting It Up Right” – Loading Useful Extensions into Pharo

Table of Contents:

Ok, so this section turns out to be much shorter than I expected. I mostly wanted to write about installing OmniBrowser, which is an extension/rewrite of the system-provided code editors in Squeak/Pharo. It adds all sorts of nifty icons and helpful behaviors (such as right-click on a method and be able to see its Senders and Implementors), and is a great package. And I wanted to point out that it’s kind of indispensable (at least I found it so), which is I why I would want to side-track a simple Hello World tutorial with the explanation of how to install it.

However, it turns out that OmniBrowser already comes pre-installed on the Seaside One Click Pharo image. And my adventures in trying to install it come from plain Squeak, of several years ago.

Same thing with code code coloring/syntax highlighting, and code auto-completion – installed out of the box (again, I used to have to install it manually).

With the time we saved not setting things up, it’s time to actually start learning Smalltalk syntax. For those few who are actually learning Smalltalk (or refreshing their memories after a long absense), I highly recommend diving right into the excellent free online book, Pharo By Example, and taking it from page 1.

Next up, a simple Seaside Hello World running on your desktop.

Why Smalltalk?

A quick word on why I choose to code in Smalltalk in my spare time, and why I enjoyed the hell out of working with it full-time, several jobs ago.

To put it simply, there is a feeling of delight, wonder and power when coding in a good Smalltalk environment (such as Squeak/Pharo or VisualWorks) that is unmatched by any other environment and IDE.

Like tasting fruit from the Goblin Market in the poem, and then forever pining away for it, working in Smalltalk spoils you for other languages (I’ve worked in C++, Java, Perl, Python, Ruby and Lisp) and development environments (tried VisualStudio, Eclipse, Emacs, vim, TextMate).

The two things that you spend most of your time doing as a programmer — coding and debugging — are made noticeably easier and more fun by that combination of Smalltalk language and IDE. The language syntax is small, powerful, expressive, introspective. The entire stack (and libraries, and IDE) is written in Smalltalk (turtles all the way down), and you have access to the source code, allowing you to study and extend all operations, basic and complex. The code organization — explicit, first-class visual IDE support for packages, classes, protocols (groupings of methods by intended use) and methods — is extremely helpful.

The debugger… is a thing of deep beauty. The ability, while, say, developing a web app, to not only set breakpoints and examine the state of the running program (even, if you set it up right, through the web browser itself — remind me to tell you about “halos”), but to be able to interact with the objects on the execution stack dynamically (i.e. call methods on them, and examine their output), and also to change code and resume execution from mid-halt… is freeing beyond belief.

The above things, by themselves, would merely make me like the language a lot, and miss its convenience. But the thing that makes it truly indispensable for me is Seaside, a web framework.

It is unorthodox, flexible, powerful, and… difficult to describe. I’m going to let people much more eloquent than me attempt to do so:
* Secrets of lightweight dev success, Part 8: Seaside
* A SeaSide Vacation

What’s the downside of working with Smalltalk, though? (Just ask the Lispers what the downside of working with Lisp is), rather than, say, in other sufficiently elegant and pleasant languages such as Ruby or Python?

In short, less popularity and a smaller developer base. Which means less third-party libraries, tools and open source projects. So, you’re a bit out there on the bleeding edge (which is funny, because Smalltalk is 30+ years old, but again, ask the Lispers about that).

The upshot, then is this. If you’re working on a well understood and often-solved problem (for example, CRUD-type record maintenance over the web), use something like Rails, Django or web2py. But, as is just as often the case, if your project is way off the beaten path (like, say, a web mud), Smalltalk and Seaside just might be perfect for you. And in any case, it is worth trying out for a week or a year. You will learn a hell of a lot.

Welcome – Seaside Thoughts and Tutorials

Welcome. Over the course of this blog, I would like to share my thoughts and experiences on web development on the Seaside framework using the Smalltalk programming language.

My current project is to implement a Web MUD (an excellent example of this genre is Kingdom of Loathing), a text-based persistent online game with a web interface, using Riak as a persistence engine. But specifically, this blog focuses on general areas of interest to current Seaside users, and those interested in learning more about this amazing and flexible framework.