I’ve been meaning to learn Smalltalk for years now. Recently Dave Astels and I have a had a few discussion on the topic. They all seem to circulate around the theme of Smalltalk being a key OO language of the past, and again in the near future.
Now that Ruby has finally captures the attention it deserves, it’s not long before Smalltalk is back in the spotlight.
A few days ago, when he joined me for a train ride, I seized the opportunity and asked him to help me write some Smalltalk. He gave me a copy of Squeak and off we went to write the Bowling game.
Even though we only got through the first two test cases, Dave’s a good teacher and I was able to finish it on my own. The code is below.
My first impression of Smalltalk: “Damn, this requires a lot of clicking”. It requires two clicks just to run a test and another 5 clicks to see what failed. Dave gave me funny looks when I complained about this but I couldn’t believe people programmed this way.
Later my dad, remembering a demo by Kent Beck, reassured me that there are keyboard shortcuts for everything. Thank goodness!
In general it’s a sweet language. Experience with Ruby and Objective C exposed me to many of the concepts so there weren’t many surprises.
Perhaps the most peculiar thing I ran into was the Smalltalk equivalent to if/else statements. The ifTrue: ifFalse: structure makes perfect sense but it was unexpected. An example can be seen in the score method.
This is my first Smalltalk program and I’m sure I’ve made some newbie blunders. Feel free to rip my code to pieces in your comments. I’d love to hear advise and learn Smalltalk idiosyncrasies.