Anreas K. gave some good references if you want to learn more. But should you?
So - A (short?) blurb about the RB, Smalllint and Rewrite Rule editor (The RB tool family), for those not very familiar with it.
I think code can be beautiful. And like a statue in a popular plaza, very public code (Squeak's code) very much should be.
I also think that artists/artisan deserve to have good, powerful tools. I say good as well as powerful, because tools can be powerful but push you in an ugly direction...
And programmers, specifically, can have an enormous range of quality for their tools. The standard Smalltalk tools make most others look like bent nails and hammers with over-long handles. Well, the RB tools are the next step up.
So, what do they do? The Refactoring Browser itself mirrors some of the wonderful big-picture query tools (senders/implementors) with big-picture modification tools - Rename Method will rename the method and adjust all the senders accordingly. When you're writing Smalltalk code you write small methods right? what if they get big? Extract Method means you can make them smaller painlessly - mark the code to extract, give the name for the new method, and voila.
This is the most accessible tool of the lot. You just use it like a regular browser, except when you want to do something it supports (rename that temporary variable), it's much easier. Please try it for a month, it'll help make our public space look better.
Smalllint is based on a framework within the RB that does arbitrary parse-tree matching. It is a library of patterns for dubious code. For example, it will complain at a condition where the last statement is identical in both branches. You can easily turn it unto a bunch of classes, and it tries to find all those problems in it, giving you a detailed report. It's a great way to start cleaning up a module, which is a great way to get to know something and help make it better. So just run Smalllint on some piece of code, make it better, and send in the enhancement. Reading other people bad code is a great way to learn what not to do.
Some people I met at ESUG have done extensions that make Smalllint also usable as a long-term quality management tool. I'll try to get those mods to port them to Squeak. More on that another time.
The Rewrite Rule Editor is a powerful and mysterious artefact. I'll start by saying we currently don't seem to have Squeak UI for it. Also the UIs for other platforms are not satisfactory - I didn't quite understand the tool until I read the code for it! So what is it? well, where Lint can be used to detect predefined baddies, this tool allow you to create rules that actually rewrite code. When you suddenly discover that there's a much better way of doing something (than what we've all been coding for years), or that you could get lots of information if you could only instrument 300 methods just this way... this tool is what you need.
Again, some people at CampSmalltalk had started rethinking the UI to make this tool more approachable and useful. If anyone is interested in collaborating with them and getting us a Squeak version in the process, I'll give you their contact info.
BTW, if you care about your tools, there're lots more fascinating projects out there being done in the Smalltalk community that we could benefit from having handy. A couple that were shown in ESUG - * QSOUL (Squeak based, but not done) and * CodeCrawler (VW based, but might be portable. Also, it can read code from Squeak, so we could use it, if not in the preferred reflective style).
</sales pitch (it's a dirty job, but somebody's got to do it...;-)>
Daniel Vainsencher
"Andreas Kuckartz" a.kuckartz@dokom.net wrote:
Bob Hartwig's site includes a UI for the Lint tool (find bugs, code smells, and oddities automatically) which is uses the RB model. We haven't tested or modified it.
That is http://www.bobjectsinc.com/squeakrbalpha/download/LintUI.9.cs.gz
Decompress and file it in after the RB-files and execute "LintDialog open". Then select items in the different panes and hit the "RUN" button. Only select a few classes until you have a feeling for the expected execution time or at least schedule a coffee-break ... Click on an item in the resulting report and a RB opens.
First impression: it seems to work fine. (The RBs for "Variables not referenced" do not show the names of the variables.)
Further information about Smalllint is avalable here: http://st-www.cs.uiuc.edu/users/brant/Refactory/Lint.html
and the rules are explained there: http://st-www.cs.uiuc.edu/users/brant/Refactory/LintChecks.html
Andreas
squeak-dev@lists.squeakfoundation.org