Re: A few beginner questions
Re: A few beginner questions
- Subject: Re: A few beginner questions
- From: Bill Royds <email@hidden>
- Date: Mon, 7 Apr 2008 20:45:23 -0400
On 7-Apr-08, at 12:41 , Jason Sallis wrote: "Actually, it is: dCostValueRatio, iPeopleCount, etc.."
That's one style of Hungarian notation, but the three-character style is perfectly valid as well. You'll find the 3-character style used primarily in the Visual Basic (pre .NET) community. It was a Microsoft effort to standardize naming across the VB6/VBA/Access platforms back in the day which, unfortunately, caught on. Humor your instructor and use it in your class and then promptly forget about it as it's a fairly deprecated naming style.
Hungarian notation was developed by former Microsoft VP of development, Charles Simonyi (who was Hungarian, which is where the name came from). It was an attempt to help developers avoid errors in languages where variables could hold multiple types such as VB6(variants). the type prefix (like the @ prefix in Objective-C)told readers of code what the intended type of the variable was. It helps to avoid type errors which are very common in C and C++ because of little understood type conversion rules. There have been some studies to se if it is effective in reducing errors, but they have been inconclusive.
A common problem with the prefix version of this notation is that variables associated with the same logical concepts are not close together in alphabetical order. Another alternative notation sometims advocated to avoid this is to add the types as suffixes after the real name, such as CostValueRatio_dbl, PeopleCount_int etc. This puts variables logically together in listings while still have the type as part of the name. Perhaps you can suggest this to your teacher.
Bill Royds
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden