August 7th, 2008

Smalltalk: The original IDE as a silver bullet language.

I’m not quite as up to speed on smalltalk as I’d like to be, but this guy seems to know a thing or two about it. He reports on being forced into using java at work for 6 months. Fortunately, he went straight for an IDE (SmallTalk is -heavily- IDE based. It had refactor-like tools and live debugging in an editor environment as early as 1976!), specifically, eclipse.

Now, going in, java is at a huge disadvantage:

  • - It has a metric buttload of warts, which are sure to be a sore sight for the syntactically very clean smalltalk,
  • - He doesn’t want to, he’s being forced to,
  • - In a java+PHP shop I doubt the java code he gets to work with is particularly inspired, and
  • - 6 months isn’t really enough to get properly comfortable with all aspects of a language.

Java actually comes off shiny given such preconditions.

One thing that made me go ‘whhueungh?!?’ is the conclusion that ‘final’ is a big mistake. I thoroughly don’t get this. Personal experience and generally accepted wisdom both agree that as a rule extending classes is a bad idea unless a class was designed for it in the first place. In fact, I litter ‘final’ statements all over the place. It mostly marks a class as: Don’t try and extend this! Just wrap it - to any developers that come after me. This works out fine. Where there is a generic element to extract (e.g. The functionality conveyed by java.util.Collection and java.util.Set where a HashSet is concerned) there’s usually an interface which gives you the option of wrapping. I wonder which classes he’s so bent on extending.

Not to mention a host of practical problems. If, say, you COULD extend java.lang.String, you start running into a host of annoying problems. Like, for example, the idea that any given String may not be immutable anymore. Restrictions can help, and immutability is one restriction that helps a lot (anyone who has ever tried writing multi-threaded code in java should be able to attest to this).

Cees’ closing note is the idea that Smalltalk ‘teaches’ you better programming, in that it instills in you the urge to run often, write unit tests, and keep everything integrated nicely (mostly to enable running everything). I think this is one area where java is truly guilty of being the cause, not merely the scapegoat due to the idiots also flocking to java given its popularity in the workplace.

I can heartily recommend eclipse’s live code swap-enabled debugging environment. Just run your programs in debug mode, and start changing code, and save the file. If eclipse can’t immediatly make these changes happen ‘live’, you get a popup suggesting you restart. Apparently with 1.6 a bunch of features have been added that should allow eclipse to ‘hot code replace’ more often (right now if you start meddling with signatures, say, adding a method or tacking on a throws clause someplace, you have to restart).

5 Responses to 'Smalltalk: The original IDE as a silver bullet language.'

  1. 1Cees de Groot
    December 13th, 2006 at 14:26

    “6 months isn’t really enough to get properly comfortable with all aspects of a language.”

    Err… I started with Java when half the documentation was still referring to “OAK”, was the first guy ever to write a type IV JDBC driver, have been a CTO of a Java startup and was a member of the Blackdown Java porting team. So I think my Java credentials are enough to be entitled to an opinion about the language :)

    About final: I should be allowed to decide how to shoot myself in the foot. Not the JDK designers. They’re not all-knowing, you see…


  2. 2rzwitserloot
    December 13th, 2006 at 15:34

    My apologies, Cees. I got the wrong impression, apparently.

    No, the JDK designers certainly are not all-knowing (at this point I’d like to enter ‘java.util.Calendar’ as Exhibit A…) but short of the wrappers and String, there isn’t all that much final in the JDK itself.


  3. 3Slava Pestov
    December 14th, 2006 at 2:36

    Wow, you acknowledge that a language other than Java exists. This is unprecedented!


  4. 4Göran Krampe
    February 27th, 2007 at 13:56

    …and to anyone not familiar with Smalltalk - the last bit about “live code swap” is something Smalltalk does all the time without any problem at all. In fact - in Smalltalk you are always in “runtime” so it must by definition be able to do ANY KIND of changes that you as a developer can dream up. And yes, this includes shape changes like adding instvars and thus forcing migration of existing instances.


  5. 5rzwitserloot
    February 27th, 2007 at 17:11

    Goran: Yes, true. Perhaps that wasn’t obvious from what I wrote. The intent was simply to convey that you can also get that in java, just have to use one of the big 3 IDEs.


Leave a Response

(Note: if you use a new name from an unknown ip address, your comment won't appear until I approve it. Anti-spam measure only, I don't censor).

Imhotep theme designed by Chris Lin. Proudly powered by Wordpress.
XHTML | CSS | RSS | Comments RSS