SmallTalk @ FP

I’ve just had a group introduction to Smalltalk. Piers was visiting Brighton and decided to teach us all about the roots of OO programming. In lieu of the usual 5-minute-on-keyboard sessions, Piers gave us a walk through of developing kata 4 in smalltalk.

This was a superb way to learn the language. There was more heckling than usual, but that was an important and necessary part of the process in this case. Watching smalltalk in action is absolutely necessary—it’s just such a visual experience (compared to regular programming languages, anyway). I now completely understand the smalltalk credo I’d read about: just type in what you want to happen, hit “run test” and when it breaks, write the code in the debugger window that pops up.

Just before half time, Piers started pairing properly. That was when the language differences really started to hit home. Smalltalk is so not an algol-influenced language. In particular, I adore the cascade:

  fromRow: aString
    ^ self basicNew;
      setRow: aString;

That semicolon is calling methods (sorry, passing messages) to the same object after each semicolon. The statement is only terminated with a period. Conceptually, it feels similar to Perl’s $_ (or “it”).

As usual, we didn’t get particularly far in the task, but we did learn a huge amount. A big thanks to Piers for visiting us and also to Devi for cat-herding in Joh’s absence (and doing an excellent job of keeping us on-topic).

Now, I’m off to download Squeak