This rule should be easy if you keep in mind that other developers want to read and understand your code.
The general rule is to use meaningful variable names. When reading the name of a variable, it should be immediately clear
What kind of value variable represents
How the variable is used
Its scope
The length of a variable is unrestricted. Use this fact. To make a clear distinction between variable names and function names, use _ in variables and uppercase and lowercase in function names.
Do
boolean is_sparc = (architecture == "sparc"); list <map> probed_modems = (list <map>) SCR::Read ( .probe.modem ); integer list_index = 0; map a_modem = $[]; while (list_index < size (probed_modems)) { a_modem = probed_modems[list_index]:$[]; doSomething (a_modem, is_sparc); list_index = list_index + 1; }
Don't
boolean n = (architecture == "sparc"); list <map> dev = (list <map>) SCR::Read(.probe.modem); integer i = 0; map m = $[]; while (i<size(dev)) { m = dev[i]:$[]; func (m, n); i=i+1; }