Ben Matasar

Fri, 19 Oct 2007

Zero to Squeak

Months ago, Göran Krampe asked me to write up what it was like to learn Squeak from basically nothing. It's a good idea, and I always meant to write this up, but I haven't gotten around to it until now. Before I got to Smallthought I thought of myself as a Schemer by temperament and a Rubyist by trade. I had tried to use Squeak several times over the years, and had even played with Seaside a bit, but was basically put off by the following:

image

However, I admired Seaside from a distance, and especially Dabble. The story of me getting my interview is long and boring, but the short version is that I quit Intel to find my way in the web world. My interview was to fly to Vancouver and work on Dabble for two days with Avi and Andrew over my shoulder, and the surprisingly not-British Colin Putney around to pester with questions.

If it sounds intimidating, that's because it was. But I didn't have much trouble picking up Smalltalk or the Dabble codebase, and I have some tips for people that have experience with dynamic languages and the web but are looking to take the plunge into Smalltalk.

Use "senders," "implementors," and "Method strings with it"

These are hard to understand for people like myself who didn't use IDEs much before, and Smalltalkers take them so for granted that they don't usually mention them at all to newbies. Basically you can ask Squeak who sends or implements a particular message selector. In this way you'll bounce around the code, leaving dozens of windows in your wake. You should use these all the time to get your bearings around a complicated codebase.

"Method strings with it" is a feature that comes in handy when you're looking for render methods in Seaside. What I'll do is "view source" in my browser, find a reasonably unique looking css class or id, and search for it with ⌘-shift-e. Then I can edit or refactor the relevant render method.

Love the debugger

I wrote this in a reddit comment in response to the recent post by Giles Bowkett called Debugger Support Considered Harmful:

I think the name debugger gives people the wrong idea about what it is, at least in Smalltalk. When I first came to Smalltalk in December of last year I tried not to use the debugger, and I did think of it as a crutch. Now I use it all the time to get my bearings around a codebase. In fact, I write quite a bit of my code directly in the debugger, often with my web browser spinning in the background waiting for me to send the response.

I now think of it as a method context browser, where you have an active REPL at every step of the call stack. This is nice because you can send messages to the objects, to poke them and figure out how they're going to respond to messages.

I'll probably write more about this soon, because I think I have a somewhat unique perspective.

tech | link | 2007/Oct | comments (0)


Ben Matasar ben@matasar.org