Experience Report: I Was a Smalltalk Gunslinger
by Kevin Johnson
kmj@acm.org

For most of the ‘90s I supported myself by writing Smalltalk as a freelance consultant based out of the Object Lab at the University of St. Thomas in Saint Paul.  I worked just enough to pay the rent and keep myself supplied with beer and pizza. The rest of the time I spent pursuing the dream of building the next great design and development tool.  Needless to say I never got rich, but I did learn a few things.

The Demo
Panic in corporate development land.  The prototype of the thin client, web enabled customer service application is scheduled to be presented to upper management in a week and it still takes several minutes to get a query back.  Call in the gunslinger.

I was a little hesitant about accepting this gig because I wasn't sure I could help.  The Smalltalk dialect was unfamiliar to me and the problem domain (screen scraping mainframe terminal data and shipping it to a web browser) was alien.  But I needed the money and I figured that if they  were desperate enough to yell for help, I was probably better than nothing.

I spent half of the first day getting an overview of what they were trying to accomplish.  Then I dived into the code with the help of one of the locals.  We poked around with the browsers  and debugger and I soon started to get a very sketchy idea of how things were hooked up. By the end of the day we hadn't found much, but we had eliminated a lot of places where the problem wasn't.  I was optimistic and boasted to a friend that wed have the problem isolated by noon the next day not really expecting to succeed.

We didn't make the noon deadline, but we did have it an hour later.  It turned out that deep in the bowels of the vendors EHLLAPI framework the default behavior was to create a new connection every time an application made a request.  What if we cached the connection so it could be used again?  We made the change there in the debugger and proceeded.  Additional testing confirmed that performance went from nasty to acceptable and that there were no obvious harmful side effects.

Lesson:  The method of least knowledge.  I never did learn much about the system under development and I still know zip about screen scraping mainframe terminal data, but I was able to use the available tools like the debugger to drill into the code where it was possible to see a potential problem.  In fact I think that if we had focused more directly on solving the problem from the start rather than on my understanding the system as a whole we might have fixed it the first day.

CAMS
The Classroom And Meeting Scheduler (CAMS) started out as a masters project at the University of St. Thomas.  The person who had been doing classroom scheduling for 30 years (Frankie) was about to retire and the director of the Object Lab (Dave West) managed to convince the facilities department that he and a group of his students could build a software system to, if not replace her, at least smooth the transition.  At the time the project was under initial development I was working on something else and so I came to the project after it had been in production for a year or so.  All of the original developers had received their degrees and moved on.  What design documentation I could find was largely out of date since the software had been finished after the motivation to produce documentation had been completed.

The initial work involved making minor repairs as needed to keep things working along with a lot of input data massaging and hand holding.  We started by getting an overview of the system from Dave and later from one of the original developers.  We made small changes, initially in the user interface, and avoided touching code we didn't need to.  Performance was lousy which made testing difficult.  This work was done under the pressure of a hard deadline (the class schedule had to go to the printer) and we were not confident enough to make changes that might break the system.

After struggling this way through a couple of releases at the end of each semester I decided it was time to try and solve the worst problem which was performance.  I replaced the ODBC interface to a relational database with a simple binary file persistence mechanism.  Performance was vastly improved, testing became easier, and we were able to move forward to add new features.  The program is still being used to this day several years later.

Lesson: Courage is essential.  The performance problems not only made it hard to use the system, but also made it hard to improve the system.  Fixing them early, while seemingly risky,  would have made the rest of the job easier.

Lesson: Worst things first.  The incremental user interface improvements made in the first couple of releases were swamped by the overwhelming performance problems and resulted in little real improvement of the user experience.


Position Statement: A Deliberate Approach

Short term strategies (hours to days)  
 Medium term strategies (days to weeks)

Longer term strategies (weeks to months)


Tools I Use
In Smalltalk the tools that I use most of all are the senders, implementers, and references browsers.  I use these tools to extract the static relationships between the objects.  I record these class names and relationships using a text editor and a simple drawing tool.

Sometimes the static relationships are hard or impossible to infer using code browsers and so I use the inspector or visual inspector.  The visual inspector makes it easy to keep track of the relationships between objects, but the one I have is fairly primitive and lacks several important features like printing.

The drawing tool that I use is the one that I wrote while I was at St. Thomas.  For me, it has the advantage that I understand how it works, not to mention the fact that I can fix it if it turns out to be broken.  Other tools would probably work just as well although I've never had the patience to learn a new one well enough to make it comfortable.

Occasionally I use a code formatter to make the code a little more readable, and I would probably use it more if I had a formatter that could be configured more completely.

The refactoring browser is indispensable for doing refactoring with confidence.  I never, ever want to go back to grep and a text editor!

Sometimes I've used SmallLint or other code quality tools to point out places that need work.

I use SUnit to write tests.  It works fine for what I do.

Tools I wish I had
A more complete visual inspector would be useful and it would be fun to integrate it with a drawing tool.  What I would like in a drawing tool is something in between a generic drawing tool like Visio and a full blown CASE tool like Rational Rose.

An automated reverse engineering tool would also be useful.  I don't want a tool to do “round trip engineering”.  In my opinion, if you extract enough detail to generate code, you might as well look at the code.  I want something that will help me draw the kind of medium detail diagrams that I currently do by hand.
 
</x-html>