Re: How to name variables in a program?
- From: Scott Moore <samiamsansspam@xxxxxxx>
- Date: Tue, 31 May 2005 11:50:40 -0700
SerGioGio wrote:
> Hello,
>
> Having a strong convention for naming your variables in your program is an
> important issue often overlooked.
> Can anyone point me to a good source on the web dealing with this issue?
>
> SerGioGioGio
>
>
1. Use short labels on locals, long labels on globals. Reason: locals
are used for only a short length of code, have their declarations right at the
top (and presumably a good comment). Globals should have bigger, better labels.
Of course, even better is to reduce or eliminate global variables.
2. Don't use so called "hungarian" notation, courtesy of Microsoft, where types
are placed into the label name. Think of two people conversing:
"hi Dave (Person, Male, lives in California), I placed your desk (Large, computer,
contains keyboard drawer) chair (Red, padded, adjustable) back in your office
(manager level, closing door, has windows)."
Variables are shorthand for the task at hand. What matters to people is having
context, that is, being able to work in a small area (like a function) without
having to explain everything that is going on every time you do anything.
.
- References:
- How to name variables in a program?
- From: SerGioGio
- How to name variables in a program?
- Prev by Date: Re: Advice for mid-life career change (to programming)
- Next by Date: Re: Advice for mid-life career change (to programming)
- Previous by thread: Re: How to name variables in a program?
- Next by thread: Consistent "macro" Language
- Index(es):
Relevant Pages
|