Thursday, April 07, 2005

Use The Ummmmm Thesaurus, Luke

I was working on a little Ruby project tonight. Basically, it's a simple upcoming calendar for just me. Nothing special. So, I started with an Event object and it is responsible for representing a calendar entry. Now, it needed to know when it was to happen and some descriptions. So, I gave it 3 instance variables: when, title, and description. The next question was how was I going to represent when. I knew it needed to display itself and compare itself to other whens (for sorting). I initially thought of the name, DateRange, since it is responsible for holding a range of dates. But, I didn't like the name because I wanted to represent the concept of future dates and a single date. DateRange just didn't feel right because it seemed too specific. So, what do I do when I don't like a name for an object? I go to my trusty thesaurus for the answer! Within seconds, I had a page full of words and one jumped right at me: "MOMENT"! EUREKA! Moment was the perfect name for this new object. It conveys the meaning of its responsibilities exactly. This way I could have FutureMoments, DatedMoments, and even UndefinedMoments. I use a thesaurus a lot in my development lately and it's an idea that I got from "Thinking Forth". It's a simple and brilliant idea. It starts getting you to think about concise words to name the objects of your model more precisely. Anything that makes meaning clear and succinct is always good in my book!

4 comments:

Anonymous said...

That is a great idea!

It would be neat if squeak had a short-cut key that would take the selected word on screen and look it up in an online thesaurus.

Andrés said...

Event sounds better, IMHO. And besides, I would find something like

aCalendar when: aTimestamp describe: aTitle as: aDescription

nearly irresistible.

Andres.

Blaine Buxton said...

Funny you should mention that because I started out with CalenderEntry but later renamed it Event shortly after changing DateRange to Moment. Great minds think alike...=)

Blaine Buxton said...

Sam,
One of my weekend projects is to add the thesaurus to squeak. We already have a dictionary lookup. I was thinking of adding it to OmniBrowser. I also wanted to add it make an Eclipse plug-in for it as well, since I still work in that environment quite a bit for java and ruby.