Smalltalk and late binding objects

samtregar on 2003-03-21T19:07:45

I've been learning Smalltalk by reading a book about Squeak. I must say I am extremely impressed. The language itself is interesting enough, but the Squeak environment is unbelievable. I've litterly never seen anything like it. If you think "visual programming" means Visual.NET and Delphi then you really should check out Squeak. And best of all, all the source is available. Everything from the VM all the way up to GUI applications is written in Smalltalk and available for browsing.

So far the most interesting idea I've encountered in Smalltalk is the focus on late binding. Most object-oriented languages have static type systems that bind at compile time. This results in very inflexible systems that don't adapt well to change. Smalltalk on the other hand is practically type-less and binds methods to objects at the last possible moment. Basically, you can send any message to any object and you only find out if it works at runtime when the object either understands the message or doesn't.

Of course, that's the same way Perl works! Seeing the way that Smalltalk exploits this property to build object systems that can be reorganized at runtime is very interesting to me. I think that if I let this stuff stew long enough I'll eventually be able to integrate it into my OO design methodology. And if that happens, watch out!

-sam


Debugging a program into existence

dws on 2003-03-21T19:22:31

One of things that sets Smalltalk apart is the ability to literally debug a program into existence. You can call methods that don't yet exist, then trap into the debugger, add the method, and continue execution. The first time I saw someone working this was, my jaw hit the floor and my eyes bugged out. Though I didn't realize it at the time, they were doing test-driven development without having to stop and restart execution environment. Wow.

*the* way to learn objects

merlyn on 2003-03-22T01:31:22

I've often said that you don't know objects until you've used a pure-object system, like Smalltalk, Eiffel, or Ruby. Hybrid systems like Java, C++, Python or Perl (sorry!) don't count.

Squeak rocks. It has a heritage leading back to the original Smalltalk-80 system, being maintained by two of the guys that came from that place and era (Alan Kay and Dan Ingalls). On a 68K-class machine, you had a full interactive development environment, including a breakpoint system with full source-code symbolic debugger that lets you restart from the middle of the interrupt, having changed code at any level of the stack. Try that with Java. And as soon as you taste the "everything is an object" world, you won't want to go back.

Now you know Smalltalk syntax...

pdcawley on 2003-03-23T22:31:11

I strongly recommend Smalltalk Best Practice Patterns by Kent Beck. Top notch stuff.