Object orientation enlightenment

Ecris le 17 septembre 2005
Dans la catégorie Uncategorized |

There is something that annoyed me until now with Smalltalk: the code browser.I give here a sample of this famous GUI, which is the Squeak code browser (other Smalltalks have very similar code browsers).

Smalltalk browser

The Browser has two main parts. The upper part is four listbox allowing to select the method you want to edit. From left to right you have classes packages, classes, protocols and methods. Protocols are just group of methods. The other part of the browser is the code of the selected method.

Yes, you can see the code for only one method. If you want to see the code of two methods, even of the same class or same protocol, you have to open another browser. This limitation was really annoying me. I was used to editors showing, at least, the code of one class as one piece of text. I give you as an example a screenshot from Java Eclipse. Actually, editors for most of other languages, including C, C++ and even Ruby, have this design: you can see and browse as a document the whole code of your class.

Eclipse

I really did not understand why Smalltalk kept this simple and apparently stupid single method browser, since 25 years. It was really a puzzle for me because my experience is that Smalltalk is a highly distilled environment. Nothing is there by coincidence and current Smalltalk are really designed the way they are because that’s the best design available.

And today, I realized what I missed.The important part is not the code: it is the upper part with classes, protocols and methods. Programming with Smalltalk is actually creating meaningful classes names, meaningful methods names and organize them into self explicatory protocols. Jeez, those guys understood every thing 30 years ago!!

When you program with Smalltalk, don’t thing first about writing code, think first about designing methods and protocols. The language syntax by itself is not important here, what is important is the name of your methods. That’s why Smalltalk has so little basic syntax and such a huge library: object programming is producing meaningful classes and methods names.

I probably read it in some books but this is such a paradigm shift compared to other languages that I did not understand it… until today.

Social Bookmarking
Add to: Mr. Wong Add to: Webnews Add to: Icio Add to: Oneview Add to: Folkd Add to: Yigg Add to: Linkarena Add to: Digg Add to: Del.icio.us Add to: Reddit Add to: Simpy Add to: StumbleUpon Add to: Slashdot Add to: Netscape Add to: Furl Add to: Yahoo Add to: Spurl Add to: Google Add to: Blinklist Add to: Blogmarks Add to: Diigo Add to: Technorati Add to: Newsvine Add to: Blinkbits Add to: Ma.Gnolia Add to: Smarking Add to: Netvouz Information

Commentaires



4 commentaires to “Object orientation enlightenment”

  1. John Dougan on septembre 18th, 2005 10:05

    A suggestion, try loading the Whisker code browser (http://www.mindspring.com/~dway/smalltalk/whisker.html) into Squeak. While preserving all the positive features of the standard Smalltalk browsers, I find it to be superior in that it uses screen space more efficently and gives an effect similar too and better than the classic C/Java/etc. browsers you mention.

  2. Anonyme on septembre 18th, 2005 10:51

    Thank you John for reminding us the wonderfull Whisker editor. Actually, it is probably the best code editor I have seen and I think that other language editors (Java, C#…) should get inspiration of its GUI for their future releases.

    To be honest, Whisker was the only editor I used on Squeak, but now, as I shifted a little bit my perspective on code, I might also use the standard browser ;-)

  3. giorgio on septembre 18th, 2005 12:27

    I completely agree, but I would add some more: I feel more confortable if I have just the space for reading/writing one method. I’m not disturbed by the code on the others, and I don’t care /should not care about the other methods. The only things I should care of are Class names, method names,what you want names, not inplementation.

  4. Arenvam on avril 22nd, 2006 1:43

    Thank you John for reminding us the wonderfull Whisker editor. Actually, it is probably the best code editor I have seen and I think that other language editors (Java, C#…) should get inspiration of its GUI for their future releases.
    +1

Laisser un commentaire