What is the naming convention in regards to casing...
# cfml-beginners
o
What is the naming convention in regards to casing for multi-word variables? For example:
Copy code
property name="passwordresettoken";
	property name="passwordresettokenexpiration";
m
Follow the conventions of the team you're on. Usually my teams run camel-case.
o
I'm my own team 🤣 So,
Copy code
property name="passwordResetToken";
	property name="passwordResetTokenExpiration";
correct?
d
If your component does password reset stuff and it's named PasswordReset.cfc I would not repeat it in the property names. all lowercase “token” and “expiration” would be perfect var names
Those long names are overkill
Actually, regardless of your cfc name I would still not make those var names that long.
token and expiration is completely understandable and more readable than any camel case
o
Is there a limit to variable name length?
d
Probably not
o
So just unnecessarily unneeded. Thanks
d
But it's about the experience and reference you'll have with those var names. Shorter and simple will be better in the dev experience
a
Strongly disagree with that general statement.
In this context there's no need to double-up, for sure. But... focus on clear, readable names, not short ones. If you go over around 20 chars though, yer method is probably a bit too long or unfocused.
d
You disagree with my experience?
Ah that's just worded differently. So I agree with you.
p
Take a look here at Best practices from Ortus; they are a pretty solid team and have great docs outlining how they operate. I tend to also use a bit of their approaches: https://github.com/Ortus-Solutions/coding-standards/blob/master/coldfusion.md
b
Just a personal preference, but I prefer Pascal case over camel case for variable names. It seems more natural to type and read.