Iâm not the biggest fan of method categories/protocols but I try to. What strikes me is the huge mess in names we have. Everytime I create e.g. an initialize method Iâm asking myself which is the proper name to choose initialize initializing initialization â¦. Do we have a convention for this? Right now all names starting with init are initialization-data initialize-destroy initialization-filter initialize - release initialize initialization-union initialize - event initializing initialization initalize-release initailize-release initialization widgets initalize initialize-release initialization-release Norbert
Historically, it's always been 'initalize-release'  ----------------- Benoît St-Jean Yahoo! Messenger: bstjean Twitter: @BenLeChialeux Pinterest: benoitstjean Instagram: Chef_Benito IRC: lamneth Blogue: endormitoire.wordpress.com "A standpoint is an intellectual horizon of radius zero". (A. Einstein) From: Norbert Hartl <norbert@hartl.name> To: Pharo Dev <pharo-dev@lists.pharo.org> Sent: Saturday, January 13, 2018 6:33 AM Subject: [Pharo-dev] Protocol names convention Iâm not the biggest fan of method categories/protocols but I try to. What strikes me is the huge mess in names we have. Everytime I create e.g. an initialize method Iâm asking myself which is the proper name to choose initialize initializing initialization â¦. Do we have a convention for this? Right now all names starting with init are initialization-data initialize-destroy initialization-filter initialize - release initialize initialization-union initialize - event initializing initialization initalize-release initailize-release initialization widgets initalize initialize-release initialization-release Norbert
Hi Norbert,
On Jan 13, 2018, at 3:32 AM, Norbert Hartl <norbert@hartl.name> wrote:
Iâm not the biggest fan of method categories/protocols but I try to. What strikes me is the huge mess in names we have. Everytime I create e.g. an initialize method Iâm asking myself which is the proper name to choose
initialize initializing initialization â¦.
Do we have a convention for this?
Right now all names starting with init are
initialization-data initialize-destroy initialization-filter initialize - release initialize initialization-union initialize - event initializing initialization initalize-release initailize-release initialization widgets initalize initialize-release initialization-release
Funny. Your list (of course) omits one of the best: instance initialization In the original Smalltalk-80 the one used was initialize-release because the system, having a reference counting garbage collector, needed explicit cycle breaking for garbage to be reclaimed and so there were some important release methods in the compiler and the GUI. But these became obsolete when scavenging was introduced, and so in the parcplace code instance initialization started replacing initialize-release. I think protocol names should use the passive voice since the active voice suggests specific usage. So initialization is better than initialize et al. And it would be nice to have tool support to suggest protocol names to maintain consistency so that the same selector usually appears in the same protocol. Spelling rorres are intivetible and should be fixed when found.
Norbert
Hi Eliot, On 13 January 2018 at 12:59, Eliot Miranda <eliot.miranda@gmail.com> wrote:
And it would be nice to have tool support to suggest protocol names to maintain consistency so that the same selector usually appears in the same protocol. Spelling rorres are intivetible and should be fixed when found.
This is partly already available. If you select the '-- all --' category, enter and save a method, the browser will guess which protocol to put the method in. If the method is implemented by a superclass it will be put in the same protocol, so #initialize will be put in to 'initialization' (where it is in ProtoObject). Cheers, Alistair
Am 13.01.2018 um 13:37 schrieb Alistair Grant <akgrant0710@gmail.com>:
Hi Eliot,
On 13 January 2018 at 12:59, Eliot Miranda <eliot.miranda@gmail.com> wrote:
And it would be nice to have tool support to suggest protocol names to maintain consistency so that the same selector usually appears in the same protocol. Spelling rorres are intivetible and should be fixed when found.
This is partly already available. If you select the '-- all --' category, enter and save a method, the browser will guess which protocol to put the method in. If the method is implemented by a superclass it will be put in the same protocol, so #initialize will be put in to 'initialization' (where it is in ProtoObject).
Cheers, Alistair
Sounds great! In which class is the code that does the decision about the right name? I think I find my convention here.+ Norbert
Le 13/01/2018 à 13:46, Norbert Hartl a écrit :
Sounds great! In which class is the code that does the decision about the right name? I think I find my convention here.+
There is MethodClassifier with pragma, prefix and suffix map class side.
Norbert
-- Cyril Ferlicot https://ferlicot.fr http://www.synectique.eu 2 rue Jacques Prévert 01, 59650 Villeneuve d'ascq France
On 13 January 2018 at 13:50, Cyril Ferlicot D. <cyril.ferlicot@gmail.com> wrote:
Le 13/01/2018 à 13:46, Norbert Hartl a écrit :
Sounds great! In which class is the code that does the decision about the right name? I think I find my convention here.+
There is MethodClassifier with pragma, prefix and suffix map class side.
Which is called by NautilusUI>>compileAMethodFromCategory:withSource:notifying: Cheers, Alistair
Yes and In automaticMethodCategorizer (an old project that I improved for nothing) I did a protocol analyser to help taking some decision on protocol names. Stef On Sat, Jan 13, 2018 at 2:53 PM, Alistair Grant <akgrant0710@gmail.com> wrote:
On 13 January 2018 at 13:50, Cyril Ferlicot D. <cyril.ferlicot@gmail.com> wrote:
Le 13/01/2018 à 13:46, Norbert Hartl a écrit :
Sounds great! In which class is the code that does the decision about the right name? I think I find my convention here.+
There is MethodClassifier with pragma, prefix and suffix map class side.
Which is called by NautilusUI>>compileAMethodFromCategory:withSource:notifying:
Cheers, Alistair
Bingo :) I fixed the automatic categoriser and refrain myself from fixing all the deprecancies. Stef On Sat, Jan 13, 2018 at 1:37 PM, Alistair Grant <akgrant0710@gmail.com> wrote:
Hi Eliot,
On 13 January 2018 at 12:59, Eliot Miranda <eliot.miranda@gmail.com> wrote:
And it would be nice to have tool support to suggest protocol names to maintain consistency so that the same selector usually appears in the same protocol. Spelling rorres are intivetible and should be fixed when found.
This is partly already available. If you select the '-- all --' category, enter and save a method, the browser will guess which protocol to put the method in. If the method is implemented by a superclass it will be put in the same protocol, so #initialize will be put in to 'initialization' (where it is in ProtoObject).
Cheers, Alistair
Norbert I developed a tool to analysis the use of protocol and fix them. It can show you the distribution and the problems. You can load it: AutomaticMethodCategorizer. Now I call my protocol initialization because initialize-release is dated :) Stef On Sat, Jan 13, 2018 at 12:32 PM, Norbert Hartl <norbert@hartl.name> wrote:
Iâm not the biggest fan of method categories/protocols but I try to. What strikes me is the huge mess in names we have. Everytime I create e.g. an initialize method Iâm asking myself which is the proper name to choose
initialize initializing initialization â¦.
Do we have a convention for this?
Right now all names starting with init are
initialization-data initialize-destroy initialization-filter initialize - release initialize initialization-union initialize - event initializing initialization initalize-release initailize-release initialization widgets initalize initialize-release initialization-release
Norbert
participants (6)
-
Alistair Grant -
Benoit St-Jean -
Cyril Ferlicot D. -
Eliot Miranda -
Norbert Hartl -
Stephane Ducasse