commit
991ca66d70
1 changed files with 3 additions and 3 deletions
|
@ -334,7 +334,7 @@ So, it effectively becomes an empty return. We should put the value on the same
|
||||||
|
|
||||||
## Naming a function [#function-naming]
|
## Naming a function [#function-naming]
|
||||||
|
|
||||||
Functions are actions. So their name is usually a verb. It should briefly, but as accurately as possible, describe what the function does, so that someone reading the code gets an indication of what the function does.
|
Functions are actions. So their name is usually a verb. It should be brief, as accurate as possible and describe what the function does, so that someone reading the code gets an indication of what the function does.
|
||||||
|
|
||||||
It is a widespread practice to start a function with a verbal prefix which vaguely describes the action. There must be an agreement within the team on the meaning of the prefixes.
|
It is a widespread practice to start a function with a verbal prefix which vaguely describes the action. There must be an agreement within the team on the meaning of the prefixes.
|
||||||
|
|
||||||
|
@ -376,9 +376,9 @@ These examples assume common meanings of prefixes. What they mean for you is det
|
||||||
```smart header="Ultrashort function names"
|
```smart header="Ultrashort function names"
|
||||||
Functions that are used *very often* sometimes have ultrashort names.
|
Functions that are used *very often* sometimes have ultrashort names.
|
||||||
|
|
||||||
For example, the [jQuery](http://jquery.com) framework defines a function `$`. The [LoDash](http://lodash.com/) library has its core function named `_`.
|
For example, the [jQuery](http://jquery.com) framework defines a function with `$`. The [LoDash](http://lodash.com/) library has its core function named `_`.
|
||||||
|
|
||||||
These are exceptions. Generally functions names should be concise, but descriptive.
|
These are exceptions. Generally functions names should be concise and descriptive.
|
||||||
```
|
```
|
||||||
|
|
||||||
## Functions == Comments
|
## Functions == Comments
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue