I'll see your curly braces & raise you a variable naming convention
-
So which type of convention do you use when naming variables with multiple words? * camelCase * PascalCase * snake_case // Rust requires this for variable, function and struct member names and the compiler will warn (gripe at you) if you use other. I really like Rust, but this drives me crazy because it is YAC (Yet Another Convention) Back in C++ & C# I always used
PascalCase
Then in recent years JavaScript has effected my mind and I use a lot ofcamelCase
these days. Kotlin (Android dev) & Swift (iOS dev) seem to use camelCase too. So it becoming kind of a standard. How about you? See more here[^]. -
So which type of convention do you use when naming variables with multiple words? * camelCase * PascalCase * snake_case // Rust requires this for variable, function and struct member names and the compiler will warn (gripe at you) if you use other. I really like Rust, but this drives me crazy because it is YAC (Yet Another Convention) Back in C++ & C# I always used
PascalCase
Then in recent years JavaScript has effected my mind and I use a lot ofcamelCase
these days. Kotlin (Android dev) & Swift (iOS dev) seem to use camelCase too. So it becoming kind of a standard. How about you? See more here[^].camelCase for static / private / local members, PascalCase for public members. Globals, where needed, are g_CamelCase.
GCS/GE d--(d) s-/+ a C+++ U+++ P-- L+@ E-- W+++ N+ o+ K- w+++ O? M-- V? PS+ PE Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
-
So which type of convention do you use when naming variables with multiple words? * camelCase * PascalCase * snake_case // Rust requires this for variable, function and struct member names and the compiler will warn (gripe at you) if you use other. I really like Rust, but this drives me crazy because it is YAC (Yet Another Convention) Back in C++ & C# I always used
PascalCase
Then in recent years JavaScript has effected my mind and I use a lot ofcamelCase
these days. Kotlin (Android dev) & Swift (iOS dev) seem to use camelCase too. So it becoming kind of a standard. How about you? See more here[^].Depends. Mostly camelCase for local and parameter variables, PascalCase for properties and methods, with a little Hungarian thrown in for contols: butOK, tbUsername, ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
-
Depends. Mostly camelCase for local and parameter variables, PascalCase for properties and methods, with a little Hungarian thrown in for contols: butOK, tbUsername, ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
OriginalGriff wrote:
with a little Hungarian thrown in
tut tut... I'll have to give you 5 demerits for that.* :rolleyes: *Had to say it, because I was a huge Hungarian-follower for so many years (remember all them Windows API calls?) and then they rugged us telling us to stop it. I was damaged from that. :laugh:
-
Depends. Mostly camelCase for local and parameter variables, PascalCase for properties and methods, with a little Hungarian thrown in for contols: butOK, tbUsername, ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
OriginalGriff wrote:
with a little Hungarian thrown in for contols: butOK, tbUsername
Hush, it's ok, VisualBasic will hurt you no more...
GCS/GE d--(d) s-/+ a C+++ U+++ P-- L+@ E-- W+++ N+ o+ K- w+++ O? M-- V? PS+ PE Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
-
So which type of convention do you use when naming variables with multiple words? * camelCase * PascalCase * snake_case // Rust requires this for variable, function and struct member names and the compiler will warn (gripe at you) if you use other. I really like Rust, but this drives me crazy because it is YAC (Yet Another Convention) Back in C++ & C# I always used
PascalCase
Then in recent years JavaScript has effected my mind and I use a lot ofcamelCase
these days. Kotlin (Android dev) & Swift (iOS dev) seem to use camelCase too. So it becoming kind of a standard. How about you? See more here[^].Programs should be read as books. What would you prefer, aBookThatIsTypesetInLongWordsAlmostLikeGerman, or a_more_relaxed_one_that_leaves_spaces_between_words? PS: Is it St. Sterile de Bates Day today?
Mircea
-
Programs should be read as books. What would you prefer, aBookThatIsTypesetInLongWordsAlmostLikeGerman, or a_more_relaxed_one_that_leaves_spaces_between_words? PS: Is it St. Sterile de Bates Day today?
Mircea
Writing snake_case variables is annoying, freaking underscore needs a double keypress after every word. I'd love it if it wasn't so cumbersome.
GCS/GE d--(d) s-/+ a C+++ U+++ P-- L+@ E-- W+++ N+ o+ K- w+++ O? M-- V? PS+ PE Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
-
So which type of convention do you use when naming variables with multiple words? * camelCase * PascalCase * snake_case // Rust requires this for variable, function and struct member names and the compiler will warn (gripe at you) if you use other. I really like Rust, but this drives me crazy because it is YAC (Yet Another Convention) Back in C++ & C# I always used
PascalCase
Then in recent years JavaScript has effected my mind and I use a lot ofcamelCase
these days. Kotlin (Android dev) & Swift (iOS dev) seem to use camelCase too. So it becoming kind of a standard. How about you? See more here[^].Usually PascalCase, but camelCase for member data and locals.
Robust Services Core | Software Techniques for Lemmings | Articles
The fox knows many things, but the hedgehog knows one big thing. -
Writing snake_case variables is annoying, freaking underscore needs a double keypress after every word. I'd love it if it wasn't so cumbersome.
GCS/GE d--(d) s-/+ a C+++ U+++ P-- L+@ E-- W+++ N+ o+ K- w+++ O? M-- V? PS+ PE Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
Hmm, on my keyboard Caps also need a double keypress ;P
Mircea
-
Hmm, on my keyboard Caps also need a double keypress ;P
Mircea
True that, but one hand remains on the letter portion of the keyboard. I find it easier, also more compact. Though snake_case helps understanding.
GCS/GE d--(d) s-/+ a C+++ U+++ P-- L+@ E-- W+++ N+ o+ K- w+++ O? M-- V? PS+ PE Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
-
True that, but one hand remains on the letter portion of the keyboard. I find it easier, also more compact. Though snake_case helps understanding.
GCS/GE d--(d) s-/+ a C+++ U+++ P-- L+@ E-- W+++ N+ o+ K- w+++ O? M-- V? PS+ PE Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
I know I'm not going to win this argument but on my keyboard, underscore is right above the P. I promise I'm not going to continue this argument :laugh:
Mircea
-
So which type of convention do you use when naming variables with multiple words? * camelCase * PascalCase * snake_case // Rust requires this for variable, function and struct member names and the compiler will warn (gripe at you) if you use other. I really like Rust, but this drives me crazy because it is YAC (Yet Another Convention) Back in C++ & C# I always used
PascalCase
Then in recent years JavaScript has effected my mind and I use a lot ofcamelCase
these days. Kotlin (Android dev) & Swift (iOS dev) seem to use camelCase too. So it becoming kind of a standard. How about you? See more here[^].I reject the premise of the question.
-
So which type of convention do you use when naming variables with multiple words? * camelCase * PascalCase * snake_case // Rust requires this for variable, function and struct member names and the compiler will warn (gripe at you) if you use other. I really like Rust, but this drives me crazy because it is YAC (Yet Another Convention) Back in C++ & C# I always used
PascalCase
Then in recent years JavaScript has effected my mind and I use a lot ofcamelCase
these days. Kotlin (Android dev) & Swift (iOS dev) seem to use camelCase too. So it becoming kind of a standard. How about you? See more here[^].In[Case]
PartsBin an Electronics Part Organizer - An updated version available! JaxCoder.com
-
Programs should be read as books. What would you prefer, aBookThatIsTypesetInLongWordsAlmostLikeGerman, or a_more_relaxed_one_that_leaves_spaces_between_words? PS: Is it St. Sterile de Bates Day today?
Mircea
-
I reject the premise of the question.
-
So which type of convention do you use when naming variables with multiple words? * camelCase * PascalCase * snake_case // Rust requires this for variable, function and struct member names and the compiler will warn (gripe at you) if you use other. I really like Rust, but this drives me crazy because it is YAC (Yet Another Convention) Back in C++ & C# I always used
PascalCase
Then in recent years JavaScript has effected my mind and I use a lot ofcamelCase
these days. Kotlin (Android dev) & Swift (iOS dev) seem to use camelCase too. So it becoming kind of a standard. How about you? See more here[^].PascaleCase
-
So which type of convention do you use when naming variables with multiple words? * camelCase * PascalCase * snake_case // Rust requires this for variable, function and struct member names and the compiler will warn (gripe at you) if you use other. I really like Rust, but this drives me crazy because it is YAC (Yet Another Convention) Back in C++ & C# I always used
PascalCase
Then in recent years JavaScript has effected my mind and I use a lot ofcamelCase
these days. Kotlin (Android dev) & Swift (iOS dev) seem to use camelCase too. So it becoming kind of a standard. How about you? See more here[^].In my first 10-15 years of programming, hardcopy printouts were still common. Both my university and my first employer used a printer model placing the underscore so low that it almost hit the top of the characters on the line below; you certainly didn't see it as tying two characters together. In a listing, a name with underscores looked like several space separated words. For variables starting / ending with an underscore, the underscore was easily overlooked. This could at times be really confusing. So I came to strongly dislike underscores in identifiers. If you really wanted to underscore a text line for emphasis, like in a header, these printers were fine - they didn't clutter up the text. Other printers, placing the underscore at the character baseline, were not suitable for underscoring. E.g. an underscored h would be very similar to a b, an underscored n was close to an o. So for emphasizing text, our printers were great, but not for underscore used as a printable character in an identifier.
-
So which type of convention do you use when naming variables with multiple words? * camelCase * PascalCase * snake_case // Rust requires this for variable, function and struct member names and the compiler will warn (gripe at you) if you use other. I really like Rust, but this drives me crazy because it is YAC (Yet Another Convention) Back in C++ & C# I always used
PascalCase
Then in recent years JavaScript has effected my mind and I use a lot ofcamelCase
these days. Kotlin (Android dev) & Swift (iOS dev) seem to use camelCase too. So it becoming kind of a standard. How about you? See more here[^].I use pascal case in .NET, camel case in JS, and snake case in my libraries in C++.
To err is human. Fortune favors the monsters.
-
So which type of convention do you use when naming variables with multiple words? * camelCase * PascalCase * snake_case // Rust requires this for variable, function and struct member names and the compiler will warn (gripe at you) if you use other. I really like Rust, but this drives me crazy because it is YAC (Yet Another Convention) Back in C++ & C# I always used
PascalCase
Then in recent years JavaScript has effected my mind and I use a lot ofcamelCase
these days. Kotlin (Android dev) & Swift (iOS dev) seem to use camelCase too. So it becoming kind of a standard. How about you? See more here[^].I pretty much do whatever strikes my fancy at the moment, throwing structure, conventions, and consistency to the wind. I find that adopting a care-free attitude to coding makes for a more interesting and fun time while testing and debugging my code in Production.
-
I know I'm not going to win this argument but on my keyboard, underscore is right above the P. I promise I'm not going to continue this argument :laugh:
Mircea
Another reason that made me dislike underscores (the the first one is hardcopy readability): Although you are right about upper case also being a double stroke, both the shift and the letter have identical positions on all keyboards, and you can keep your hands in the same position (as long as you have learned to use your left pinky for the shift key). If you switch between different keyboards - especially keyboards adapted to different languages - punctuation and special characters such as underscore jumps all over the place. It took a few years to define a Norwegian standard placement for all those new characters that came with PCs, unknown on traditional typewriters, so if I dig up my oldest keyboards, even on Norwegian keyboards, they jump around. Using a Norwegian keyboard at home, a US English one at the office, and sometimes some machinery with its own keyboard layout, can be very frustrating. Nowadays, on a Norwegian keyboard, underscore is shift-hyphen, the rightmost key in the bottom row, next to right shift. You have to move your right hand three-quarters off the keyboard to hit it. (That also goes for hyphen, even if it is un-shifted.)