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 <[hidden email]> To: Pharo Dev <[hidden email]> 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 |
In reply to this post by NorbertHartl
Hi Norbert,
> On Jan 13, 2018, at 3:32 AM, Norbert Hartl <[hidden email]> 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 <[hidden email]> 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 <[hidden email]>: > > Hi Eliot, > > On 13 January 2018 at 12:59, Eliot Miranda <[hidden email]> 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 signature.asc (836 bytes) Download Attachment |
In reply to this post by NorbertHartl
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 <[hidden email]> 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 > |
In reply to this post by alistairgrant
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 <[hidden email]> wrote: > Hi Eliot, > > On 13 January 2018 at 12:59, Eliot Miranda <[hidden email]> 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 > |
In reply to this post by CyrilFerlicot
On 13 January 2018 at 13:50, Cyril Ferlicot D. <[hidden email]> 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 <[hidden email]> wrote: > On 13 January 2018 at 13:50, Cyril Ferlicot D. <[hidden email]> 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 > |
Free forum by Nabble | Edit this page |