Difference between revisions of "Naming convention (programming)"
From Wiki @ Karl Jones dot com
Karl Jones (Talk | contribs) (etc) |
Karl Jones (Talk | contribs) (etc) |
||
Line 1: | Line 1: | ||
− | In [[computer programming]], a ''' | + | In [[computer programming]], a '''naming convention''' is a set of rules for choosing the character sequence to be used for identifiers which denote variables, types, functions, and other entities in [[source code]] and [[Software documentation|software documentation]]. |
Reasons for using a naming convention (as opposed to allowing programmers to choose any character sequence) include: | Reasons for using a naming convention (as opposed to allowing programmers to choose any character sequence) include: | ||
Line 26: | Line 26: | ||
* It's easy to feel that you could do better if you worked harder | * It's easy to feel that you could do better if you worked harder | ||
** Thus your work is never really done | ** Thus your work is never really done | ||
+ | |||
+ | The term [[naming convention]] has a similar meaning in other fields. | ||
== See also == | == See also == |
Revision as of 08:03, 18 August 2015
In computer programming, a naming convention is a set of rules for choosing the character sequence to be used for identifiers which denote variables, types, functions, and other entities in source code and software documentation.
Reasons for using a naming convention (as opposed to allowing programmers to choose any character sequence) include:
- To reduce the effort needed to read and understand source code
- To enable code reviews be able to focus on more important issues than arguing over syntax and naming standards.
- To enable code quality review tools be able to focus their reporting mainly on significant issues other than syntax and style preferences.
- To enhance source code appearance (for example, by disallowing overly long names or unclear abbreviations).
On the difficulty of naming things
There are only two hard things in Computer Science: cache invalidation and naming things.
-- Phil Karlton
This quote (much-repeated-with-variations) may misquoted or mis-attributed. (See TwoHardThings by Martin Fowler.)
Nonetheless, it expresses fundamental truths:
- Naming things is essential to computer programming
- It's hard to do well
- It's easy to feel that you could do better if you worked harder
- Thus your work is never really done
The term naming convention has a similar meaning in other fields.
See also
External links
- Naming convention (programming) @ Wikipedia