OT: Variable naming conventions (Was: Why does the meaning (and spelling) of words change?)
|From:||Henrik Theiling <theiling@...>|
|Date:||Wednesday, April 21, 2004, 23:39|
I cannot stop myself from saying: a very bad attempt. It is totally
counterintuitive and redundant. Redundancy is one of the sources of
errors: never code the type redundantly in a variable. Name the
variable after its conceptual content, not its type. The system is
bad for memorisation.
szSy= (psy=(struct SY*)&rgwDic[*pbsy])->sz;
scare off, they don't attract. Programs must attract programmers in
order for them to read the programs and, e.g., find bugs on the fly
while trying to understand the code. For this, the code must look
nice and natural.
One problem is abbreviation: it may be short, but not clear. What you
want is not shortness, but conciseness, i.e. shortness + clearness.
Furthermore, the given example code uses obfuscations I would get
really angry at:
- two side effects in a single statement (see above)
- ++ operators in boolean equations
- multiple declarations on the same line
Aweful. Unreadable. Unmaintainable. => Full of bugs.
Sorry for being off-topic. :-) There seem to be different schools for
Good Programing (tm).
> See http://tinyurl.com/ezmr
for details on "Hungarian notation", a more
> ambitious attempt tailored for C and C++.