Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global Variable Naming #13

Open
paulrolfe opened this issue Feb 2, 2016 · 5 comments
Open

Global Variable Naming #13

paulrolfe opened this issue Feb 2, 2016 · 5 comments

Comments

@paulrolfe
Copy link

Should they be capitalized, like:

let ThingThatIsUsedEverywhere = "The thing"
// or
let thingThatIsUsedEverywhere = "The thing"
// or
let THING_THAT_IS_USED_EVERYWHERE = "The thing"
@loganwright
Copy link

I think I like number 1, but there's something clear about YELLING_ALOT that I kind of like. Definitely not lowercase since we're not using self. where not required and they kind of look like instance variables.

@brightredchilli
Copy link

I vote for style 1 too! caps works well for scalar values i think but then when there are global objects then THAT_GLOBAL_FORMATTER(toString:date) would seem funny.

@paulrolfe
Copy link
Author

Should we say use the all caps for scalar values (i.e. Ints, Floats, Doubles, etc) and the CapitalizedFirstLetter way for anything else? I'm assuming this does not include global functions.

@loganwright
Copy link

I think if we're using all caps, that should also apply to strings in which case, what variable would not use all caps? @brightredchilli I think in terms of objects, it's probably best not to have them globally accessible and instead wrap them in an accessor the way we often do SomeThing.sharedInstance()

@vinnyt
Copy link

vinnyt commented Feb 3, 2016

1️⃣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants