Uniformizing Pharo

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

Uniformizing Pharo

Stéphane Ducasse
Hi guys

I started to be fed up about protocol inconsistencies. So I will propose a set of rules (and a tool - I'm working on it) to automatically categorize methods.
The first on the list was printOn: in printing and I clean many methods already with a kind of happy smile on my face.

Now we discussed today with esteban for initialize* we will use 'initialization'
I hope that this is ok for you because I'm fed up to have the following:

        {269->'initialization'. 248->'initialize-release'. 48->'as yet unclassified'. 15->'accessing'. 14->'private'. 12->'initializing'. 2->'instance creation'. 2->'testing'. 2->'initalize-release'. 2->'protocol'. 2->'display'. 1->'cleaning'. 1->'intializing'. 1->'like fullCopy'. 1->'keymapping'. 1->'ui-building'. 1->'initialize - release'. 1->'initialization-release'. 1->'intialize'. 1->'styling'. 1->'scrolling'. 1->'morphic ui'. 1->'world state'. 1->#'parts bin'}

Please enjoy this gift from life, I love so much 'like fullCopy' as a category for initialize that I'm a bit sad to
clean this kind of poem (minimal haiku) so we will keep it for us :)

Yes there is no little steps to get a bright system, every little clean is stop.

No broken window! No dirt on the floor in Pharo.

Stef
Reply | Threaded
Open this post in threaded view
|

Re: Uniformizing Pharo

Sebastian Tleye
I can add a rule for that, and check in the releaseTest if all the classes are respecting it (as i did checking repeated code)


2013/8/12 Stéphane Ducasse <[hidden email]>
Hi guys

I started to be fed up about protocol inconsistencies. So I will propose a set of rules (and a tool - I'm working on it) to automatically categorize methods.
The first on the list was printOn: in printing and I clean many methods already with a kind of happy smile on my face.

Now we discussed today with esteban for initialize* we will use 'initialization'
I hope that this is ok for you because I'm fed up to have the following:

        {269->'initialization'. 248->'initialize-release'. 48->'as yet unclassified'. 15->'accessing'. 14->'private'. 12->'initializing'. 2->'instance creation'. 2->'testing'. 2->'initalize-release'. 2->'protocol'. 2->'display'. 1->'cleaning'. 1->'intializing'. 1->'like fullCopy'. 1->'keymapping'. 1->'ui-building'. 1->'initialize - release'. 1->'initialization-release'. 1->'intialize'. 1->'styling'. 1->'scrolling'. 1->'morphic ui'. 1->'world state'. 1->#'parts bin'}

Please enjoy this gift from life, I love so much 'like fullCopy' as a category for initialize that I'm a bit sad to
clean this kind of poem (minimal haiku) so we will keep it for us :)

Yes there is no little steps to get a bright system, every little clean is stop.

No broken window! No dirt on the floor in Pharo.

Stef

Reply | Threaded
Open this post in threaded view
|

Re: Uniformizing Pharo

Camillo Bruni-3
In reply to this post by Stéphane Ducasse
yes please! :)

On 2013-08-12, at 17:08, Stéphane Ducasse <[hidden email]> wrote:

> Hi guys
>
> I started to be fed up about protocol inconsistencies. So I will propose a set of rules (and a tool - I'm working on it) to automatically categorize methods.
> The first on the list was printOn: in printing and I clean many methods already with a kind of happy smile on my face.
>
> Now we discussed today with esteban for initialize* we will use 'initialization'
> I hope that this is ok for you because I'm fed up to have the following:
>
> {269->'initialization'. 248->'initialize-release'. 48->'as yet unclassified'. 15->'accessing'. 14->'private'. 12->'initializing'. 2->'instance creation'. 2->'testing'. 2->'initalize-release'. 2->'protocol'. 2->'display'. 1->'cleaning'. 1->'intializing'. 1->'like fullCopy'. 1->'keymapping'. 1->'ui-building'. 1->'initialize - release'. 1->'initialization-release'. 1->'intialize'. 1->'styling'. 1->'scrolling'. 1->'morphic ui'. 1->'world state'. 1->#'parts bin'}
>
> Please enjoy this gift from life, I love so much 'like fullCopy' as a category for initialize that I'm a bit sad to
> clean this kind of poem (minimal haiku) so we will keep it for us :)
>
> Yes there is no little steps to get a bright system, every little clean is stop.
>
> No broken window! No dirt on the floor in Pharo.
>
> Stef


Reply | Threaded
Open this post in threaded view
|

Re: Uniformizing Pharo

Stéphane Ducasse
In reply to this post by Sebastian Tleye

On Aug 12, 2013, at 10:21 PM, Sebastian Tleye <[hidden email]> wrote:

I can add a rule for that, and check in the releaseTest if all the classes are respecting it (as i did checking repeated code)

We will do it together.
Now first I want to release the tool to autocategorize the methods when you edit a method.



2013/8/12 Stéphane Ducasse <[hidden email]>
Hi guys

I started to be fed up about protocol inconsistencies. So I will propose a set of rules (and a tool - I'm working on it) to automatically categorize methods.
The first on the list was printOn: in printing and I clean many methods already with a kind of happy smile on my face.

Now we discussed today with esteban for initialize* we will use 'initialization'
I hope that this is ok for you because I'm fed up to have the following:

        {269->'initialization'. 248->'initialize-release'. 48->'as yet unclassified'. 15->'accessing'. 14->'private'. 12->'initializing'. 2->'instance creation'. 2->'testing'. 2->'initalize-release'. 2->'protocol'. 2->'display'. 1->'cleaning'. 1->'intializing'. 1->'like fullCopy'. 1->'keymapping'. 1->'ui-building'. 1->'initialize - release'. 1->'initialization-release'. 1->'intialize'. 1->'styling'. 1->'scrolling'. 1->'morphic ui'. 1->'world state'. 1->#'parts bin'}

Please enjoy this gift from life, I love so much 'like fullCopy' as a category for initialize that I'm a bit sad to
clean this kind of poem (minimal haiku) so we will keep it for us :)

Yes there is no little steps to get a bright system, every little clean is stop.

No broken window! No dirt on the floor in Pharo.

Stef


Reply | Threaded
Open this post in threaded view
|

Re: Uniformizing Pharo

Sean P. DeNigris
Administrator
In reply to this post by Stéphane Ducasse
Stéphane Ducasse wrote
I started to be fed up about protocol inconsistencies
Amen

Stéphane Ducasse wrote
So I will propose a set of rules (and a tool - I'm working on it) to automatically categorize methods.
...
Now we discussed today with esteban for initialize* we will use 'initialization'
Yay!
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Uniformizing Pharo

Igor Stasenko
i wonder, if we can modify the compiler, so that when it sees that
method's selector has well known name, it categorizing method
automatically under right category :)
(dunno however, what to do about existing code, when you recompiling it)

On 14 August 2013 04:32, Sean P. DeNigris <[hidden email]> wrote:

> Stéphane Ducasse wrote
>> I started to be fed up about protocol inconsistencies
>
> Amen
>
>
> Stéphane Ducasse wrote
>> So I will propose a set of rules (and a tool - I'm working on it) to
>> automatically categorize methods.
>> ...
>> Now we discussed today with esteban for initialize* we will use
>> 'initialization'
>
> Yay!
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/Uniformizing-Pharo-tp4703357p4703577.html
> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>



--
Best regards,
Igor Stasenko.

Reply | Threaded
Open this post in threaded view
|

Re: Uniformizing Pharo

Clément Béra
2013/8/14 Igor Stasenko <[hidden email]>
i wonder, if we can modify the compiler, so that when it sees that
method's selector has well known name, it categorizing method
automatically under right category :)
(dunno however, what to do about existing code, when you recompiling it)

This is possible but I don't think it belongs to the compiler to do that. I would rather modify Behavior so when it adds a method with no protocol it categorize it efficiently according to its superclasses / subclasses selectors and protocols.. 
 

On 14 August 2013 04:32, Sean P. DeNigris <[hidden email]> wrote:
> Stéphane Ducasse wrote
>> I started to be fed up about protocol inconsistencies
>
> Amen
>
>
> Stéphane Ducasse wrote
>> So I will propose a set of rules (and a tool - I'm working on it) to
>> automatically categorize methods.
>> ...
>> Now we discussed today with esteban for initialize* we will use
>> 'initialization'
>
> Yay!
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/Uniformizing-Pharo-tp4703357p4703577.html
> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>



--
Best regards,
Igor Stasenko.


Reply | Threaded
Open this post in threaded view
|

Re: Uniformizing Pharo

Stéphane Ducasse
In reply to this post by Igor Stasenko

On Aug 14, 2013, at 4:38 AM, Igor Stasenko <[hidden email]> wrote:

> i wonder, if we can modify the compiler, so that when it sees that
> method's selector has well known name, it categorizing method
> automatically under right category :)
> (dunno however, what to do about existing code, when you recompiling it)

we will integrate the categorizer close to the code browser and may be later the compiler


>
> On 14 August 2013 04:32, Sean P. DeNigris <[hidden email]> wrote:
>> Stéphane Ducasse wrote
>>> I started to be fed up about protocol inconsistencies
>>
>> Amen
>>
>>
>> Stéphane Ducasse wrote
>>> So I will propose a set of rules (and a tool - I'm working on it) to
>>> automatically categorize methods.
>>> ...
>>> Now we discussed today with esteban for initialize* we will use
>>> 'initialization'
>>
>> Yay!
>>
>>
>>
>> -----
>> Cheers,
>> Sean
>> --
>> View this message in context: http://forum.world.st/Uniformizing-Pharo-tp4703357p4703577.html
>> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>>
>
>
>
> --
> Best regards,
> Igor Stasenko.
>


Reply | Threaded
Open this post in threaded view
|

Re: Uniformizing Pharo

Camillo Bruni-3
Did you use the method categorizer that is already in the image?

=> MethodClassifier

it implements already a lot of rules, so you should plug in your tool there or remove MethodClassifier and make it work with nautilus. otherwise we have a lot of duplicated functionality.

On 2013-08-14, at 02:44, Stéphane Ducasse <[hidden email]> wrote:

> On Aug 14, 2013, at 4:38 AM, Igor Stasenko <[hidden email]> wrote:
>
>> i wonder, if we can modify the compiler, so that when it sees that
>> method's selector has well known name, it categorizing method
>> automatically under right category :)
>> (dunno however, what to do about existing code, when you recompiling it)
>
> we will integrate the categorizer close to the code browser and may be later the compiler
>
>
>>
>> On 14 August 2013 04:32, Sean P. DeNigris <[hidden email]> wrote:
>>> Stéphane Ducasse wrote
>>>> I started to be fed up about protocol inconsistencies
>>>
>>> Amen
>>>
>>>
>>> Stéphane Ducasse wrote
>>>> So I will propose a set of rules (and a tool - I'm working on it) to
>>>> automatically categorize methods.
>>>> ...
>>>> Now we discussed today with esteban for initialize* we will use
>>>> 'initialization'
>>>
>>> Yay!
>>>
>>>
>>>
>>> -----
>>> Cheers,
>>> Sean
>>> --
>>> View this message in context: http://forum.world.st/Uniformizing-Pharo-tp4703357p4703577.html
>>> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>>>
>>
>>
>>
>> --
>> Best regards,
>> Igor Stasenko.
>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Uniformizing Pharo

Stéphane Ducasse


> Did you use the method categorizer that is already in the image?
>
> => MethodClassifier
>
> it implements already a lot of rules, so you should plug in your tool there or remove MethodClassifier and make it work with nautilus. otherwise we have a lot of duplicated functionality.

I was not aware of it I will look at it.
In fact there was a method categorizer in a nice package with tests and I took this one and adapted it.
I will check the rules.

Stef


Reply | Threaded
Open this post in threaded view
|

Re: Uniformizing Pharo

Stéphane Ducasse
Ok I checked and I prefer the one I used because you can express nice rules :)
My next step will be to check the tests again, hack/replace the methodClassifier and code with the hacked version for a while
and push everything in the system. Now I will look to see how to make them polymorphic because the classifier is simpler

Here is the default rules list (I added bench from the other list).

What is nice is that
        - we can express that the superclass should be used in last resort
        - I filtered the extensions for now.



defaultCategorizationRules

        "The order is relevant, the categorizer uses the first rule matching - DF"

        ^OrderedCollection new
                add: MethodCategorizationRule forAccessors;
               
                "initialize"
                add: (MethodCategorizationRule whenSelectorMatches: 'initialize*' categorizeIn: #initialization);
                add: (MethodCategorizationRule whenSelectorMatches: 'init*' categorizeIn: #initialization);
                add: (MethodCategorizationRule whenSelectorMatches: 'default*' categorizeIn: #defaults);
               
                add: (MethodCategorizationRule whenSelectorMatches: 'as*' categorizeIn: #converting);
                add: (MethodCategorizationRule whenSelectorMatches: 'hash' categorizeIn: #comparing);
                "order is important"
               
                "testing"
                add: (MethodCategorizationRule whenSelectorMatches: 'is*' categorizeIn: #testing);
                add: (MethodCategorizationRule whenSelectorMatches: 'has*' categorizeIn: #testing);
               
                add: (MethodCategorizationRule whenSelectorMatches: '=' categorizeIn: #comparing);
               
               
                add: (MethodCategorizationRule whenSelectorMatches: 'new' categorizeIn: #'instance creation');
                add: (MethodCategorizationRule whenSelectorMatches: 'setting' categorizeIn: #'settings');

                add: (MethodCategorizationRule whenSelectorMatches: 'printOn:' categorizeIn: #printing);
                add: (MethodCategorizationRule whenSelectorMatches: 'storeOn:' categorizeIn: #printing);
               
                add: (MethodCategorizationRule whenSelectorMatches: '*copy*' categorizeIn: #copying);
               
                add: (MethodCategorizationRule whenSelectorMatches: 'draw*' categorizeIn: #drawing);
                add: (MethodCategorizationRule whenSelectorMatches: 'bench*' categorizeIn: #benchmarking);
                add: (MethodCategorizationRule whenSelectorMatches: 'signal*' categorizeIn: #signalling);
                add: (MethodCategorizationRule whenSelectorMatches: 'add*' categorizeIn: #adding);
                add: (MethodCategorizationRule whenSelectorMatches: 'remove*' categorizeIn: #adding);
               
                add: (MethodCategorizationRule whenSelectorMatches: 'open*' categorizeIn: #opening);
                add: (MethodCategorizationRule whenSelectorMatches: 'update*' categorizeIn: #updating);
                add: (MethodCategorizationRule whenSelectorMatches: 'change*' categorizeIn: #updating);
               
                add: (MethodCategorizationRule whenSelectorMatches: 'accept*' categorizeIn: #'visitor accepting');
                add: (MethodCategorizationRule whenSelectorMatches: 'visit*' categorizeIn: #visiting);

                add: (MethodCategorizationRule whenSelectorMatches: 'menu*' categorizeIn: #menus);

                add: (MethodCategorizationRule whenSelectorMatches: 'value' categorizeIn: #value);
               
                "test cases"
                add: (MethodCategorizationRule
                                        whenSelectorMatches: 'test*'
                                        andClassInheritsFrom: TestCase
                                        categorizeIn: #tests);
                                       
                add: (MethodCategorizationRule
                                        whenSelectorMatches: 'setUp'
                                        andClassInheritsFrom: TestCase
                                        categorizeIn: #'setup');
                add: (MethodCategorizationRule
                                        whenSelectorMatches: 'tearDown'
                                        andClassInheritsFrom: TestCase
                                        categorizeIn: #'setup');
               
                "baselines, versions..."
                add: (MethodCategorizationRule
                                        whenSelectorMatches: 'version*'
                                        andClassMatches: 'ConfigurationOf*'
                                        categorizeIn: #'versions');
                add: (MethodCategorizationRule
                                        whenSelectorMatches: 'baseline*'
                                        andClassMatches: 'ConfigurationOf*'
                                        categorizeIn: #'baselines');
                add: (MethodCategorizationRule
                                        whenSelectorMatches: 'development*'
                                        andClassMatches: 'ConfigurationOf*'
                                        categorizeIn: #'symbolic');
                add: (MethodCategorizationRule
                                        whenSelectorMatches: 'stable*'
                                        andClassMatches: 'ConfigurationOf*'
                                        categorizeIn: #'symbolic');
               
               
                                       
                add: MethodCategorizationRule usingMostUsedCategoryInSuperClasses;
                add: MethodCategorizationRule usingMostUsedCategoryInImage;
                yourself

>> Did you use the method categorizer that is already in the image?
>>
>> => MethodClassifier
>>
>> it implements already a lot of rules, so you should plug in your tool there or remove MethodClassifier and make it work with nautilus. otherwise we have a lot of duplicated functionality.
>
> I was not aware of it I will look at it.
> In fact there was a method categorizer in a nice package with tests and I took this one and adapted it.
> I will check the rules.
>
> Stef
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Uniformizing Pharo

Camillo Bruni-3
ah looks very nice, indeed much more powerful than my hack.
If you have time, switch to real regular expressions, because things like
> add: (MethodCategorizationRule whenSelectorMatches: 'as*' categorizeIn: #converting);
will easily produce false positives. For instance #assert: will end up in converting, which is not what you want ;)
=> /as[A-Z][a-zA-Z]*/ for instance does a much better job


On 2013-08-14, at 15:24, Stéphane Ducasse <[hidden email]> wrote:

> Ok I checked and I prefer the one I used because you can express nice rules :)
> My next step will be to check the tests again, hack/replace the methodClassifier and code with the hacked version for a while
> and push everything in the system. Now I will look to see how to make them polymorphic because the classifier is simpler
>
> Here is the default rules list (I added bench from the other list).
>
> What is nice is that
> - we can express that the superclass should be used in last resort
> - I filtered the extensions for now.
>
>
>
> defaultCategorizationRules
>
> "The order is relevant, the categorizer uses the first rule matching - DF"
>
> ^OrderedCollection new
> add: MethodCategorizationRule forAccessors;
>
> "initialize"
> add: (MethodCategorizationRule whenSelectorMatches: 'initialize*' categorizeIn: #initialization);
> add: (MethodCategorizationRule whenSelectorMatches: 'init*' categorizeIn: #initialization);
> add: (MethodCategorizationRule whenSelectorMatches: 'default*' categorizeIn: #defaults);
>
> add: (MethodCategorizationRule whenSelectorMatches: 'as*' categorizeIn: #converting);
> add: (MethodCategorizationRule whenSelectorMatches: 'hash' categorizeIn: #comparing);
> "order is important"
>
> "testing"
> add: (MethodCategorizationRule whenSelectorMatches: 'is*' categorizeIn: #testing);
> add: (MethodCategorizationRule whenSelectorMatches: 'has*' categorizeIn: #testing);
>
> add: (MethodCategorizationRule whenSelectorMatches: '=' categorizeIn: #comparing);
>
>
> add: (MethodCategorizationRule whenSelectorMatches: 'new' categorizeIn: #'instance creation');
> add: (MethodCategorizationRule whenSelectorMatches: 'setting' categorizeIn: #'settings');
>
> add: (MethodCategorizationRule whenSelectorMatches: 'printOn:' categorizeIn: #printing);
> add: (MethodCategorizationRule whenSelectorMatches: 'storeOn:' categorizeIn: #printing);
>
> add: (MethodCategorizationRule whenSelectorMatches: '*copy*' categorizeIn: #copying);
>
> add: (MethodCategorizationRule whenSelectorMatches: 'draw*' categorizeIn: #drawing);
> add: (MethodCategorizationRule whenSelectorMatches: 'bench*' categorizeIn: #benchmarking);
> add: (MethodCategorizationRule whenSelectorMatches: 'signal*' categorizeIn: #signalling);
> add: (MethodCategorizationRule whenSelectorMatches: 'add*' categorizeIn: #adding);
> add: (MethodCategorizationRule whenSelectorMatches: 'remove*' categorizeIn: #adding);
>
> add: (MethodCategorizationRule whenSelectorMatches: 'open*' categorizeIn: #opening);
> add: (MethodCategorizationRule whenSelectorMatches: 'update*' categorizeIn: #updating);
> add: (MethodCategorizationRule whenSelectorMatches: 'change*' categorizeIn: #updating);
>
> add: (MethodCategorizationRule whenSelectorMatches: 'accept*' categorizeIn: #'visitor accepting');
> add: (MethodCategorizationRule whenSelectorMatches: 'visit*' categorizeIn: #visiting);
>
> add: (MethodCategorizationRule whenSelectorMatches: 'menu*' categorizeIn: #menus);
>
> add: (MethodCategorizationRule whenSelectorMatches: 'value' categorizeIn: #value);
>
> "test cases"
> add: (MethodCategorizationRule
> whenSelectorMatches: 'test*'
> andClassInheritsFrom: TestCase
> categorizeIn: #tests);
>
> add: (MethodCategorizationRule
> whenSelectorMatches: 'setUp'
> andClassInheritsFrom: TestCase
> categorizeIn: #'setup');
> add: (MethodCategorizationRule
> whenSelectorMatches: 'tearDown'
> andClassInheritsFrom: TestCase
> categorizeIn: #'setup');
>
> "baselines, versions..."
> add: (MethodCategorizationRule
> whenSelectorMatches: 'version*'
> andClassMatches: 'ConfigurationOf*'
> categorizeIn: #'versions');
> add: (MethodCategorizationRule
> whenSelectorMatches: 'baseline*'
> andClassMatches: 'ConfigurationOf*'
> categorizeIn: #'baselines');
> add: (MethodCategorizationRule
> whenSelectorMatches: 'development*'
> andClassMatches: 'ConfigurationOf*'
> categorizeIn: #'symbolic');
> add: (MethodCategorizationRule
> whenSelectorMatches: 'stable*'
> andClassMatches: 'ConfigurationOf*'
> categorizeIn: #'symbolic');
>
>
>
> add: MethodCategorizationRule usingMostUsedCategoryInSuperClasses;
> add: MethodCategorizationRule usingMostUsedCategoryInImage;
> yourself
>
>>> Did you use the method categorizer that is already in the image?
>>>
>>> => MethodClassifier
>>>
>>> it implements already a lot of rules, so you should plug in your tool there or remove MethodClassifier and make it work with nautilus. otherwise we have a lot of duplicated functionality.
>>
>> I was not aware of it I will look at it.
>> In fact there was a method categorizer in a nice package with tests and I took this one and adapted it.
>> I will check the rules.
>>
>> Stef
>>
>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Uniformizing Pharo

Stéphane Ducasse

On Aug 14, 2013, at 9:26 PM, Camillo Bruni <[hidden email]> wrote:

> ah looks very nice, indeed much more powerful than my hack.
> If you have time, switch to real regular expressions, because things like
>> add: (MethodCategorizationRule whenSelectorMatches: 'as*' categorizeIn: #converting);
> will easily produce false positives. For instance #assert: will end up in converting, which is not what you want ;)
> => /as[A-Z][a-zA-Z]*/ for instance does a much better job

Ok thanks for the idea.
I will.


Reply | Threaded
Open this post in threaded view
|

Re: Uniformizing Pharo

camille teruel
Also, to prevent explosion of the number of protocol names in the image, we could agree on some naming convention.

For example, there are protocols ending with -ing and others ending with -ion: which form one should prefer?
ex: conversion vs converting, composing vs composition.

Then, when a protocol name is made of several word, should we use space or - to separate them?
ex: instance creation vs instance-creation


On 15 août 2013, at 09:35, Stéphane Ducasse wrote:

>
> On Aug 14, 2013, at 9:26 PM, Camillo Bruni <[hidden email]> wrote:
>
>> ah looks very nice, indeed much more powerful than my hack.
>> If you have time, switch to real regular expressions, because things like
>>> add: (MethodCategorizationRule whenSelectorMatches: 'as*' categorizeIn: #converting);
>> will easily produce false positives. For instance #assert: will end up in converting, which is not what you want ;)
>> => /as[A-Z][a-zA-Z]*/ for instance does a much better job
>
> Ok thanks for the idea.
> I will.
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Uniformizing Pharo

Stéphane Ducasse

On Aug 16, 2013, at 3:59 PM, Camille Teruel <[hidden email]> wrote:

> Also, to prevent explosion of the number of protocol names in the image, we could agree on some naming convention.
>
> For example, there are protocols ending with -ing and others ending with -ion: which form one should prefer?
> ex: conversion vs converting, composing vs composition.

Yes this is the idea so let us define them.
Here is what I have

Stef


^OrderedCollection new
                add: MethodCategorizationRule forAccessors;
               
                "initialize"
                add: (MethodCategorizationRule whenSelectorMatches: 'initialize*' categorizeIn: #initialization);
                add: (MethodCategorizationRule whenSelectorMatches: 'init*' categorizeIn: #initialization);
                add: (MethodCategorizationRule whenSelectorMatches: 'default*' categorizeIn: #defaults);
               
                add: (MethodCategorizationRule whenSelectorMatches: 'as*' categorizeIn: #converting);
                add: (MethodCategorizationRule whenSelectorMatches: 'hash' categorizeIn: #comparing);
                "order is important"
               
                "testing"
                add: (MethodCategorizationRule whenSelectorMatches: 'is*' categorizeIn: #testing);
                add: (MethodCategorizationRule whenSelectorMatches: 'has*' categorizeIn: #testing);
               
                add: (MethodCategorizationRule whenSelectorMatches: '=' categorizeIn: #comparing);
               
               
                add: (MethodCategorizationRule whenSelectorMatches: 'new' categorizeIn: #'instance creation');
                add: (MethodCategorizationRule whenSelectorMatches: 'setting' categorizeIn: #'settings');

                add: (MethodCategorizationRule whenSelectorMatches: 'printOn:' categorizeIn: #printing);
                add: (MethodCategorizationRule whenSelectorMatches: 'storeOn:' categorizeIn: #printing);
               
                add: (MethodCategorizationRule whenSelectorMatches: '*copy*' categorizeIn: #copying);
               
                add: (MethodCategorizationRule whenSelectorMatches: 'draw*' categorizeIn: #drawing);
                add: (MethodCategorizationRule whenSelectorMatches: 'bench*' categorizeIn: #benchmarking);
                add: (MethodCategorizationRule whenSelectorMatches: 'signal*' categorizeIn: #signalling);
                add: (MethodCategorizationRule whenSelectorMatches: 'add*' categorizeIn: #adding);
                add: (MethodCategorizationRule whenSelectorMatches: 'remove*' categorizeIn: #adding);
               
                add: (MethodCategorizationRule whenSelectorMatches: 'open*' categorizeIn: #opening);
                add: (MethodCategorizationRule whenSelectorMatches: 'update*' categorizeIn: #updating);
                add: (MethodCategorizationRule whenSelectorMatches: 'change*' categorizeIn: #updating);
               
                add: (MethodCategorizationRule whenSelectorMatches: 'accept*' categorizeIn: #'visitor accepting');
                add: (MethodCategorizationRule whenSelectorMatches: 'visit*' categorizeIn: #visiting);

                add: (MethodCategorizationRule whenSelectorMatches: 'menu*' categorizeIn: #menus);

                add: (MethodCategorizationRule whenSelectorMatches: 'value' categorizeIn: #value);
               
                "test cases"
                add: (MethodCategorizationRule
                                        whenSelectorMatches: 'test*'
                                        andClassInheritsFrom: TestCase
                                        categorizeIn: #tests);
                                       
                add: (MethodCategorizationRule
                                        whenSelectorMatches: 'setUp'
                                        andClassInheritsFrom: TestCase
                                        categorizeIn: #'setup');
                add: (MethodCategorizationRule
                                        whenSelectorMatches: 'tearDown'
                                        andClassInheritsFrom: TestCase
                                        categorizeIn: #'setup');
               
                "baselines, versions..."
                add: (MethodCategorizationRule
                                        whenSelectorMatches: 'version*'
                                        andClassMatches: 'ConfigurationOf*'
                                        categorizeIn: #'versions');
                add: (MethodCategorizationRule
                                        whenSelectorMatches: 'baseline*'
                                        andClassMatches: 'ConfigurationOf*'
                                        categorizeIn: #'baselines');
                add: (MethodCategorizationRule
                                        whenSelectorMatches: 'development*'
                                        andClassMatches: 'ConfigurationOf*'
                                        categorizeIn: #'symbolic');
                add: (MethodCategorizationRule
                                        whenSelectorMatches: 'stable*'
                                        andClassMatches: 'ConfigurationOf*'
                                        categorizeIn: #'symbolic');
               
               
                                       
                add: MethodCategorizationRule usingMostUsedCategoryInSuperClasses;
                add: MethodCategorizationRule usingMostUsedCategoryInImage;
                yourself
Reply | Threaded
Open this post in threaded view
|

Re: Uniformizing Pharo

camille teruel

On 16 août 2013, at 21:57, Stéphane Ducasse wrote:

>
> On Aug 16, 2013, at 3:59 PM, Camille Teruel <[hidden email]> wrote:
>
>> Also, to prevent explosion of the number of protocol names in the image, we could agree on some naming convention.
>>
>> For example, there are protocols ending with -ing and others ending with -ion: which form one should prefer?
>> ex: conversion vs converting, composing vs composition.
>
> Yes this is the idea so let us define them.
> Here is what I have

So from your list, it seems that the convention is to use the -ing forms and to use spaces to separate words.
Personally I prefer protocol names to be nouns instead of present participle: conversion, deletion, addition, comparison...
But it's just a matter of taste and I understand it would involves too much changes.
So do we stick to -ing everywhere?

If we do, you have exceptions in your list: 'instance creation', 'initialization' and 'value' instead of 'instantiating', 'initializing' and 'evaluating' (or something equivalent).

Also does it worth having both 'visiting' and 'visitor accepting' since it's the same concern and accept* and visit* methods are in different classes?

Do you really want to have remove* methods in adding protocol?

What is this one: (MethodCategorizationRule whenSelectorMatches: 'setting' categorizeIn: #'settings') ?
Because setting has no implementors.

>
> Stef
>
>
> ^OrderedCollection new
> add: MethodCategorizationRule forAccessors;
>
> "initialize"
> add: (MethodCategorizationRule whenSelectorMatches: 'initialize*' categorizeIn: #initialization);
> add: (MethodCategorizationRule whenSelectorMatches: 'init*' categorizeIn: #initialization);
> add: (MethodCategorizationRule whenSelectorMatches: 'default*' categorizeIn: #defaults);
>
> add: (MethodCategorizationRule whenSelectorMatches: 'as*' categorizeIn: #converting);
> add: (MethodCategorizationRule whenSelectorMatches: 'hash' categorizeIn: #comparing);
> "order is important"
>
> "testing"
> add: (MethodCategorizationRule whenSelectorMatches: 'is*' categorizeIn: #testing);
> add: (MethodCategorizationRule whenSelectorMatches: 'has*' categorizeIn: #testing);
>
> add: (MethodCategorizationRule whenSelectorMatches: '=' categorizeIn: #comparing);
>
>
> add: (MethodCategorizationRule whenSelectorMatches: 'new' categorizeIn: #'instance creation');
> add: (MethodCategorizationRule whenSelectorMatches: 'setting' categorizeIn: #'settings');
>
> add: (MethodCategorizationRule whenSelectorMatches: 'printOn:' categorizeIn: #printing);
> add: (MethodCategorizationRule whenSelectorMatches: 'storeOn:' categorizeIn: #printing);
>
> add: (MethodCategorizationRule whenSelectorMatches: '*copy*' categorizeIn: #copying);
>
> add: (MethodCategorizationRule whenSelectorMatches: 'draw*' categorizeIn: #drawing);
> add: (MethodCategorizationRule whenSelectorMatches: 'bench*' categorizeIn: #benchmarking);
> add: (MethodCategorizationRule whenSelectorMatches: 'signal*' categorizeIn: #signalling);
> add: (MethodCategorizationRule whenSelectorMatches: 'add*' categorizeIn: #adding);
> add: (MethodCategorizationRule whenSelectorMatches: 'remove*' categorizeIn: #adding);
>
> add: (MethodCategorizationRule whenSelectorMatches: 'open*' categorizeIn: #opening);
> add: (MethodCategorizationRule whenSelectorMatches: 'update*' categorizeIn: #updating);
> add: (MethodCategorizationRule whenSelectorMatches: 'change*' categorizeIn: #updating);
>
> add: (MethodCategorizationRule whenSelectorMatches: 'accept*' categorizeIn: #'visitor accepting');
> add: (MethodCategorizationRule whenSelectorMatches: 'visit*' categorizeIn: #visiting);
>
> add: (MethodCategorizationRule whenSelectorMatches: 'menu*' categorizeIn: #menus);
>
> add: (MethodCategorizationRule whenSelectorMatches: 'value' categorizeIn: #value);
>
> "test cases"
> add: (MethodCategorizationRule
> whenSelectorMatches: 'test*'
> andClassInheritsFrom: TestCase
> categorizeIn: #tests);
>
> add: (MethodCategorizationRule
> whenSelectorMatches: 'setUp'
> andClassInheritsFrom: TestCase
> categorizeIn: #'setup');
> add: (MethodCategorizationRule
> whenSelectorMatches: 'tearDown'
> andClassInheritsFrom: TestCase
> categorizeIn: #'setup');
>
> "baselines, versions..."
> add: (MethodCategorizationRule
> whenSelectorMatches: 'version*'
> andClassMatches: 'ConfigurationOf*'
> categorizeIn: #'versions');
> add: (MethodCategorizationRule
> whenSelectorMatches: 'baseline*'
> andClassMatches: 'ConfigurationOf*'
> categorizeIn: #'baselines');
> add: (MethodCategorizationRule
> whenSelectorMatches: 'development*'
> andClassMatches: 'ConfigurationOf*'
> categorizeIn: #'symbolic');
> add: (MethodCategorizationRule
> whenSelectorMatches: 'stable*'
> andClassMatches: 'ConfigurationOf*'
> categorizeIn: #'symbolic');
>
>
>
> add: MethodCategorizationRule usingMostUsedCategoryInSuperClasses;
> add: MethodCategorizationRule usingMostUsedCategoryInImage;
> yourself