[squeak-dev] Re: Object>>#is:?
keith_hodges at yahoo.co.uk
Fri Mar 5 13:32:54 UTC 2010
>> I got it; see my answer to Juan. I guess I'm just programming in
>> bad style: I do indeed consider that Object is part of my packages
>> (or, more accurately, that Object is not a forbidden place for my
>> package to go in).
> Hear hear. I've been wondering why people are so enthusiastic about
> #is: - good to see I'm not the only one.
> I think #isA: is fine, as an easy way to do #isKindOf: without a
> direct class reference. Being able to avoid class references makes
> it easier to avoid dependencies, which makes it easier to have a
> modular system.
> Juan's implementation of #is: puzzles me though. It replaces
> polymorphic dispatch with boolean logic. Good OO design generally
> goes in the opposite direction.
> Furthermore, Juan's version of #is: makes it more difficult to
> modularize the system. If I write a package that needs to add the
> concept of "greenness" to the system, I can add #isGreen extension
> methods wherever I want, without breaking any existing code.
> Somebody else can add #isPurple methods without breaking my code.
> But if we both need to override #is:, we have a gratuitous
> Note that #is: may work well in Cuis, but that's because Cuis is
> *not* a modular system.
> Finally, I also want to point out that "simpler" and "fewer methods"
> are not the same thing. Methods that answer booleans are dead simple
> to understand, no matter how many of them there are. A single #is:
> method increases incomplexity as the number of tests it encompasses
> So, consider this moral support for Stéphane, since he seems to be
> beset on all sides. Also,
> +0 for #isA:
> -1 for #is:
the askFor: version does support modularity. Users can askFor:
#isGreen. Suppliers can implement #isGreen, and you get your tagging
Smalltalk askFor: #isSqueak
More information about the Squeak-dev