Languages/All/IdentifierNames

(Difference between revisions)
Jump to: navigation, search
(Identifiers)
(Identifiers)
Line 2: Line 2:
 
{{TOC right}}
 
{{TOC right}}
 
== Identifiers ==
 
== Identifiers ==
''Identifier complexity SHOULD be inversely proportional to it scope size'', unknown author (
+
// Bad idea :
If someone can find the original phrase and author, I just remember having seen it on a Linux related mailing list.)
+
for (int RidiculouslyLongIdentifierName = 0 ; RidiculouslyLongIdentifierName < 0 ; RidiculouslyLongIdentifierName++)
 +
{
 +
System.out.println(RidiculouslyLongIdentifierName);
 +
}
 +
 +
// Better :
 +
for (int i = 0 ; i < 0 ; i++)
 +
{
 +
System.out.println(i);
 +
}
 +
Here are some tips for choosing good identifiers.
 +
 
 +
''Identifier complexity SHOULD be proportional to it scope size'' -- unknown author
 +
 
 +
If someone can find the original phrase and author, feel free to point me to the reference, I just remember having seen it on a Linux related mailing list.
 +
 
 +
 
 +
Example :
 +
<source lang="java">
 +
// Bad idea :
 +
for (int RidiculouslyLongIdentifierName = 0 ; RidiculouslyLongIdentifierName < 0 ; RidiculouslyLongIdentifierName++)
 +
{
 +
System.out.println(RidiculouslyLongIdentifierName);
 +
}
 +
 
 +
// Better :
 +
for (int i = 0 ; i < 0 ; i++)
 +
{
 +
System.out.println(i);
 +
}
 +
</source>

Revision as of 15:31, 16 October 2014

Contents

Identifiers

// Bad idea : for (int RidiculouslyLongIdentifierName = 0 ; RidiculouslyLongIdentifierName < 0 ; RidiculouslyLongIdentifierName++) { System.out.println(RidiculouslyLongIdentifierName); }

// Better : for (int i = 0 ; i < 0 ; i++) { System.out.println(i); } Here are some tips for choosing good identifiers.

Identifier complexity SHOULD be proportional to it scope size -- unknown author

If someone can find the original phrase and author, feel free to point me to the reference, I just remember having seen it on a Linux related mailing list.


Example :

// Bad idea :
for (int RidiculouslyLongIdentifierName = 0 ; RidiculouslyLongIdentifierName < 0 ; RidiculouslyLongIdentifierName++)
{
	System.out.println(RidiculouslyLongIdentifierName);
}
 
// Better :
for (int i = 0 ; i < 0 ; i++)
{
	System.out.println(i);
}
Personal tools
Namespaces
Variants
Actions
Navigation
Browse
Toolbox