Posted by Rick DeNatale
Wed, 21 May 2008 20:58:00 GMT
Last night, James Robertson from Cincom, presented Smalltalk and Seaside to the Raleigh Ruby Brigade.
It was an interesting deja-vu experience, since in my younger days, part of my job with IBM was evangelizing Smalltalk, much as James does today. It was interesting to see what has and hasn’t changed. For the most part the things about Smalltalk which were blessings and curses (or many times both) haven’t changed. The IDE is still powerful. It gets much of it’s power from Smalltalk’s model of how source code and run-time implementation objects like compiled-methods, classes and metaclasses interact, but the consequence is that there aren’t really Smalltalk source files to use with popular editors like VIM or EMACS or Textmate. The question came up about whether the Smalltalk IDE supported the notion of giving the code to an external editor, and the answer was that the size of a typical Smalltalk method, which is the unit of editing, was so small (10 lines is a long Smalltalk method) as to make it ‘moot.’ I used to get the same kind of questions and give pretty much the same answers.
One area where Smalltalk really does excel is in it’s debugging and inspection tools. The same implementation object model which enables browser features, like finding all senders or implementers of a message using structural rather than textual searching, also allows live debugging, where you can not only inspect the run-time state at a breakpoint, or when an exception occurs, but actually make changes to the running code, and compile those changes, at which point the VM prunes the invocation stack down to the point of the change and allows you to restart from that point. Protestations from TDD/BDD adherents that you don’t need no steenking debugger if you follow TDD practice, the Smalltalk debugger was tool much favored by the very people, like Kent Beck, who invented TDD. Many Rubyists who were around for more than a year or two had an anti-debugger attitude, generated more, I suspect, by the lack of a decent Ruby debugger than any real hatred of debuggers.
Now that ruby-debug has been around for almost two years, the situation is much better. Ruby has a fairly competent debugger which allows stepping through code. It’s still hampered by Ruby’s rather simple run-time meta information, being forced to work on a line-by-line mode, rather than being able to step through individual expressions as can the Smalltalk debugger. And we’re still a long way from the live surgery capabilities I described. Perhaps as Ruby VM implementations mature we might see some of these advanced features emerge, perhaps this is something which the Rubinius implementers might also take as an inspiration from Smalltalk. This is one of the main things I miss from my Smalltalk days.
On the other hand, at this point in time, I’m really much happier working in Ruby than I think I would be were I somehow forced to work in Smalltalk again instead. Much as I love it, Smalltalk is now my second favorite language.
At one point last night, Brian Adkins asked me the question which is the title of this article. I think it’s a fair question, and I’m not sure I know exactly, but let me try to answer it.
What I’d miss from Ruby
I’ve said this before, but one of the things I like about Ruby is that it is more dynamic than Smalltalk in ways which I like, and cuts back on other aspects of Smalltalk which I don’t think are really that important.
One of the things I like about Ruby is the elimination of variable declarations. A good example of this was that during the Seaside demo last night, James showed how interfacing to the database requires attribute instance variables in model objects to be declared. Now the IDE provides tools for helping with this, you get prompted with a list of column names and can add them one by one just by clicking buttons. Contrast this with ActiveRecord where model objects just acquire instance variables dynamically at run-time. Now I know that some prefer more explicit mappings, but personally I feel that the dynamic mapping provides much more capability for much less ceremony.
The ways in which Ruby is more dynamic than Smalltalk seem to me to provide better facilities for building low-ceremony architectures and artifacts like Rails, Rake, etc. There are more dynamic languages than Ruby to be sure, such as Self, and from what I can sense JavaScript, but Ruby seems to strike a very nice balance.
Much has been made of the legacy of Smalltalk in pioneering metaprogramming, although some Lisp guys might quibble with that, and in truth, most Smalltalk metaprogramming was only used to support the IDE and never put to use by application programmers. Alan Kay used to say that he was disappointed that no one seemed to make new classes of Behavior (which is the superclass of both Class and Metaclass in Smalltalk). I know he said this to some of us at an IBM internal conference, which at least led to Dave Smith and Jerry Archbald developing a “behavior of behavior” tutorial which ran for several years at OOPSLA. But Rubyists have taken metaprogramming much further than I recall from my Smalltalk days.
On the other end of the scale, Smalltalk as James pointed out, as I used to, has a very simple syntax, a few reserved words (self, super, nil, true, and false), three types of messages (unary, binary, and keyword), two operators (:= for assignment, and ^ for return), and a few more things for defining block literals.
Now when I was doing James’ job, this got mixed reactions. Some people took to syntax like:
topLeft = Point x: 3+2*5 y: 15
While others found it just a little too strange, something which we Smalltalkers just couldn’t get.
Another thing which put off newcomers to Smalltalk was that, because of the simplicity of the language, and the lack of any form of operator precedence (remember the only operators are := and ^), that subexpression 3+2*5 evaluates to 25 and not 13.
Ruby trades off a little simplicity and does provide precedence between messages which seem like they should act as operators.
I’m not saying that Ruby is without quirks, just that different people react to different quirks in different ways. If you don’t like what you perceive to be the quirks of any programming language, you won’t be convinced, even by the most ardent supporter of those quirks.
One of the interesting effects of the Smalltalk syntax was that, as we observed back in Smalltalk’s heyday in the Enterprise (late ‘80s-early ‘90s), it seemed that a lot of COBOL programmers seemed to take to Smalltalk. We used to think that Smalltalk might actually become the 21st century COBOL, until the “Enterprise” got wooed away by EJBs and the like. The same things which made Smalltalk approachable by COBOL programmers made it seem weird to those who looked down on those COBOL programmers as “trade-school” programmers.
Another much-touted feature of Smalltalk, is that everything is done by message sending, even control flow. In Smalltalk a if/then/else control flow is achieved by sending an ifTrue:ifFalse: message to a boolean object as in:
^(x = 0) ifTrue:[a] ifFalse:[b]
Smalltalk evaluates this as if the the expression (x = 0) is evaluated by sending the message with the selector = and argument 0, to the object referenced by x. The result of that message, an object of course, is then sent the message with the selector ifTrue:ifFalse: and the arguments [a] and [b], which are two blocks. What happens is up to that object. Typically that object is either true (the sole instance of the class True) whose ifTrue:ifFalse: method evaluates the first argument, or false (the sole instance of the class False) whose ifTrue:ifFalse: method evaluates the second argument. Very neat and conceptually clean. It allows you to define your own control flow methods.
Ruby on the other hand compiles if statements and their kind as tests and branches, much as a C compiler would. We trade off a little flexibility for performance.
But, in my experience, that flexibility rarely got used in Smalltalk. Not only that but, in my day at least, the Smalltalk compilers would also compile ifTrue:ifFalse: to a test of the result of the ‘receiver’ and a branch. In fact I just tried defining a FakeBoolean class with an ifTrue: method and when I try to use it I see this:
That NonBooleanReceiver exception is like seeing the Wizard of Oz behind the curtain, this notion of no control flow, just messages is actually a bit of an illusion.
Again, while Ruby doesn’t even pretend to implement all control flow by messaging, it provides most of what the underlying Smalltalk mechanisms are really used for in the form of blocks used to implement iterators.
There are other aspects of Smalltalk which are both blessings and curses. The fact that Smalltalk has a persistent run-time image, containing all the development tools, which can be saved along with its state of execution, and restarted is quite powerful, alien to many programmers, and can drastically change your approach to deployment. Back when I was doing Smalltalk we always struggled with issues like the footprint of the image, how to strip out the development tools before deployment, and start-up time. Some of these problems might seem to be less severe with today’s hardware, but they are still issues.
I feel that I might be coming across a little too harshly on my old friend Smalltalk. It still provides a great programming environment, and serves as a source of inspiration which shouldn’t be overlooked, and I hope to see some of the powerful development tool features from Smalltalk appear with help from support in some of the emerging Ruby implementations. I’m glad to see that it seems to be making somewhat of a resurgence, along with dynamic languages in general. But for me right now, while I wouldn’t be unhappy if I had to go back to Smalltalk, but I feel happier with Ruby.
Posted in ruby, war_stories, smalltalk | Tags debugging, seaside | 5 comments | no trackbacks
Posted by Rick DeNatale
Fri, 15 Feb 2008 13:29:00 GMT
One of the classics in the Smalltalk literature, which has also had a big influence on the Ruby community is Kent Beck’s “Smalltalk Best Practice Patterns”
, which captures the best practices for designing and coding Smalltalk programs. Back when it was published, I used to see Kent a few times a year, and happened to be in the Bay area when he made an author appearance at the Computer Literacy Bookstore in San Jose, where I got my copy, and the autograph shown here.
The Ruby language has many similarities with Smalltalk, so much of Kent’s advice applies to Ruby. I frequently hear prominent Rubyists mention the book.
On the other hand, Ruby is not exactly Smalltalk, so Kent’s book isn’t an exact fit to Ruby. I’ve been wanting to start writing about adapting some of these patterns to Ruby for a while, so this article will hopefully be the first in a series.
The Motivation For This Article
Recently on the ruby-talk forum a thread discussing accessor methods vs. direct instance variable access came up. This was a hot debate topic in the Smalltalk community back in the 90s, and Kent addressed it in two competing patterns in the book, one of which Ryan Davis (a.k.a ZenSpider) brought up in the conversation.
Read more...
Posted in ruby, smalltalk, best_practices | Tags bestpracticepatterns, kentbeck, patterns | no comments | no trackbacks
Posted by Rick DeNatale
Fri, 08 Feb 2008 21:14:00 GMT
The more I think about Ruby in relation to other object programming languages I’ve worked with, the more I realize that there’s a continuum of static vs. dynamic typing.
Ruby fits close to one end of that continuum. Understanding this can help understand how to best use the language. I recently had a quick look at Russ Olsen’s new book Design Patterns in Ruby
and looked at his section on the observer pattern. I’d just posted to ruby-talk about this pattern, how it was implemented in Smalltalk, and a more Rubyish implementation. I’ll get to that at the end of this article, but first I really feel the urge to talk about instance variables.
If we view a type as a particular interpretation of a memory layout, I see something like this
| Language |
Outside |
inside |
| Java |
static |
static |
| Smalltalk |
encapsulated |
static |
| Ruby |
encapsulated |
dynamic |
Read more...
Posted in ruby, smalltalk | Tags binding, java, variables | 3 comments | no trackbacks
Posted by Rick DeNatale
Tue, 01 Jan 2008 19:39:00 GMT

I've written before in this blog about how the meaning of the term "object-oriented programming" got hijacked from it's original meaning. For example I go into this in some length
in my mini-memoirs.
I recently ran into an interesting site with links to "Classical Computer Science Texts", which in turn led me to this e-mail exchange with Alan Kay on the meaning of OOP from July of 2003.
This exchange gives support, with details, for my description of Kay's concept of what Object-Oriented Programming was supposed to mean.
I'm not against types, but I don't know of any type systems that aren't a complete pain, so I still like dynamic typing.
- Alan Kay
As Kay explains, the key concepts came from biological cell communications modeled as networked "whole computers" and a desire to "get rid of with data"
As for the influence of Simula on Smalltalk's notion of classes and inheritance:
I didn't like the way Simula I or Simula 67 did inheritance (though I thought Nygaard and Dahl were just tremendous thinkers and designers). So I decided to leave out inheritance as a built-in feature until I understood it better. - Alan Kay
And summing it up:
OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. It can be done in Smalltalk and in LISP. There are possibly other systems in which this is possible, but I'm not aware of them.
I'd argue that you can do this in Ruby as well. I don't know if Ruby was on Kay's radar in mid-2003.
Posted in ruby, smalltalk | Tags alankay, types | 6 comments | no trackbacks
Posted by Rick DeNatale
Sat, 17 Nov 2007 11:18:00 GMT
One of the things about working with software is that you can pretty much do anything you imagine.
Many of these things can be cool.
And many of them, particularly in retrospect, can be less than brilliant.
Here are two of the more visible cool, but stupid things I've done in the past.
Read more...
Posted in war_stories, smalltalk | Tags smalltalkdistributed, stupidity, visualage | 1 comment | no trackbacks
Posted by Rick DeNatale
Sat, 03 Nov 2007 06:51:00 GMT

I finally got to meet Matz in person today, and we had a nice little chat.
I was pleased to learn that he follows this blog. My readership might be small, but it's quality readership. One thing I told him was that as much as I love, and still love, Smalltalk, I really do feel that I love Ruby just a little bit more.
We talked a bit about the upcoming stabilization of 1.9, which will be frozen as far as language and standard libary changes for the Christmas 2007 1.9.1 release, at which time transition from development to stable status. He has been backing out some of the differences between 1.8.x and 1.9.0. He told me that he had recently, or was soon to, revert the changes to the scoping of class variables. It appears that class variables will continue to be shared between classes and subclasses.
He also cleared up a technical ruby mystery that's been puzzling me for some time.
About a year ago I wrote about a change in Ruby 1.9 which cleaned up the semantics when modules included by a class are re-included in a subclass. The mystery is that sometime after I wrote the article, in a subsequent revision of 1.9, this got dropped. I never could find out why this happened, so today I took the opportunity to ask Matz in person.
Read more...
Posted in ruby, smalltalk | Tags matz, railsconf, railsconf2007 | 4 comments | no trackbacks
Posted by Rick DeNatale
Sun, 02 Sep 2007 21:35:00 GMT
I’m catching up on my RSS feeds this afternoon, and I just ran across the
latest from John Lam. Which exposed an interesting coincidence.
Oh yes, Merlin is the original code-name for our team, which was originally IronPython but has now expanded to include the Dynamic Language Runtime and IronRuby.
- John Lam
The codename for IBM’s original VisualAge project was “Camelot.” Various subcomponents
and follow-ons were dubbed with various names from Arthurian legend. For example, there
were components with names like “Lancelot” and “Guinivere.”
Sometime after the initial success of VisualAge, it was decided that IBM would actually
produce a separate Smalltalk language and IDE packaging, a product which was originally named
“IBM Smalltalk” at launch.
But during development IBM Smalltalk had Arthur’s wizard as its namesake. As usual there
were tee shirts, and this article starts with a picture I just took of my copy of the IBM
Merlin Tee, which my wife still uses as an exercise tee.
And in case you can’t read them, the words in the
crystal ball read “think BIG/TALK small” a combined reference to IBM, Smalltalk, and I suppose, Teddy Roosevelt.
Now old Merlin might look more like a Swami than the wizard of Camelot, but here’s the proof
from the front of the shirt:
So to paraphrase my old buddy Kent Beck, I knew that Microsoft was trying to implement
Ruby, but I didn’t know it would be called Merlin!
Posted in ruby, war_stories, smalltalk | Tags ibmsmalltalk, ironruby | no comments | no trackbacks
Posted by Rick DeNatale
Tue, 14 Aug 2007 15:03:00 GMT
The first Ruby Hoedown, sponsored by the Raleigh Ruby brigade, has finally come and gone. I had a great two days, saw some old friends, and made lots of new ones.
Here are my initial thoughts after more than a bit too litle sleep after a night trying to root out werewolves.
Read more...
Posted in ruby, war_stories, smalltalk, rails | Tags history, rubyhoedown | no comments | no trackbacks
Posted by Rick DeNatale
Tue, 07 Aug 2007 19:24:00 GMT
Not long ago while working on an existing Rails application, (i.e. code I hadn’t written). I was mystified
when a logical expression seemed to be returning an odd result. The expression had been written with not,
and, and or, and was the right hand side of an assignment statement. ventually I changed to using !,
&&, and || which fixed the problem.
I never completely
understood what was going on, until I encountered this
blog entry by Jay Fields.
One of the big differences between Ruby and Smalltalk is the use of operator precedence. In Smalltalk, the grammar is
very simple, unary message selectors bind tighter than binary selectors, which bind tighter than keyword selectors.
The assignment operator binds more loosely than any of these. This is often a stumbling block for newcomers to Smalltalk
when they find that in Smalltalk 3 + 5 * 2 evaluates to 16.
Ruby in comparison has quite a rich and flexible syntax.
Usually, it’s quite intutitive, but, depending on where you come from there can be some surprises.
I understood the relative precendences of, say && vs. and in Ruby, but the fact that
and had weaker precedence than = escaped me, until Jay’s article turned the light on for
me.
As they say, you learn something new everyday, or at least you hope you do. I don’t expect that I’ll forget this little
corner of Ruby in future
Posted in ruby_for_nubys, ruby, smalltalk | Tags gotchas, syntax | 1 comment | 1 trackback
Posted by Rick DeNatale
Thu, 21 Jun 2007 19:06:00 GMT
Maybe I’ve gotten a bit sensitive of late to the perception some Rubyists
seem to have of Smalltalk-bred Rubyists like me. So I thought that I might say a bit more of what
I think of the current and future of Ruby as a language.
What follows is much longer than what I expected it to be when I started writing it yesterday,
I hope that some will find it some combination of interesting, useful, thought-provoking, or
at least amusing.
Read more...
Posted in psychology, ruby, smalltalk, humor | Tags C, java, language, language_wars | 8 comments | no trackbacks