class variable accessor naming

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

class variable accessor naming

Jan Blizničenko
Hello

Class variable names should start with capital letter (as I just found out), like RecentProjects. We have a getter to it. Should such accessor method be named recentProjects or RecentProjects?

... class#>>(r/R)ecentProjects
     ^ RecentProjects

Jan
Reply | Threaded
Open this post in threaded view
|

Re: class variable accessor naming

Sean P. DeNigris
Administrator
Jan B. wrote
Hello

Class variable names should start with capital letter (as I just found out), like RecentProjects. We have a getter to it. Should such accessor method be named recentProjects or RecentProjects?

... class#>>(r/R)ecentProjects
     ^ RecentProjects

Jan
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: class variable accessor naming

Christian Caldeiro
In reply to this post by Jan Blizničenko
Class variables should be written with Uppercase (but there are some classes in Pharo that don't follow this convention). Class methods (accessors in this case) are written in lowercase. Again, you can find several samples in Pharo.

Thanks
Christian

On Tue, Apr 7, 2015 at 1:54 PM, Jan B. <[hidden email]> wrote:
Hello

Class variable names should start with capital letter (as I just found out),
like RecentProjects. We have a getter to it. Should such accessor method be
named recentProjects or RecentProjects?

... class#>>(r/R)ecentProjects
     ^ RecentProjects

Jan



--
View this message in context: http://forum.world.st/class-variable-accessor-naming-tp4818137.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: class variable accessor naming

Jan Blizničenko
True, I already found few examples of accessors to class variables, but I like to be sure when I use it for the first time. Thank you.

Jan

Christian Caldeiro wrote
Class variables should be written with Uppercase (but there are some
classes in Pharo that don't follow this convention). Class methods
(accessors in this case) are written in lowercase. Again, you can find
several samples in Pharo.

Thanks
Christian

On Tue, Apr 7, 2015 at 1:54 PM, Jan B. <[hidden email]> wrote:

> Hello
>
> Class variable names should start with capital letter (as I just found
> out),
> like RecentProjects. We have a getter to it. Should such accessor method be
> named recentProjects or RecentProjects?
>
> ... class#>>(r/R)ecentProjects
>      ^ RecentProjects
>
> Jan
>
>
>
> --
> View this message in context:
> http://forum.world.st/class-variable-accessor-naming-tp4818137.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: class variable accessor naming

Christian Caldeiro
You can find many guidelines like these in the "Smalltalk with Style" book.

For instance on page 3 it says "Upper and lowercase letters also distinguish variable scope. Variables beginning with an upper case letter (globals, classes, class variables, and pool dictionaries) are global to all methods within the definition scope of the variable. Method parameters, temporary variables, and instance variables begin with a lower case letter. By convention, class and instance method names begin with a lower case letter".

You can find this and other Smalltalk books here: http://stephane.ducasse.free.fr/FreeBooks.html

Christian

On Wed, Apr 8, 2015 at 3:13 PM, Jan B. <[hidden email]> wrote:
True, I already found few examples of accessors to class variables, but I
like to be sure when I use it for the first time. Thank you.

Jan


Christian Caldeiro wrote
> Class variables should be written with Uppercase (but there are some
> classes in Pharo that don't follow this convention). Class methods
> (accessors in this case) are written in lowercase. Again, you can find
> several samples in Pharo.
>
> Thanks
> Christian
>
> On Tue, Apr 7, 2015 at 1:54 PM, Jan B. &lt;

> bliznjan@.cvut

> &gt; wrote:
>
>> Hello
>>
>> Class variable names should start with capital letter (as I just found
>> out),
>> like RecentProjects. We have a getter to it. Should such accessor method
>> be
>> named recentProjects or RecentProjects?
>>
>> ... class#>>(r/R)ecentProjects
>>      ^ RecentProjects
>>
>> Jan
>>
>>
>>
>> --
>> View this message in context:
>> http://forum.world.st/class-variable-accessor-naming-tp4818137.html
>> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>>
>>





--
View this message in context: http://forum.world.st/class-variable-accessor-naming-tp4818137p4818431.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.