apologies due

September 25th, 2004 by Jeff Leave a reply »

I finally did finish that project on time, and it appears I owe Mr. Robertson here an apology. VisualWorks does, in fact, have a way to automate class creation; I just didn’t look hard enough. So I’ll retract the topic of my previous posts. Smalltalk does not suck. I just don’t have a good instructor to show me the ropes.

Smalltalk is different from Java just as English is different from Japanese. In fact, that’s a pretty decent analogy; the “word order” is completely different. Whereas in Java I’d say System.out.println(“Hello world”); in Smalltalk I’d say ‘Hello world’ printNl. In the first example, I tell Java’s System class to do the printing. In the second, I tell the Smalltalk string to print itself. I suppose which is more intuitive is a matter of taste, and exposure. It certainly helps to have someone who

  1. knows what they’re doing
  2. can teach the basics in a logical fashion

I think part of my frustration with dealing with Smalltalk stems from my professor’s inability to explain the basic classes one needs to code anything in this new language. The other part stems from the fact that I expected Smalltalk to be codeable in a simple text editor. A simple text editor like TextPad or BBEdit is something that everyone who can code, if not everyone who can use a computer, is familiar with. Moving from that cozy single-document space into VisualWorks’ multiple window interface with zillions of menus was downright intimidating. What’s this “Workspace” and “Class browser” and “Transcript”? Where do I enter my code? Why can’t I just type in a file with classes and compile/run it like in Java or C++ or Perl? Why isn’t Smalltalk more like all these other languages I’ve already learned?

So for those of you Smalltalk devotees trying to convert the masses from other languages, your real first step is to explain slowly and patiently that Smalltalk is NOT like C++ or Java or Perl. Code is not always stored in its own file. Control and looping structures look completely different. Counting begins with 1. There are a bunch of other quirks. Things that are completely fundamental in many other computer languages are flipped about or turned inside out in Smalltalk. You must be prepared to answer the inevitable question: WHY is it done this way in Smalltalk? For instance, with every computer language I’ve learned since the age of 7, branching conditionals have always been in the format if (statement) then (expression). The best answer is the reverse question: WHY is it done that way in another language? The implied answer is that these pieces of computer language are arbitrary, despite years of convention in more popular languages. Being able to explain the mutability of computer language fundamentals is a good first step towards teaching Smalltalk.

Myself, I’ve got things like traditional for loops and if-then conditionals pretty much hard-coded into my brain at this point. I can read simple things like 1 to: 5 do: [:x | x printString], just as I can read many simple Japanese texts. But it takes a little bit more effort than reading for (x = 1; x < =5; x++) { cout << x << endl; } which would be the equivalent of English for me. Conceptually, Smalltalk is a beautiful programming language, but it takes me much more effort to write it than an equivalent C++ program. In the same way, the Japanese language has a lot of wonderfully elegant grammar, but it's so different from English that it takes me longer to compose a meaningful sentence. Do you catch my meaning?

So I don't think I'll ever just switch over to using Smalltalk, any more than I'll stop speaking English and start writing books in Japanese. The languages I use on a regular basis fill their niches quite well, and Smalltalk just isn't quite as intuitive to me as some folks tell me it should be. But don't take it personally, please; it's just because I've grown up on all the other languages.

4 comments

  1. Mitsu says:

    In my case, your analogy fits in perfectly, also with stunning similarity in how I grew up and how I learned to program.

    My first language was Japanese, and learned English since I was 7.

    I learned my first programming at first year of uni, and I learned a highly low-profile language called “Haskell”, which does go something like:

    foo (x:xs) | x <= 5 = [x] ++ xs
    | else = xs ++ [x]

    Since this was my first programming language, as was Japanese as spoken language, this is perfectly intuitive and natural for me. A semester later, I learned C, and Java. Because I didn’t have concrete knowledge of my first language (applies for Japanese too), I had no trouble learning the C syntax (which incidently applies to most common languages, as does English, the common language around the world). Now, I write C (and some of its derivatives) and Haskell with balanced fluence, which is in parallel with my English and Japanese skills.

    So I’ve got one of those freaky first/second language parallel in spoken and programming languages, too.

  2. Mitsu says:

    OK, WordPress didn’t like Haskell syntax…

    I was saying how when I learned Haskell as my first programming language in Uni, I had no problems because I had never learned any other syntax, nor did I know what a syntax was. A semester later, I learned C, and because my knowledge of my first language was not concrete (as was my Japanese at the age of 7) I had no troubles picking up the C syntax, which incidentally is the most commonly used syntax (including its derivatives), as is English. I guess I speak Japanese as well as I write Haskell, and I speak English as well as I program in C.

    So I’ve got one of those freaky parallels between the first/second language that I spoke and programmed.

  3. Jeff says:

    Fixed. It thought you were trying to enter HTML code. Use &lt; in the future, or enclose everything within <code> tags.

  4. Reinout Heeck says:

    You my want to sign up to the vwnc mailing list for a while. It is a good place to ask those ‘silly newby’ questions (low flame content, newbies very welcome). It is a waste of your time sussing out ‘where did System go’, just ask.

    I hope you stick with Smalltalk long enough to get to the point where you grok *why* it uses these inside-out control structures, so you have something to show yourself for your efforts. (At that point you’ll have the interesting choice of wither ‘more Smalltalk’ or moving on to a language where control structures are spelled backwards instead of inside-out like Forth or Postscript ;)

    See http://wiki.cs.uiuc.edu/VisualWorks/VisualWorks+Online+Communities

    HTH!

This work by Jeff Hiner is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported.