For Programmers: Free Programming Magazines  


Home > Archive > Smalltalk > January 2005 > Is it a bug or just bad design?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Is it a bug or just bad design?
Kim Lokøy

2005-01-12, 8:58 am

In the webService framework the Struct class is a subclass of
Dictionary. Struct implement «doesNotUnderstand: aMessage» to check if
it has a entry keyed on aMessage selector. So the code:

struct min

is the same as:

struct at: min

The problem is that I have implemented min on Collection, so this method
is invoked when it is the element at min that is expected. Generally
you have a problem if you put something into a struct keyed on a string
that is equal to a method name in struct or one of its superclasses.

Obviously it is bad design when a method implementation depends on
superclass method names. But is it a bug, and will it be fixed?

Thanks
Ian Upright

2005-01-13, 3:58 am

Kim Lokøy <"kim[noShit]"@lokoy.com> wrote:

>In the webService framework the Struct class is a subclass of
>Dictionary. Struct implement «doesNotUnderstand: aMessage» to check if
>it has a entry keyed on aMessage selector. So the code:
>
> struct min
>
>is the same as:
>
> struct at: min
>
>The problem is that I have implemented min on Collection, so this method
>is invoked when it is the element at min that is expected. Generally
>you have a problem if you put something into a struct keyed on a string
>that is equal to a method name in struct or one of its superclasses.
>
>Obviously it is bad design when a method implementation depends on
>superclass method names. But is it a bug, and will it be fixed?
>
>Thanks


I'd vote for bad design. :-)

Ian

---
http://www.upright.net/ian/
Martin Kobetic

2005-01-18, 3:59 am

Another popular selector that gets in the way all the time is #value.
Anyway, the Struct will become a real proxy soon. We'll most likely
reconcile the few "Structs" that popped up in various parts into one as
well, hopefully in time for VW 7.4.

Kim Lokøy wrote:

> In the webService framework the Struct class is a subclass of
> Dictionary. Struct implement «doesNotUnderstand: aMessage» to check if
> it has a entry keyed on aMessage selector. So the code:
>
> struct min
>
> is the same as:
>
> struct at: min
>
> The problem is that I have implemented min on Collection, so this method
> is invoked when it is the element at min that is expected. Generally
> you have a problem if you put something into a struct keyed on a string
> that is equal to a method name in struct or one of its superclasses.
>
> Obviously it is bad design when a method implementation depends on
> superclass method names. But is it a bug, and will it be fixed?
>
> Thanks



--
Martin Kobetic, Cincom Smalltalk Development,
http://www.cincom.com/smalltalk
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com