|
Bob Stanneveld wrote:
hongarian notation
Hungarian?
[worldspawn]
|
|
|
|
|
Hallo,
I am not following hungarian. I am using my own naming convention.
first I name the scope, than the type, than the name like
privStrUserName,pubBolLockedIn something like this.
Personally I like it. Maybe I am oldfashioned.
Chris
Vietiane (Laos)
|
|
|
|
|
This is the convention I have been using since day one and have carried it across all languages that I code with.
|
|
|
|
|
The whole casing thing is a problem, and I've been bitten by other things as well. I tend to write CLS Compliant projects, and then when my code is not CLS compliant, it's knowingly so, I set the attribute to say I know and accept the fact.
I find though that I often have a camel case private variable, and a first letter uppercase property, and that's not CLS compliant, apparently. You can use _ for the first letter of a private variable, in fact CLS compliance suggests this. I don't like that though.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
I find though that I often have a camel case private variable, and a first letter uppercase property, and that's not CLS compliant, apparently.
I think the problem here is, e.g., VB. VB cannot understand a property defined this way because of case insensitivity. However, I'd have thought MS could have designed VB to cope with this. You can already have a type name and a variable name the same. Makes sense as they're in different namespaces.
Kevin
|
|
|
|
|
I dont see how you COULD write case insensitive code in C# or VC++
|
|
|
|
|
Case insensitivity means not having two identifiers in the same scope whose name differs only in case. It's easy enough to do this in the C-family languages and it's generally recommended anyway.
Kevin
|
|
|
|
|
My VB projects follows these rules:
1) Private vars with class scope:
Private mVarName As String
2) The properties that access them:
Public property VarName() As String
3) Vars with narrow (function level) scope
Dim varName As Integer
Never had a case of being confused....
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
My Blog[^]
|
|
|
|
|
Ray Cassick wrote:
Never had a case of being confused....
For once, this was not a VB bash. The problem I have is that the way I case variables, I am not CLS compliant. Because if I need a scratch variable, I am likely to do this:
Bitmap bitmap = CallSomeFunction();
And I can't do that, because VB is crap and does not recognise case. Oops, I guess it does relate to VB....
It also means I can't do properties like this:
Bitmap sourceImage;
public Bitmap SourceImage
{
get
{
return sourceImage;
}
}
For example.
Casing is one more place where VB won't hurt a disciplined programmer, but helps idiots write unreadable spagetti.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I don't write dot net code, but I have been using underscore for my local variables for the longest time!
It seems like the rest of the industry is slowly catching up with me
|
|
|
|
|
Hate to break it to your exclusive future but: CLS-compliant means, among other things, no underscores in variable names
regards,
Paul Watson
South Africa
PMW Photography
Gary Wheeler wrote:
It's people like you that keep me heading for my big debut on CNN...
|
|
|
|
|
From what I read in this forum, it seems that this rule only applies to the public interface, does it not ?
So, my "local variable" have a even more "private" scope than the private attributes, for they are allocated on the stack, quite invisible from the interface standpoint.
|
|
|
|
|
Hope you don't write C++ code...
Medication for us all
You think you know me, well you're wrong
|
|
|
|
|
Sure I write C++ code, and nothing else much.
Why wouldn't I ?
|
|
|
|
|
When I was developing .NET code, I used to run FxCop[^] before each check-in to VSS, and FxCop reports any non CLS-compliant code. However, it seems I was the only one in the office that practiced this
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Me: I recommend we use FxCop for our projects.
Co-worker (not CP): I think I saw that movie once.
Me: Yeah, bad ending though eh?
regards,
Paul Watson
South Africa
PMW Photography
Gary Wheeler wrote:
It's people like you that keep me heading for my big debut on CNN...
|
|
|
|
|
Nemanja Trifunovic wrote:
FxCop reports any non CLS-compliant code.
You mean the CLSCompliant attribute is not enough?
Regards,
Alvaro
Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is. -- GWB, 1999.
|
|
|
|
|
It is. Actually, what FxCop does is report an error if CLSCompliant attribute is missing and then leaves the actual enforcement of CLS compliance to the compiler.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Running code through FxCop is a really bad way to start the day. "I don't like your naming convention", "get rid of that underscore", "why are initialising that value to null you idiot", "I don't like it when you contract string to str"
OK, OK - I'll fix it. Sheesh.
cheers,
Chris Maunder
|
|
|
|
|
The first time I ran it and it came back with over 100 errors, I thought about changing careers.
Jeff Martin
My Blog
|
|
|
|
|
I write cls compliant code (as much as possible given the particulars of the project), but since internals are often renamed, why dones internal naming conventions make code "CLS" or "NON-CLS"? to me writing cls compliant code is writing code which complies to the standards of the common runtime language, not a common naming convention...
/bb|[^b]{2}/
|
|
|
|
|
Writing CLS-compliant means, among other things, no underscores in variable names, no unsigned integers and case insensivity in naming. Do you bother?
Notice the text in bold - "among other things"
Nish
|
|
|
|
|
oh I noticed it, but have never seen--out right--naming conventions be included in cls compliance, is all.
/bb|[^b]{2}/
|
|
|
|
|
CLS compliant code must work with all first class .NET languages. VB.NET, for example, isn't case sensitive and uses "_" as a special character so you have to be careful with naming your accessible entity names. Private and internal names you don't have to worry about.
cheers,
Chris Maunder
|
|
|
|
|
I think that why private method's name should begin with '_', like : _InitTab ! Then the external interface : calculate... That make more sens
Kochise
In Code we trust !
|
|
|
|