Skip to content

Latest commit

 

History

History
44 lines (30 loc) · 1.23 KB

naming-rules.md

File metadata and controls

44 lines (30 loc) · 1.23 KB

Naming Rules

Names shouldn't be too long. If they come out to be huge, use an appropriate acronym, or more preferably, find a way to make it shorter. If you can't make it shorter and keep the original meaning, comment its actual purpose.

BAD:

int thisVariableControlsTheThingThatControlsTheFoo

GOOD:

int thingFooController

And less preferable:

int VCTTTCTF

Abbreviations should not be used, except for a few special cases. They are as following:

Name Abbreviation
Interator Iter
Implementation Impl
Variable Var
Function Func
Number Num
Constant Const
Utility Util
Argument Arg
Parameter Param

Other approved abbreviations are those that are very commonly used, like DNS for Dynamic Name Service, HTTP for HyperText Transfer Protocol, XML for eXtensible Markup Language, JSON for JavaScript Object Notation, etc.

{% hint style="warning" %} EXCEPTION: if you are writing a simple for loop, i, j, x, y, and z are acceptable iterator names. When writing complex algorithms which may involve nested loops, or loops whose iterator isn't so obvious, pertain to using more descriptive iterator names. {% endhint %}