Code critics - Overrides super method without calling it

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

Code critics - Overrides super method without calling it

Stan Shepherd
Hi, I get the possible bug 'Overrides super method without calling it' for things like:

Strand>>size
        ^ genes size

I can't find an explanation of this, in case there is some nasty that I'm not aware of. It is not listed at:

http://st-www.cs.uiuc.edu/users/brant/Refactory/LintChecks.html

Is there a more complete list of code critics messages?

Are there cases other than 'Overrides a "special" message' to look out for?

Thanks,   ...Stan
Reply | Threaded
Open this post in threaded view
|

Re: Code critics - Overrides super method without calling it

Matthias Berth-2
Hi,

The idea is that you should _maybe_ give the superclasses of Strand a
chance to execute their method.
In some situations this is really necessary, or just a good way to
avoid code duplication.

HTH

Matthias

On Sat, Jul 19, 2008 at 5:47 PM, stan shepherd <[hidden email]> wrote:

>
> Hi, I get the possible bug 'Overrides super method without calling it' for
> things like:
>
> Strand>>size
>        ^ genes size
>
> I can't find an explanation of this, in case there is some nasty that I'm
> not aware of. It is not listed at:
>
> http://st-www.cs.uiuc.edu/users/brant/Refactory/LintChecks.html
>
> Is there a more complete list of code critics messages?
>
> Are there cases other than 'Overrides a "special" message' to look out for?
>
> Thanks,   ...Stan
> --
> View this message in context: http://www.nabble.com/Code-critics---Overrides-super-method-without-calling-it-tp18545882p18545882.html
> Sent from the Squeak - Beginners mailing list archive at Nabble.com.
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Code critics - Overrides super method without calling it

Stan Shepherd

Matthias Berth-2 wrote
Hi,

The idea is that you should _maybe_ give the superclasses of Strand a
chance to execute their method.
In some situations this is really necessary, or just a good way to
avoid code duplication.

HTH

Matthias

On Sat, Jul 19, 2008 at 5:47 PM, stan shepherd <squeak414@free.fr> wrote:
>
> Hi, I get the possible bug 'Overrides super method without calling it' for
> things like:
>
> Strand>>size
>        ^ genes size
>
> I can't find an explanation of this, in case there is some nasty that I'm
> not aware of. It is not listed at:
>
> http://st-www.cs.uiuc.edu/users/brant/Refactory/LintChecks.html
>
> Is there a more complete list of code critics messages?
>
> Are there cases other than 'Overrides a "special" message' to look out for?
>
> Thanks,   ...Stan
> --
> View this message in context: http://www.nabble.com/Code-critics---Overrides-super-method-without-calling-it-tp18545882p18545882.html
> Sent from the Squeak - Beginners mailing list archive at Nabble.com.
>
> _______________________________________________
> Beginners mailing list
> Beginners@lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Thanks Matthias.

I just worked out that to allow Strand to call super size, it needs to implement

isVariable
    ^ true

This doesn't do anything useful, but it does get code critics off my back (until I implement Lukas's revised code critics package).

I was concerned that there might be less obvious repercussions, such as the one at:
http://st-www.cs.uiuc.edu/users/brant/Refactory/LintChecks.html

"Has class instance variable but no initialize method

Checks that all classes that have class instance variables also have an initialize method. This makes sure that all class instance variables are initialized properly when the class is filed-into a new image. "

I hadn't thought about the file in implications; similarly I didn't know if there were any unseen nasties in the 'Overrides super method without calling it' case.

...Stan