Style Cop
-
I never understood the need to for formatting software (I think that is what StyleCop is right?).
I sometimes feel alone in this opinion, but I believe that source code readability is a very, very, close second place to code correctness. Anyone else?
"Why look within yourself for THE TRUTH, when you're the one who's confused in the first place?" Mr. Spackle
-
I started to check out StyleCop this morning. I'm not going to rant about every other rule it follows, but has anyone noticed that the file **.Designer.cs violates:
SA1201: All methods must be placed after all fields.
Windows creates this file. I think I'm done with StyleCop.
-
You really don't need a tool to police that. The accepted convention is camel case for variables, so under_score is simply wrong. Suggest (s)he reads a book or something.
Regards, Rob Philpott.
Rob Philpott wrote:
The accepted convention is camel case for variables, so under_score is simply wrong.
That is your opinion. Microsoft begs to differ with their internal coding practices. I thought we killed this bird a few days ago.
-
I sometimes feel alone in this opinion, but I believe that source code readability is a very, very, close second place to code correctness. Anyone else?
"Why look within yourself for THE TRUTH, when you're the one who's confused in the first place?" Mr. Spackle
me too. which is why i think LINQ is crap.
-
Rob Philpott wrote:
The accepted convention is camel case for variables, so under_score is simply wrong.
That is your opinion. Microsoft begs to differ with their internal coding practices. I thought we killed this bird a few days ago.
Mine and everyone else I know - yes.
Regards, Rob Philpott.
-
Not so much formatting as code styles and guidelines, like variable naming, comments, order of fields, methods etc.
Regards, Nish
My technology blog: voidnish.wordpress.com
Thanks for the correction. :)
-
Thanks for the correction. :)
-
Mine and everyone else I know - yes.
Regards, Rob Philpott.
Since you like it, what's the rationale for starting just the first word with a lower case letter? Why is
customerAccountNumber
better thanCustomerAccountNumber
orstrCustomerAccountNumber
orlpszCustomerAccountNumber
? -
StyleCop is meant to be used on user-written source files. Do not use it on auto-generated files :-)
Regards, Nish
My technology blog: voidnish.wordpress.com
Hmmm, I always thought StyleCop was intended for the garbage can...
.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001 -
Since you like it, what's the rationale for starting just the first word with a lower case letter? Why is
customerAccountNumber
better thanCustomerAccountNumber
orstrCustomerAccountNumber
orlpszCustomerAccountNumber
?Who knows? The point is convention. You can tell at a glance what you're dealing with (local/member/property etc). And if we all do things the same way it makes it easier to understand each other's code. A good thing surely.
Regards, Rob Philpott.
-
Who knows? The point is convention. You can tell at a glance what you're dealing with (local/member/property etc). And if we all do things the same way it makes it easier to understand each other's code. A good thing surely.
Regards, Rob Philpott.
Rob Philpott wrote:
Who knows? The point is convention.
And that's my point. All you're saying is that being consistent is good, and being able to identify scope from name is good. But that's not a justification for using camel case. I've never seen a good reason why it's "better" than other naming standards, and I think it's worse. My deliberately chosen example is something that is conventionally called a number, but in the real world is very ofen a mixture of letters and numbers, and so has to be represented as a string. Using the camel case standard, you somethings can't infer data type from the name, which to me seems a backward step.
-
self-satisfied swine :-D
There is only one Ashley Judd and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.
-
Rob Philpott wrote:
Who knows? The point is convention.
And that's my point. All you're saying is that being consistent is good, and being able to identify scope from name is good. But that's not a justification for using camel case. I've never seen a good reason why it's "better" than other naming standards, and I think it's worse. My deliberately chosen example is something that is conventionally called a number, but in the real world is very ofen a mixture of letters and numbers, and so has to be represented as a string. Using the camel case standard, you somethings can't infer data type from the name, which to me seems a backward step.
Electron Shepherd wrote:
But that's not a justification for using camel case.
It absolutely is. Having a standard, even if its not very good is far better than everyone going off and doing their own thing. I never claimed camel case to be a good idea but it is the convention in the example given. Its a bit like suggesting you spell words the way they sound rather than the way they're spelled because it makes more sense.
Regards, Rob Philpott.
-
self-satisfied swine :-D
There is only one Ashley Judd and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.
-
Electron Shepherd wrote:
But that's not a justification for using camel case.
It absolutely is. Having a standard, even if its not very good is far better than everyone going off and doing their own thing. I never claimed camel case to be a good idea but it is the convention in the example given. Its a bit like suggesting you spell words the way they sound rather than the way they're spelled because it makes more sense.
Regards, Rob Philpott.
Rob Philpott wrote:
But that's not a justification for using camel case
Rob Philpott wrote:
It absolutely is.
No, it's a justification for using a standard. It's not a justifcation for selecting camel case as that standard. Your point about "You can tell at a glance what you're dealing with (local/member/property etc). And if we all do things the same way it makes it easier to understand each other's code." are entirely valid, and I agree with them, but they apply just as much to Hungarian notation as camel case.
-
I know you have a nice sense of humor, that’s why I allow myself a crude jokes sometimes. :)
There is only one Ashley Judd and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.
-
Rob Philpott wrote:
But that's not a justification for using camel case
Rob Philpott wrote:
It absolutely is.
No, it's a justification for using a standard. It's not a justifcation for selecting camel case as that standard. Your point about "You can tell at a glance what you're dealing with (local/member/property etc). And if we all do things the same way it makes it easier to understand each other's code." are entirely valid, and I agree with them, but they apply just as much to Hungarian notation as camel case.
Electron Shepherd wrote:
But that's not a justification for using camel case
Electron Shepherd wrote:
It absolutely is.
Electron Shepherd wrote:
No, it's a justification for using a standard.
Uh-huh. Ok it's not a justification for using camel case for its own merit, its justification for using camel case because that is the standard. Better?
Regards, Rob Philpott.
-
I know you have a nice sense of humor, that’s why I allow myself a crude jokes sometimes. :)
There is only one Ashley Judd and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.
Go ahead, we are all crude people here, so the cruder the humor, the funnier it is for all of us :)
Regards, Nish
My technology blog: voidnish.wordpress.com
-
Electron Shepherd wrote:
But that's not a justification for using camel case
Electron Shepherd wrote:
It absolutely is.
Electron Shepherd wrote:
No, it's a justification for using a standard.
Uh-huh. Ok it's not a justification for using camel case for its own merit, its justification for using camel case because that is the standard. Better?
Regards, Rob Philpott.
Not really. It still doesn't explain why it's the standard in the first place. That's what I'm trying to userstand. Lots of people use camel case as a naming standard, but no-one seems able to say why it's better than the others. So, if you were tasked with developing a set of coding standards, and you decided to use camel case for variables, would you be explain to someone the benefits of that over an MFC-style
str...
or C-stylelpsz...
convention?