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).

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.

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 BookmarkingCommentaires
4 commentaires to “Object orientation enlightenment”
Laisser un commentaire

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.
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
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.
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