- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Jeezus enough with the damn VB6 naming conventions. You programming in C#!!!! Read the damn help files, they provide the naming convention you should use.
Thank You :)
Admin
No kidding. I have more than a couple people I work with that still use the VB naming stuff in their Java and it makes me want to scream.
Admin
Some hungarian is still good. If you faithfully distinguish member/global/class vars from the locals, it is must easier to find side-effects.
It can make your constructors pretty too:
class foo { foo(int var) { _var = var } ...
ymmv
Admin
I prefer to do this:
class foo { foo(int var) { this.var = var; }
Admin
qwerty,
<quote>
It can make your constructors pretty too:
class foo { foo(int var) { _var = var } ...
</quote>
Using _ before a variable name is not hungarian.
Seeya
Matthew
Admin
The VB naming conventions is not what makes this so damned funny.
strMsgICN75964 = "ICN75964"; ?!?!?!
How about picking a variable name that really means something. HELLO!?
Admin
"How about picking a variable name that really means something. HELLO!?"
Perhaps ICN875964 is a code well known to the users of teh application. I really don't see what's so odd about the code.
Admin
Frans said: "Perhaps ICN875964 is a code well known to the users of teh application. I really don't see what's so odd about the code."
As your comment demonstrates, it's hard to repeatedly type such a strange sequence. You added an 8 that shouldn't be there, but it doesn't "look" wrong unless you look closely digit by digit.
It would be more useful, and meaningful even to people who use/maintain that system, to give it a more generic name like "strAlertMsg" or something related to it's purpose, not it's arcane content.
Admin
Naming conventions here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconnamingguidelines.asp
This only addresses externally visible members. What's the recommendation for local private variables? I've seen names starting with underscores. What do others do?
Admin
"What do others do?" I used to work at M$ and we used a coding standards tool similar to fxCop that checked your naming against M$ Longhorn coding standards. Basically internal members should always be referenced as this.variable no underscores or m prefixes allowed anymore.
Admin
I don't believe that anyone who refers to Microsoft as "M$" every worked there. Well, maybe serving up drinks in the on-campus Starbucks ... but definately not as a coder or anything related to software development.
Admin
Thanks Martinator but that doesn't really answer my question. this.variable is fine but what form does variable take? Often its the same name as a property so how do you distingish it? By case (property = Pascal, local variable = camel) or something else?
Admin
Matt K,
<quote>
The VB naming conventions is not what makes this so damned funny.
</quote>
Definitely. My response was based on qwerty's statement rather than the humour of the original post.
Seeya
Matthew
Admin
It should be distinguished by case or use a different name. All public properties should start with an upercase and all internal variable should start lowercase:
private int count = 0;
public int Count
{
...
}
You should always go through the property if possible, not the internal variable.
Admin
What an idiot, those should be constants!
Admin
I don't get why that's an issue.
Admin
TRWFT is what the strings' contents might be used for!