Global Variable Naming
Opened this issue · 5 comments
Should they be capitalized, like:
let ThingThatIsUsedEverywhere = "The thing"
// or
let thingThatIsUsedEverywhere = "The thing"
// or
let THING_THAT_IS_USED_EVERYWHERE = "The thing"
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.
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.
Should we say use the all caps for scalar values (i.e. Int
s, Float
s, Double
s, etc) and the CapitalizedFirstLetter way for anything else? I'm assuming this does not include global functions.
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()
1️⃣