[squeak-dev] Re: Gofer versus Installer

Andreas Raab andreas.raab at gmx.de
Fri Dec 17 01:07:37 UTC 2010


On 12/16/2010 2:10 PM, Igor Stasenko wrote:
> 2010/12/16 Janko Mivšek<janko.mivsek at eranova.si>:
>> Guys, for Thursday funny: "It is really goofy that some people do not
>> understand the price-value relationship of classes in object-oriented
>> systems." http://twitter.com/#!/renggli
>>
>> Well, I couldn't resist :)
>
> Me too.. me too.
> It would be good to hear arguments from other side here.

Indeed. From my perspective there are some pretty straightforward rules 
for when creating additional classes is a good idea.

For example, I am a big fan of Announcements, since they make the set of 
events that are part of an application explicit. Even though one can 
just use names (i.e., self signalEvent: #foo) having each event be a 
separate class is beneficial because a user who doesn't know what events 
exist, can find those, can find out where they are signaled, and how 
they are used.

Or Exceptions. Another good use for having additional classes. Both for 
purposes of documentation (what exceptions exist) as well as for 
extending them. For example, I can add a subclass of ConnectionError in 
my application and generic handlers for ConnectionError in third party 
code will be able to catch the error correctly.

Or the command pattern itself, which is extremely useful in many 
situations, like when you need to reason about bulk sets of method 
invocations (in undo for example).

So there are indeed various reasons for when adding additional classes 
can be very, very beneficial. But let's not forget that there's a cost 
associated with it as well. If it were different, if there was really no 
cost associated with having a class, how about we make all of the 2000 
Morph methods into commands? If there is no cost to it, then it must be 
beneficial, right?

So yes, I understand that there's a cost-benefit ratio for adding 
additional classes. But if there's a good reason for these classes in 
Gofer, then I just don't see it. None of the rules for when additional 
classes are a good idea seem to apply. In which case Occam's razor wins.

Now if I only could make that argument in 140 characters... but then no 
sensible argument has ever been made on Twitter and none ever will, so 
who cares.

Cheers,
   - Andreas



More information about the Squeak-dev mailing list