Is there a compressed directory of naming variables?

There are many different styles of variable names that I have come across over the years.

The current Wikipedia entry in naming conventions is pretty bright ...

I would like to see a short catalog of naming variables, denoting it with a name / description and some examples.

If the agreement is particularly favorable to a particular community of the platform, this is also worth noting.

I turn this into a community wiki, so please create an answer for each agreement and edit if necessary.

+3
source share
5 answers

, , " Code Complete" . " " , , , .

+4

PEP8 - Python, , Python. , Python, .

PEP8: , , , :

foo
parse_foo
a_long_descriptive_name

, :

in_
and_
or_

, ( " M import *" ), . , , .:

_some_what_private
__a_slightly_more_private_name

, Python, :

__hash__  # hash(o) = o.__hash__()
__str__   # str(o) = o.__str__()
+2

Sun Java . , , , , .

, , . . _ $, .

     

, . , . , "throwaway". i, j, k, m n ; c, d e .

int             i;
char            c;
float           myWidth;
+1

, :

  • ( )
  • ( )

, (a, an, some) , .

, ( , , ) .

, , .

+1

Einar Hoest " Java-" .

He analyzed the grammatical structure of the method names along with the structure of the method bodies and collected information such as:

add- [noun] - * These methods often have parameters and create objects. They very rarely return field values. The phrase appears in almost all applications.

etc., compiled from hundreds of open source projects.

For more reference information, see his document SLE08 .

0
source

Source: https://habr.com/ru/post/1698702/


All Articles