Development Tool

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

Development Tool

mrgonza78
Does anyone know what tool I can use to find all the duplicated code
in a class hierarchy? Lint? what rule?
Thanks in advance
Alejandro

Reply | Threaded
Open this post in threaded view
|

Re: Development Tool

Damien Cassou-3
It depends what you really means by duplication. If you mean the
bytecode are equals, you can use dynamic protocols for that (included
in all squeak-dev images). I can help you about that if you need to.

2007/11/8, Alejandro Gonzalez <[hidden email]>:
> Does anyone know what tool I can use to find all the duplicated code
> in a class hierarchy? Lint? what rule?
> Thanks in advance
> Alejandro
>
>


--
Damien Cassou

Reply | Threaded
Open this post in threaded view
|

Re: Development Tool

mrgonza78
By duplication I meant:
  aParseTree equalTo: anotherParseTree exceptForVariables: #()
I don't know if this implies the same byte code on both methods, does it?

And about dynamic protocols...it shows me the duplicated methods
between a class and its super classes. What I'm looking for is
something that tells me what are the duplicated methods in a
collection of classes not necessarily related by hierarchy.


On Nov 8, 2007 11:44 AM, Damien Cassou <[hidden email]> wrote:

> It depends what you really means by duplication. If you mean the
> bytecode are equals, you can use dynamic protocols for that (included
> in all squeak-dev images). I can help you about that if you need to.
>
> 2007/11/8, Alejandro Gonzalez <[hidden email]>:
>
> > Does anyone know what tool I can use to find all the duplicated code
> > in a class hierarchy? Lint? what rule?
> > Thanks in advance
> > Alejandro
> >
> >
>
>
> --
> Damien Cassou
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Development Tool

Karl-19
Alejandro Gonzalez wrote:
> By duplication I meant:
>   aParseTree equalTo: anotherParseTree exceptForVariables: #()
> I don't know if this implies the same byte code on both methods, does it?
>
> And about dynamic protocols...it shows me the duplicated methods
> between a class and its super classes. What I'm looking for is
> something that tells me what are the duplicated methods in a
> collection of classes not necessarily related by hierarchy.
>  
MethodFinder and MessageNames show all methods with equal names.
MethodFinder will also show results based on a pattern separated by full
stop:    1. 3. 4

Karl

>
> On Nov 8, 2007 11:44 AM, Damien Cassou <[hidden email]> wrote:
>  
>> It depends what you really means by duplication. If you mean the
>> bytecode are equals, you can use dynamic protocols for that (included
>> in all squeak-dev images). I can help you about that if you need to.
>>
>> 2007/11/8, Alejandro Gonzalez <[hidden email]>:
>>
>>    
>>> Does anyone know what tool I can use to find all the duplicated code
>>> in a class hierarchy? Lint? what rule?
>>> Thanks in advance
>>> Alejandro
>>>
>>>
>>>      
>> --
>> Damien Cassou
>>
>>
>>    
>
>
>  


Reply | Threaded
Open this post in threaded view
|

Re: Development Tool

Damien Cassou-3
In reply to this post by mrgonza78
2007/11/8, Alejandro Gonzalez <[hidden email]>:
> By duplication I meant:
>   aParseTree equalTo: anotherParseTree exceptForVariables: #()
> I don't know if this implies the same byte code on both methods, does it?
>
> And about dynamic protocols...it shows me the duplicated methods
> between a class and its super classes. What I'm looking for is
> something that tells me what are the duplicated methods in a
> collection of classes not necessarily related by hierarchy.

I don't know about any tool about that but you can code it if you
want. Something like:

(yourClasses
     inject: Bag new
     into: [:bag :class | bag
                                  addAll: class methodDict values;
                                   yourself])
       valuesAndCounts

This gives you a dictionnary with compiled methods as keys and the
number of duplication of each method as values.

--
Damien Cassou