Is there any nomenclature for variables defined by underline / underscore?

6

I know there are some rules and conventions for naming variables in programming, such as CamelCase , PascalCase , etc ...

What is the term used for a compound name variable (words separated by "_")?

Example: nome_da_variavel

    
asked by anonymous 26.06.2017 / 22:02

3 answers

6

I know this underline separation by the name of Snake Case .

According to the Wikipedia reference, the name snake case was created by the Ruby community.

Examples

In some languages, it is common to see the use of snake_case for nomeclatures of some functions or variables, such as the Python language. It seems that the galley that develops in this language prefers to define functions or variables with this pattern.

Example:

 def minha_funcao(**args):
     pass

 resultado = minha_funcao(1)

Commonly, in Python, we see the use of the snake case combined with the lowercase. Maybe that's why according to Wikipedia, the name used by the Python Style Guide was lower_case_with_underscores .

In PHP we also see this pattern being applied to functions and variables, and the small difference is that in cases of variables considered Super Global language, it is written in uppercase.

See:

 $usuario_id = obter_id_usuario($_GET)

References:

link

    
26.06.2017 / 22:05
6

Snakecase or Underscorecase are the terms used for the case that uses "_".

Snake case is very old and comes from the beginning of C, but has received this name recently.

Here has a good idea of all the conventions that I believe are useful in your study.

Font

    
26.06.2017 / 22:10
6

Yes, this pattern is commonly called the snake_case , in this case: p).

There is no official name for this pattern, snake case was the name the Ruby community gave it (that's right, it was not the Python people).

The Python style guide calls this pattern < > lower_case_with_underscores .

    
26.06.2017 / 22:05