en:devmon:guidelines:variables
Table of Contents
Variable Name
In General
- Avoid CamelCase and variation: use underscore
- As short as possible to describe the “function” of the var: sample my $desc = “devmon is cool”
With or without "s" at the end
- scalar($) and hash(%) without “s”
- array(@) with an “s”
Avoid ambiguous names
- last (final or previous)
- set (adjust or collection)
- left (direction or what remains)
- right (direction, correct or entitlement)
- no (negative:non or number)
- record (verb or noun)
- second (time or position)
- close (nearby or shut)
- use (active_usage or category of function)
- term (terminal or termination)
- temp (temperature or temporary)
- val (value or valid)
- Avoid too short names that dont give a real benefit: prefer good readability
- prop(erty), val(ue), str(ing), num(ber), idx(index), but use it as postfix {variable}_XXX
- i, j, k, x, y, z
Do not use
- list, set, value, equals, data, var,
Quantity
- scalar: {variable}_count
- array : {variable}s_count (not a double “s” of course!)
- hash: {variable}_count
- linear Structure , hash, list →{variable}_count ?
- non-Linear Structure: tree, set: → {variable}_count, ?
Prefix
- format: as_number, as_string,
- boolean: is_number
Reference
- {variable}_ref
Quantity
Array
en/devmon/guidelines/variables.txt · Last modified: 2021/09/09 09:22 by adminw1k1