Smalltalk


I became re-interested in Smalltalk after reading a hilarious book called The Unix-Haters Handbook. This book, written before the rise of Linux, exposed for me the emperor's nudity that is Unix's unfriendliness. I am basically a Microsoft fan, especially of their UI work, but no one likes a monopoly. Java was worth a try, but it's curly and proprietary. So what did the Unix haters like? Well, Lisp. I'm sorry, but I cannot get into Lisp (I tried hard during my six-month Linux-Java-Emacs phase). Hmm. What else...

My first OO language was SCI--Sierra Creative Interpreter. This language was written by Jeff Stephenson for programming adventure games at Sierra On-Line. My brother-in-law Chris Smith, who got me a job with Sierra in late 1989, sent me some sketchy documentation for SCI. One of the highlights of my programming life was sitting on my bed reading that documentation the day I got it. SCI was a combination of Lisp, C and Smalltalk, but the message-passing was very much Smalltalkesque. I loved the language. I played with Smalltalk a bit in 1991, but the UI was weirdly WIMPy, thouh un-Window-sy (and un-Borland-character-mode, which was the state-of-the-programming-art at the time). But being able to send any message to any object that understood that message--regardless of inheritance--was something it was hard to give up when I went on to C++.

After more than ten years with C++, I became interested in more dynamic typing environments, starting with writing COM components in C++, then using an existing component to easily write a Visual Basic application, and finally, back to where I was 14 years ago, relishing the power to send anything to anything.

Current Sites

General

Dolphin

Running all test subclasses in SUnit Browser

SUnit Browser 3.1.5 for Dolphin Smalltalk has a good feature that lets you browse and/or run just the tests for a certain project by deriving those tests from an abstract subclass of TestCase. You can simply right-click the abstract test class and select Test -> Browse (or Run).

The trouble was, when I (a Smalltalk newbie at this time) tried to use the feature, it didn't work. I'd just get an empty SUnit browser window. It was annoying to have to manually select just my current project's tests, so I really wanted to get this to work.

Jeff Odell's own tests (with abstract base test superclasses) seemed to work as he advertised, so I used a couple of browser windows side by side to examine the differences in our superclasses (shades of combing through VC++ settings to see why one project builds and another won't).

Jeff says you need to open the browser "on an abstract superclass under TestCase." Hmm. I know how to make an abstract class in C++, but how do you do it in Smalltalk? As it turns out, there's no language mechanism (big surprise)--your class simply answers true to #isAbstract. Cool! I laughed lightly as I added the method to the superclass.

But it still didn't work--I didn't get any nice list of subclasses in the SUnit browser window. :( And I sure didn't feel like doing any more side-by-side comparisons of methods and instance variables to see why his tests showed up and mine didn't.

OK, I'd heard you can debug the debugger. That sounded like it might be the fastest way to figure out why SUnit Browser wasn't pulling up my test subclasses. But what was the name of the class that SUnit uses, so I could pull it up in the browser? Hmm. I'd always wondered what the point of the Visual Object Finder was. Guess I figured that out!

After a very little browsing around SUnit Browser's code, I found the perfect place to put a self halt (is it just Jeff, or are all Smalltalk programs this easy to understand?). Seconds later, I found the problem:

I needed to override #isAbstract in the subclasses. :)

A few weeks later

I got tired of adding isAbstract>>^false to each concrete test subclass. This can be avoided with

AbstractTestSuperClass>>isAbstract
^self name = #AbstractTestSuperClass
.