Re: How to name variables in a program?
- From: August Karlstrom <fusionfive@xxxxxxxxx>
- Date: Mon, 30 May 2005 22:41:30 GMT
Phlip wrote:
August Karlstrom wrote:
Ok, then I see your point (the dot or the space under the dot has a tendency to "disappear", right?) It's unfortunate then that `i' is probably one of the most commonly used names for local variables. Make sure you use the best possible font. I like Proggy Clean, though it might be a tad too small.
Oookay. Now suppose for a moment that I weren't mildly visually impaired. (I honestly am, but I really wish that were the _worst_ of my impairments!)
Shouldn't the same logic apply? To amp up the font, _and_ to use variable names with high visual impact, like k, j, q, etc?
Yes, when it comes to legibility I'm with you. In mathematics I think `k' (rather than e.g. `i') is often used as subscript for that very reason. I think I will use j and k more often from now on.
(Also, one should use techniques like Ruby's .each() method that encapsulate dumb little variables away from their controlled code...)
Note that single letter variable names are generally preferred for (trivial) loop variables as long names obscures the code. Compare
FOR k := 0 TO LEN(a) DO
a[k] := 0
ENDwith
FOR arrayIndex := 0 TO LEN(a) DO
a[arrayIndex] := 0
ENDIt's even more evident in the C family of languages:
for (k = 0; k < n; k++)
a[k] = 0;versus
for (arrayIndex = 0; arrayIndex < n; arrayIndex++)
a[arrayIndex] = 0;
-- August .
- Follow-Ups:
- Re: How to name variables in a program?
- From: Phlip
- Re: How to name variables in a program?
- From: August Karlstrom
- Re: How to name variables in a program?
- References:
- How to name variables in a program?
- From: SerGioGio
- Re: How to name variables in a program?
- From: Phlip
- Re: How to name variables in a program?
- From: August Karlstrom
- Re: How to name variables in a program?
- From: Phlip
- Re: How to name variables in a program?
- From: August Karlstrom
- Re: How to name variables in a program?
- From: Phlip
- Re: How to name variables in a program?
- From: August Karlstrom
- Re: How to name variables in a program?
- From: Phlip
- Re: How to name variables in a program?
- From: August Karlstrom
- Re: How to name variables in a program?
- From: Phlip
- How to name variables in a program?
- Prev by Date: Re: How to name variables in a program?
- Next by Date: Re: How to name variables in a program?
- Previous by thread: Re: How to name variables in a program?
- Next by thread: Re: How to name variables in a program?
- Index(es):
Relevant Pages
|