Howto find all subclass responsibilities for a given Class

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

Howto find all subclass responsibilities for a given Class

Felix Dorner

Hi,

I am playing around with Morphs to create a Board for the ancient Go
game. Given that I'd like to create a completely new kind of Morph
(i.e. a Class that extends Morph), I'd like to find out which methods
in the Morph class are defined as subclass responsibilities. Is there
any fast way to do such a kind of search?

Thanks,
Felix

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Howto find all subclass responsibilities for a given Class

cerebus-4
Browse senders of #subclassResponsibility, and look for objects in
your hierarchy.  You can use a Method Finder to do this.

Looking myself, I see only 340 or so senders.  Which is what I'd
expect; there aren't a whole lot of abstract classes in the image;
most are real.

-- C

On Sat, Aug 16, 2008 at 5:25 PM, Felix Dorner <[hidden email]> wrote:

>
> Hi,
>
> I am playing around with Morphs to create a Board for the ancient Go
> game. Given that I'd like to create a completely new kind of Morph
> (i.e. a Class that extends Morph), I'd like to find out which methods
> in the Morph class are defined as subclass responsibilities. Is there
> any fast way to do such a kind of search?
>
> Thanks,
> Felix
>
> _______________________________________________
> 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: Howto find all subclass responsibilities for a given Class

Zulq Alam-2
In reply to this post by Felix Dorner
Hi Felix,

A method may be required explicitly:

   requiredMethod
     self subclassResponsibility

or implicity:

   method
     self requiredMethod

where #requiredMethod has not been implemented.

You can see all of these by sending your class #requiredSelectors, for
example:

   MyMorph requiredSelectors asArray
   "prints: #(#addWorldHaloMenuItemsTo:hand: #slotName etc..."

Or alternativlely, if you are using the OmniBrowser you can install
DynamicProtocols which will add a "-- required --" protocol dynamically
when you are browsing.

The required dynamic protocol will include all the methods returned by
#requiredSelectors. If you select one of these methods you will be shown
a simple template for implementing the method.

Regards,
Zulq.

Felix Dorner wrote:

> Hi,
>
> I am playing around with Morphs to create a Board for the ancient Go
> game. Given that I'd like to create a completely new kind of Morph
> (i.e. a Class that extends Morph), I'd like to find out which methods
> in the Morph class are defined as subclass responsibilities. Is there
> any fast way to do such a kind of search?
>
> Thanks,
> Felix

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Howto find all subclass responsibilities for a given Class

Yoshiki Ohshima-2
In reply to this post by Felix Dorner
> I am playing around with Morphs to create a Board for the ancient Go
> game. Given that I'd like to create a completely new kind of Morph
> (i.e. a Class that extends Morph), I'd like to find out which methods
> in the Morph class are defined as subclass responsibilities. Is there
> any fast way to do such a kind of search?

  You can happily evaluate the following:

  Morph new openInHand

and the instance of Morph is fully operational in the system.  This
means that you don't have to treat it as an
abstract class; it is a concrete class from which you can make your
own subclasses.

  For a search, you can do:

(SystemNavigation default allCallsOn: #subclassResponsibility)
        select: [:ref | ref classSymbol = #Morph]

and you don't get any, I believe.

-- Yoshiki
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners