One of the interesting questions that came up when I taught a Smalltalk class last week was on "uniqueness" - the students wanted to know about things that Smalltalk was capable of that would be hard (or impossible) in the languages they knew. Most of the students were Java/C/C++ developers, so it wasn't hard to find a few things that stood out:
- Classes are just objects
This one often throws people. When all you see is constructor code, realizing that a class is just another object can be an epiphany. I was able to get that point across by showing them class instance variables - and pointing out that they are simply instance variables for the class. This isn't a hard idea to get across - but it demonstrates the differences between the Java notion of a class object and the Smalltalk notion of a class object quite well.
Most people come into a class expecting to learn about a fixed set of reserved words that define control structures. When you get to blocks in Smalltalk, it's just a little different. One of the things that really helped here was the debugger - I was explaining how #whileFalse: worked, and I used the debugger to show the power of blocks. Walking through the code in the debugger really explained things - and made it clear that blocks allow you to define your own "control structures" in Smalltalk.
It's not that you can't do the kind of message dispatch that #perform: allows for in Java - it's that in Smalltalk, it's simpler and more convenient. That's a mixed blessing, of course - every Smalltalker I know (including me) went dynamic message creation crazy sometime during their first year or so of Smalltalk - before realizing that over-use can make code impossible to follow. Every language has landmines you can step on - this is one that most developers run into fairly early in Smalltalk.
In any event, these topics engendered a lot of good conversation in the class, and I think they helped demonstrate the power and flexibility of the language to the students. One other thing I found to be a great help - the workspace created by Ivan Tomek that we ship with the NC product. It has a lot of great examples that helped quite a bit. I should probably talk to Dave Buck about this stuff - he's got a lot of experience teaching Smalltalk, and offers training classes now.