Consistency...
-
:~ Everyone knows that identifiers starting with an underscore are reserved for the implementation.
Keep Calm and Carry On
Yes, but I relented on that issue in order to achieve a compromise on underscores. I didn't want underscores in the leading position at all, while Mr. Object wanted underscores to be prohibited unless they were in the leading position indicating scope. I use underscores in locals which for me are generally all lower case. I also use underscores in globals when the name includes an acronym:
ObjectABC_Factory
, for example, whereABC
is the acronym. Back story: My group has a naming convention and coding style document that is 1½ pages, and most of it recommends rather requires or prohibits. In fact, I think there's only one thing in it that is absolutely prohibited, and that's Hungarian notation. When we created this document in 2000, that was still quite a thing when doing Windows programming. The only place we allow it to be used is in argument names for callback functions, and they are recommended to use the same names as in the documentation. For what it's worth, we've never had a conflict between our use of leading underscores and any compiler in the last 20 years, and that's spread over tens of millions of lines of C, C++, and C# code.Software Zen:
delete this;
-
Yes, but I relented on that issue in order to achieve a compromise on underscores. I didn't want underscores in the leading position at all, while Mr. Object wanted underscores to be prohibited unless they were in the leading position indicating scope. I use underscores in locals which for me are generally all lower case. I also use underscores in globals when the name includes an acronym:
ObjectABC_Factory
, for example, whereABC
is the acronym. Back story: My group has a naming convention and coding style document that is 1½ pages, and most of it recommends rather requires or prohibits. In fact, I think there's only one thing in it that is absolutely prohibited, and that's Hungarian notation. When we created this document in 2000, that was still quite a thing when doing Windows programming. The only place we allow it to be used is in argument names for callback functions, and they are recommended to use the same names as in the documentation. For what it's worth, we've never had a conflict between our use of leading underscores and any compiler in the last 20 years, and that's spread over tens of millions of lines of C, C++, and C# code.Software Zen:
delete this;
Gary R. Wheeler wrote:
there's only one thing in it that is absolutely prohibited, and that's Hungarian notation
FTMFW! The worst shite ever dreamt up. I found a post about leading underscores which also pointed out that the trailing
__t_
's that I occasionally use are reserved in POSIX standards. Yawn.Robust Services Core | Software Techniques for Lemmings | Articles
-
:~ Everyone knows that identifiers starting with an underscore are reserved for the implementation.
Keep Calm and Carry On
k5054 wrote:
Everyone knows that identifiers starting with an underscore are reserved for the implementation.
Let me just check that I get this right now: Identifiers not starting with an underscore is for those modules that are not yet implemented. ... Did I get it right this time=?
-
Gary R. Wheeler wrote:
there's only one thing in it that is absolutely prohibited, and that's Hungarian notation
FTMFW! The worst shite ever dreamt up. I found a post about leading underscores which also pointed out that the trailing
__t_
's that I occasionally use are reserved in POSIX standards. Yawn.Robust Services Core | Software Techniques for Lemmings | Articles
Is that Apps Hungarian or Systems Hungarian? Systems Hungarian is indeed "The worst shite ever dreamt up", but Apps Hungarian I can understand even if I don't use it.
Wrong is evil and must be defeated. - Jeff Ello
-
Or the lack thereof:
{
"token_data": {
"AccessToken": "eyJraWQiOi..."
}
}Look, either use underscores or don't. Make Request with JWT · massgov/LicenseValidationAPI Wiki · GitHub[^] I deal with idiots when I have to work with 3rd party API's.
Latest Articles:
Abusing Extension Methods, Null Continuation, and Null Coalescence OperatorsYou also don't know how to use the apostrophe. APIs 🤦♀️
-
I suppose you know the three ways of drinking whisky? With water, without water and like water.
To be honest... no, I didn't know it. But I will remember it ;) Is a good one:thumbsup: :laugh: :laugh:
M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.
-
k5054 wrote:
Everyone knows that identifiers starting with an underscore are reserved for the implementation.
Let me just check that I get this right now: Identifiers not starting with an underscore is for those modules that are not yet implemented. ... Did I get it right this time=?
The way I understood it is that identifiers that begin with _ are private or supposedly private (for languages that don't enforce such thing) those that don't are public I might very well be wrong
-
Or the lack thereof:
{
"token_data": {
"AccessToken": "eyJraWQiOi..."
}
}Look, either use underscores or don't. Make Request with JWT · massgov/LicenseValidationAPI Wiki · GitHub[^] I deal with idiots when I have to work with 3rd party API's.
Latest Articles:
Abusing Extension Methods, Null Continuation, and Null Coalescence OperatorsI agree completely. Consistency eases the mind and the eye, clearing your head to think about important matters instead of how this particular variable is cased. Consistency in code can reduce errors and so create consistent quality as well (or maybe it's the other way around). If I find inconsistent code I immediately assume it's written by some bungler who was so occupied understanding basic programming that there was simply no mental space left for consistency. And usually I'm right. If you can't even get consistency right, the rest of the code probably sucks as well. When I look at that library I also see variables such as "username_val", where I presume "val" is short for "value". What else than a value are you going to enter anyway? :confused: It seems like an API created by a government, 'nuff said :rolleyes:
Best, Sander sanderrossel.com Migrating Applications to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly
-
Is that Apps Hungarian or Systems Hungarian? Systems Hungarian is indeed "The worst shite ever dreamt up", but Apps Hungarian I can understand even if I don't use it.
Wrong is evil and must be defeated. - Jeff Ello
I had to look this up, because I didn't realize there were two variants. So thanks for prompting that! Apps Hungarian isn't as bad, but arcane prefixed abbreviations to denote a purpose don't appeal to me. If something has a small scope, such as a loop variable, a single letter often works as a name. If it has a large scope, I'd rather see it spelled out.
Robust Services Core | Software Techniques for Lemmings | Articles
-
Or the lack thereof:
{
"token_data": {
"AccessToken": "eyJraWQiOi..."
}
}Look, either use underscores or don't. Make Request with JWT · massgov/LicenseValidationAPI Wiki · GitHub[^] I deal with idiots when I have to work with 3rd party API's.
Latest Articles:
Abusing Extension Methods, Null Continuation, and Null Coalescence Operators -
Or the lack thereof:
{
"token_data": {
"AccessToken": "eyJraWQiOi..."
}
}Look, either use underscores or don't. Make Request with JWT · massgov/LicenseValidationAPI Wiki · GitHub[^] I deal with idiots when I have to work with 3rd party API's.
Latest Articles:
Abusing Extension Methods, Null Continuation, and Null Coalescence Operators -
I agree completely. Consistency eases the mind and the eye, clearing your head to think about important matters instead of how this particular variable is cased. Consistency in code can reduce errors and so create consistent quality as well (or maybe it's the other way around). If I find inconsistent code I immediately assume it's written by some bungler who was so occupied understanding basic programming that there was simply no mental space left for consistency. And usually I'm right. If you can't even get consistency right, the rest of the code probably sucks as well. When I look at that library I also see variables such as "username_val", where I presume "val" is short for "value". What else than a value are you going to enter anyway? :confused: It seems like an API created by a government, 'nuff said :rolleyes:
Best, Sander sanderrossel.com Migrating Applications to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly
Sander Rossel wrote:
If I find inconsistent code I immediately assume it's written by some bungler who was so occupied understanding basic programming that there was simply no mental space left for consistency.
Slight disagreement there. The bunglers with which I work not only don't understand basic programming, they have no interest in learning.
-
Yes, but I relented on that issue in order to achieve a compromise on underscores. I didn't want underscores in the leading position at all, while Mr. Object wanted underscores to be prohibited unless they were in the leading position indicating scope. I use underscores in locals which for me are generally all lower case. I also use underscores in globals when the name includes an acronym:
ObjectABC_Factory
, for example, whereABC
is the acronym. Back story: My group has a naming convention and coding style document that is 1½ pages, and most of it recommends rather requires or prohibits. In fact, I think there's only one thing in it that is absolutely prohibited, and that's Hungarian notation. When we created this document in 2000, that was still quite a thing when doing Windows programming. The only place we allow it to be used is in argument names for callback functions, and they are recommended to use the same names as in the documentation. For what it's worth, we've never had a conflict between our use of leading underscores and any compiler in the last 20 years, and that's spread over tens of millions of lines of C, C++, and C# code.Software Zen:
delete this;
The original Hungarian notation was actually supposed to be useful at the time. The prefix should have been a 'type' as in 'size', 'color', 'frequency', 'voltage', etc. So if you defined your variables as;
float szAnimal, szElephant float colAnimal, colElephant float vLethal
Then when you looked at the code, the line:
szAnimal = colElephant \* 0.5
Should ring alarm bells, while:
vLethal = VoltagToKillBySize(szElephant)
is fine! Of course, once idiots started using stupid prefixes like iCount, fWeight, pData and similar it became the spawn of the devil and was rightly banned by all sane people.