super super

Stephan Rudlof sr at evolgo.de
Thu Feb 17 22:42:33 UTC 2000


Andrew,

agree at carltonfields.com wrote:
> 
> > Well, sure....  Refactoring is easy when you've got the time > and the freedom
> > to do so (not to mention a simple class hierarchy).
> 
> *snip*
>  > When you are given a bug to fix, sometimes > it is not
> > appropriate to refactor your class hierarchy.  In fact, it is > often the case
> > that the directive is:  Just do a quick fix -- we'll > re-architect the system
> > in the next release.
> 
> You certainly don't need to mess with the language to accomplish a hack, particularly when you have conciously decided to do a hack!  In you example:
> 
> >        A>>foo
> >          |
> >        B>>foo
> >          |
> >        C>>foo  ??
> 
> All you have to do is code
> 
>         B>>classAFoo
>                 "Hack to obtain access to A>>foo from subclasses"
>                 ^super foo
> 
>         and then code

> 
>         A>>foo
>                 . . .
>                 super classAFoo.
>                 . . .

I think you mean C>>foo here.

> 
> which has the virtue of making it clear to the world that it is a hack.  (Of course, there are many other ways to obtain the same result, each introducing some subtle and not-so-subtle fragility to the class structure)The alternative
> 

>         A>>foo
>                 . . .
>                 super super foo.
>                 . . .
> 

Also it should be C>>foo; but in spite of this
	super super foo.
does not work in a test class hierarchy of mine, try it!


Stephan

> might go entirely without notice until someone DOES have time to do a refactoring and inserts some classes inbetween A, B and C.  All of a sudden, you aren't getting the intended result and you have some subtle bugs to hunt down.
> 
> Indeed, Squeak's printOut function had a subtle bug deriving from such a fragility that precluded it from generating proper HTML.  I doubt I would ever have found the bug if the "super super" means were used instead.

-- 
Stephan Rudlof (sr at evolgo.de)
   "Genius doesn't work on an assembly line basis.
    You can't simply say, 'Today I will be brilliant.'"
    -- Kirk, "The Ultimate Computer", stardate 4731.3





More information about the Squeak-dev mailing list