Where I Come From
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.
- This weeks meeting of the raleigh.rb group was a recap of railsconf 2007. Some of the attendees seemed to have gotten a feeling that Avi Bryant was attacking Ruby in his keynote. I can’t speak for him, and I wasn’t there so this might just be my reaction.
- Heard this week on ruby-talk in a discussion of the fact that Module#ancestors doesn’t
include a singleton class of the receiver should it have one:
I do not want to argue with the wise guys if it is an error – I clearly thought so but that is not important ;)
To which I replied:
But it really would have saved me an hour of debugging if the doc stated clearly that singletons are not included. I thought this might help others and as it took me 20s to vim the missing line into class.c
- Robert DoberAs far as I can tell, singleton classes aren’t mentioned in the doc. The documentation borders on folklore.
Singletons as a means of implementing both individual instance, and class behavior have a position like “the man behind the curtain” in “The Wizard of OZ.” We’re really supposed to disregard them.
Coming from a background in Smalltalk, my preference would be if this machinery were more visible and official, but Matz has his reasons for not doing so. For one thing, not documenting it, and hiding it from methods like ancestors and class makes it easier to tinker with as the language evolves without “officially” breaking backward compatibility.Which prompted:
Does that mean that no one who’s ever used Smalltalk can ever think that it’s right for Ruby to deviate from Smalltalk? :-) I ask in a humorous spirit—and also because it gives me an excuse to mention:
http://www.infoq.com/articles/coming-from-ruby
—David A. Black
To answer David’s humorously posed question, No, and I present myself as “exhibit A,” because I certainly think that it’s right for Ruby to deviate from Smalltalk. My main motivations in writing about Ruby in the context of my Smalltalk background are first to help myself, and I hope others, understand Ruby a little better by providing some perspective from another, earlier, dynamic language, and second, to a much lesser extent, to air ideas of how some of the features of Smalltalk might be incorporated or adapted as useful additions to Ruby as it evolves.
In many ways, I like Ruby better than I like Smalltalk. To name a few reasons, Ruby is more dynamic, has a more flexible deployment ‘model,’, and albeit it’s not a technical reason, it’s not carrying the burden of the old business model of trying to get thousands of bucks for each development seat.
This is what really allowed Java to pop Smalltalk’s balloon. Smalltalk was seen by IBM and it’s competitors as “enterprise” technology, and they expected the same kind of prices which other corporate level software development tools commanded. When Java came out and was free “as in beer,” it gained a large popularity with language hobbyists/hackers who could easily get it to play with, and a lot of those guys worked for the companies to which IBM, ParcPlace-Digitalk, and the others were catering.
The other aspect of Java which helped at the time was it’s relationship in syntax, and a lot of its semantics, to C++ at a time when there was a lot of corporate C++ activity and some frustration was starting to be felt with the complexity of C++. Java felt enough like a simplified and friendlier C++ being a language which was more dynamic without “going all the way” and which felt familiar to both C++ advocates and C++ approach to strongly typed class hierarchies, and C++ programmers with symptoms of the Stockholm syndrome. These self-same aspects of Java caused many Smalltalkers to be uneasy with the language.
The real salvation of Smalltalk, as it exists today, was and is Squeak. I remember when I first encountered Squeak, it was at a Birds-of-a-feather session at OOPSLA, right when Java was really starting to get most of the mind-share. My impression was that the atmosphere in the room must have been somewhat like that in the Roman catacombs when the early Christians were hiding out.
I guess that there is still a bit of the old “Enterprise” Smalltalk market, Instantiations, which took over the old IBM/VisualAge Smalltalk base when it fell out of IBMs strategies, sells it for an entry price of $6,995. There must be enough of the old legacy corporate Smalltalk customers around who buy it.
Personally, it’s been quite a while since I was an active Smalltalker, I made an oddyssey through Java-land with IBMs shift in priorities. I plan to write about some of my feelings during that period in retrospection but that’s for a later date.
I haven’t been keeping up with Squeak enough to know how and how much it has evolved the Smalltalk technology and community.
Old Smalltalker’s perceptions of Ruby
I always thought that Smalltalk would beat Java, I just didn’t know that it would be called ‘Ruby’ when it did.
—Kent Beck
I ran across this quote for the first time a few weeks ago. It sounded like something that Kent would say, and also something that I would like to quote myself, but just to make sure, I asked him. He told me that ‘yes’ he had said it in a private communication to someone else, and both he and the original recipient had only recently found out that it was becoming an internet meme. Googling “I always thought that Smalltalk would beat Java” garners over 250 hits.
Kent tells me that he’s a Ruby fan. Ward Cunningham is also.
I asked Ward, just before RailsConf, if he was going since it was in his home-town. He said that he had found out about it after registration was closed, but he was planning to hang out at the hotel anyway. From what I heard last night he was recognized and invited to attend.
Several of my other old Smalltalk buddies, who had also gone through a period with Java, seem to have the same feeling which I do, that looking at and using Ruby feels like being a widower who meets a new woman, who just seems to be a partial reincarnation of the former spouse.
Where You Are Come From Depends On Where You Came From
Getting to David Black’s article. He certainly has a point about letting Ruby be Ruby. As I’ve said, I’m quite happy with Ruby.
Getting back to the early perceptions of Java, and making an analogy with natural languages let me suggest that if we think of Smalltalk as Italian, and C++ as German, Java is Alsatian, and Ruby is French.
Were it not for Squeak, Smalltalk might be Latin instead of Italian.
The most un-Smalltalk like thing about Ruby, to me at least, is the syntax, Smalltalk has almost none, many Smalltalkers say that Ruby has too much. I thought so initially, but now I’d argue that the flexibility and “sugarary” aspects of Rubys syntax are what makes it so successful as a host for internal DSLs like Rake, Rails/ActiveRecord, RSpec, etc. etc. which would be far less natural in Smalltalk with its extremely limited syntax.
One of the complaints I often heard about Smalltalk was it’s ‘different’ syntax just unary, binary, and keyword message send expressions, blocks, parentheses for expression grouping, the use of ’;’ to send a message to the object which got the last one, and single value assignment, and a way to return a value, everything else, including class and method definition, and control flow was built from these atoms.
Ruby probably appeals to a broader audience since it looks enough like something like Java not to be considered too wierd, at least not at first. For one thing in ruby 1 + 2 * 3 is 7, instead of 9 in Smalltalk due to its total lack of operator precedence.But, syntax differences aside, conceptually both Smalltalk and Ruby are romance languages, as compared to the Teutonic C++ and it’s kinder-gentler relative.
Language Evolution and Cross-Breeding
Programming languages evolve much like natural languages. They pick up influences from
other languages and incorporate them with modifications. English is the equivalent
of a multi-paradigm language, it has been influenced by the languages spoken by both the conquered
and counquerors of English speaking lands. It’s been influenced by Vikings, Normans, and Indians (both the Asian and American meanings of the last).
English has a lot of synonym pairs one from French and
one from Anglo-Saxon with it’s Germanic roots. Pork and pig; beef and cow; fraternity and brotherhood. This comes from the days after the Norman conquest when the language of the English court
was French. Bill Bryson describes this in his book
The Mother Tongue””The Mother Tongue”.
Many of the words considered “fancy” by English speakers are of French origin. Kent Beck told me that while he was working in Zurich on a contract with a Swiss bank, he found that an effective way of communicating with the programmers there, was to use simple English grammar, but “fancy” English vocabulary. The latter helped because the Swiss programmers facility with French increased the chances that they would share such word.
Multi-lingualism
There’s an old joke which goes:
What do you call a person who speaks two languages?
Bilingual.
And what do you call someone who speaks only one language?
An American.
Most good programmers, even the Americans, are multi-lingual when it comes to programming languages. As it does with natural languages, this gives a broader perspective.
But multi-lingualism sometimes makes it hard to compartmentalize language concepts. Once on a trip to Zurich, I was having dinner with Erich Gamma, some other Zurich OTIers, and a couple of customers in a very nice restaurant on the Bahnhofstrasse. My facility with German fills a small thimble, but as I perused the large menu, with no obvious English to be seen, I realised that I was reading it rather easily, and thought to myself, “Hmmm, I’m starting to understand German.” Then I realized that the menu was in fact bi-lingual, but the second language was French, a language with which I do have some facility.
I suspect that the “coming from x” quotes in David Black’s article are the result of this difficulty in compartmentalizing by newcomers to Ruby.
A Living Language
Programming languages, like natural languages, survive best when they evolve, this is what distinguishes live languages from dead ones. Languages die as the number of speakers diminish, despite revival attempts like Winnie Ille PuRuby is evolving, the core-team isn’t asleep, right now ruby1.9 is the cauldron to which new potions are being added to brew what will emerge as the next major Ruby revision.
This is another area where Ruby and Smalltalk have similarities. Smalltalk started as a paper design by Alan Kay to win a hallway bet challenging his assertion that he “could define the ‘most powerful language in the world’ in ‘a page of code’.” Dan Ingalls then actually implemented it in Basic on a NOVA minicomputer, this begat Smalltalk-72, which begat Smalltalk-76, which begat Smalltalk-80. Smalltalk-80 was the basis for the commercial Smalltalks of the pre-Java era, VisualWorks Smalltalk (ParcPlaces commercial Smalltalk-80), Smalltalk/V which merged with VisualWorks when ParcPlace and Digitalk merged, and IBM/VisualAge Smalltalk. Squeak is also a child of Smalltalk-80.
Smalltalk started to freeze when it became commercial. We tried hard to forge a standard in X3J20 which allowed evolution and variation by underspecifying things as much as we could, but broad enterprise acceptance slowed things down quite a bit.
So it’s exciting to see that Ruby is evolving. I hope that it too doesn’t get bogged down in it’s success.
Personal Preferences
Finally getting back to my “Coming from Smalltalk” quote in ruby-talk, I expressed a personal viewpoint that Ruby would be well-served if the mechanisms of singleton classes, and their use as metaclasses were made visible and officially documented parts of the language. If the rationale for not doing so is to preserve “freedom-of-action” in changing the implementation in future versions, I can understand it, but to used a mixed language expression, that is a “two-edged katana.” One of the things which Alan Kay told me a long time ago was that he was disappointed that so few Smalltalkers experimented with changing and extending Smalltalk by building off of the mechanisms of Class, Metaclass, and Behavior. In Ruby, despite the fact that knowledge of the equivalent implementation is only known “sub-rosa,” there is much more such experimentation. Metaprogramming in Ruby is au courant, and lots of code is being written which depends on undocumented “stuff.” I have to ask if this, being undocumented that is, is a good thing.
So, to wrap this all up, while I do “come from Smalltalk,” Today, I live in Ruby!










Yet another great read Rick! I would like to underline (or to put emphasis ( to not letting the language of my chosen country down ) you know VBI PATRIA VBI BENE ;)—help I cannot get out of the stack anymore )...)
Where was I, ah yes… put emphasis on the documentation aspect, I feel that the only thing I could not accept is to deliberately hide things in the documentation. Why then is Ruby Open Source? It is a pitty that nobody wants to commit a patch that just adds one line of documentation mentioning an important exception of a rule…
Now when it comes to Smalltalk, knowing Lisp and Perl quite well, but being ignorant in Smalltalk I still believe that Ruby’s most noble features come from Smalltalk.
Robert
Nice read; keep it up, old timer!
My main issues with Ruby are:
1) uncleanliness w/r/t licensing issues; a problem mainly just inside the halls of IBM, I guess.
2) open classes; I’m reminded of Steve Northover’s presentation on the evils of class extension in Smalltalk; so powerful, so dangerous.
Haven’t learned enough of the language to complain much more than that.
You going to be at the rubyhoedown.com?
Funny that you’re comparing C++ to German, although I can see where you’re coming from. I’ve always seen Pascal as ‘German’, and C++ as an ‘American’ thing.
Nice observation re: Stockholm Syndrome. ;)
I’m not sure how “almost no” syntax got changed into “extremely limited” syntax… You can come up with pretty “DSL-looking” code in Smalltalk given its message naming and ability to pass blocks properly. I’d even be tempted to argue that regular Smalltalk code is a lot more DSL-ish than some DSLs I’ve seen touted as examples.
testAddPost | body | body := Random sentenceMaxWords: 200. browser click: 'New Post'; enter: Random sentence for: 'Title:'; enter: body for: 'Body:'; click: 'Save'. self assert: (browser textExists: body)It’s still obviously Smalltalk, it’s a bit code-ier than a Watir extension I created, but… I guess I don’t consider this far less natural.
Patrick
At least IBM has a good understanding of, and participates in open source. From what’s been said publicly by key members of the MS IronRuby team, they aren’t allowed to look at MRI source. When they run into something unusual in a test case, they ask the ruby community for clarification instead of trying to figure it out from the source.
I hope to make it to the hoedown.
creaothceann
I have to give credit for the idea of comparing programming languages to natural languages to Burton Leathers (if I recall correctly).
Burton was a team leader at Cognos on a large Eiffel project, and was a member of an OOPSLA/ECOOP ‘90 panel which I organized and participated in called “OOP in the Real World.”
As I recall Burton said that he thought of languages in terms of the people who created them. It went something like:
I think that Burton used this during the panel, but it might have been some other time. There’s a report on that panel in the OOPSLA/ECOOP ‘90 Addendum to the proceedings, which is a synopsis written by an attendee, but it’s not in there. I’ve just scanned the report and there’s lots of relevant material for todays projects even 16 1/2 years later. It’s available for purchase from ACM online but you might also find it in a library. It’s a special issue of Sigplan notices.
Nice read, and as an old-time Smalltalker, I agree with much of what you say. I work primarily in Ruby now, and it’s the first language that I can use with as much joy as Smalltalk, perhaps more. Seems like these Ruby vs. Smalltalk screeds are getting fairly common. Perhaps I should do one too, heh.
Nice article, but those language choices… I don’t know. Indeed, Pascal would have been a good match with German. Nice one.
The funny thing when you compare French and English is with English it is much easier to relate spoken with written language, and that it takes about double the time to express something in French. :) If you ask me, I would say French is the C++. Smalltalk would be something like baha malaysian :)
You can’t document everything. You’re asking for flexibility and stability at the same time; a common problem for any language, any OS distribution, any car (be it German, French, American, or Australian :), and, well pretty much anything.
Please don’t get too cocky (because everybody agrees with you). Your viewpoint - though delivered well, like the proverbial wise armchair uncle telling a profound parable - might need more development.
Sorry, my English is shoddy … would you say it’s more French than Canadian?
All joking aside; if I thought Smalltalk was more like sumerian, and C++ was more like rapsta’, would you and I be able to communicate? I don’t want to put words into anyone’s mouth, but I think your answer would be simply, “sort of”. And then my response would be like, “okay, document that.”