[vwnc] Another violation of least astonishment rule.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] Another violation of least astonishment rule.

Terry Raymond
Filename class>>isBadCharacter:

The filename class is implemented as an abstract class with
a concrete subclass for each platform. Usually, you issue
a request to Filename which then delegates to the appropriate
concrete class, for example, look at Filename class>>components:.
The first thing it does is;

        self == self concreteClass ifFalse: [^self concreteClass components:
nameString].

But, contrast this with #isBadCharacter:. It does not delegate
to the approriate concrete class and futhermore it is
implemented differently in some of the concrete classes.

Argh!!

Terry
 
===========================================================
Terry Raymond
Crafted Smalltalk
80 Lazywood Ln.
Tiverton, RI  02878
(401) 624-4517      [hidden email]
<http://www.craftedsmalltalk.com>
===========================================================

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Another violation of least astonishment rule.

Travis Griggs-3
On May 27, 2008, at 1:50 PM, Terry Raymond wrote:

> Filename class>>isBadCharacter:
>
> The filename class is implemented as an abstract class with
> a concrete subclass for each platform. Usually, you issue
> a request to Filename which then delegates to the appropriate
> concrete class, for example, look at Filename class>>components:.
> The first thing it does is;
>
> self == self concreteClass ifFalse: [^self concreteClass components:
> nameString].
>
> But, contrast this with #isBadCharacter:. It does not delegate
> to the approriate concrete class and futhermore it is
> implemented differently in some of the concrete classes.


OK... so why were you astonished? What didn't work as you hoped? Just  
want to get the at the real issue, not the symptoms so I can write the  
appropriate AR if need be (see the sig).

And a tease aside... the recent intonation of Least Astonishment was  
listed as a "Principle". Now it's turned into a "Rule". I argue that  
it's neither, but more of a guideline with nebulous at best metrics on  
how to determine its application.

The LAG (Least Astonishment Guideline) is amoral as well, I realized  
two nights ago. How does one rationalize it with "I expected we'd have  
all kinds of problems when we changed X, but it just worked! I was  
astonished!" :)

--
Travis Griggs
Objologist
"There are a thousand hacking at the branches of evil to one who is  
striking at the root" - Henry David Thoreau


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Another violation of least astonishment rule.

Nicolas Cellier-3
Travis Griggs a écrit :

>
>
> OK... so why were you astonished? What didn't work as you hoped? Just  
> want to get the at the real issue, not the symptoms so I can write the  
> appropriate AR if need be (see the sig).
>
> And a tease aside... the recent intonation of Least Astonishment was  
> listed as a "Principle". Now it's turned into a "Rule". I argue that  
> it's neither, but more of a guideline with nebulous at best metrics on  
> how to determine its application.
>

Very right, the spirit of this principle is precisely that we have less
rules to learn :).

> The LAG (Least Astonishment Guideline) is amoral as well, I realized  
> two nights ago. How does one rationalize it with "I expected we'd have  
> all kinds of problems when we changed X, but it just worked! I was  
> astonished!" :)
>

Applying least astonishing guidelines does not make smalltalk the least
astonishing language, right?

> --
> Travis Griggs
> Objologist
> "There are a thousand hacking at the branches of evil to one who is  
> striking at the root" - Henry David Thoreau

Nicolas

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Another violation of least astonishment rule.

Terry Raymond
In reply to this post by Travis Griggs-3
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf
> Of Travis Griggs
> Sent: Tuesday, May 27, 2008 5:19 PM
> To: VWNC NC
> Subject: Re: [vwnc] Another violation of least astonishment rule.
>
> On May 27, 2008, at 1:50 PM, Terry Raymond wrote:
>
> > Filename class>>isBadCharacter:
> >
> > The filename class is implemented as an abstract class with
> > a concrete subclass for each platform. Usually, you issue
> > a request to Filename which then delegates to the appropriate
> > concrete class, for example, look at Filename class>>components:.
> > The first thing it does is;
> >
> > self == self concreteClass ifFalse: [^self concreteClass components:
> > nameString].
> >
> > But, contrast this with #isBadCharacter:. It does not delegate
> > to the approriate concrete class and futhermore it is
> > implemented differently in some of the concrete classes.
>
>
> OK... so why were you astonished? What didn't work as you hoped? Just
> want to get the at the real issue, not the symptoms so I can write the
> appropriate AR if need be (see the sig).

With Filename and its subclasses the pattern is to direct requests to
Filename not a subclass, furthermore you should not have to write

(Filename concreteClass isBadCharacter: char)

There are other Filename parsing and utility methods that have this same
problem.

> And a tease aside... the recent intonation of Least Astonishment was
> listed as a "Principle". Now it's turned into a "Rule". I argue that
> it's neither, but more of a guideline with nebulous at best metrics on
> how to determine its application.

You are right, it is a "Principle", I just could not think of the word.

> The LAG (Least Astonishment Guideline) is amoral as well, I realized
> two nights ago. How does one rationalize it with "I expected we'd have
> all kinds of problems when we changed X, but it just worked! I was
> astonished!" :)
>
> --
> Travis Griggs
> Objologist
> "There are a thousand hacking at the branches of evil to one who is
> striking at the root" - Henry David Thoreau
>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

Terry
 
===========================================================
Terry Raymond
Crafted Smalltalk
80 Lazywood Ln.
Tiverton, RI  02878
(401) 624-4517      [hidden email]
<http://www.craftedsmalltalk.com>
===========================================================

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc