Is there an informal style guide on source code naming conventions in I7 for globals, local vars, activities, etc.?
I know I7 allows identifiers to have spaces, but what has been the overall consensus that has developed over the last few years? First letters capitalized? All lower case?
The common style guide is the examples in the manual.
I diverge from it somewhat. I use hyphenated terms rather than spaces between words, nearly always. (I’d rather write “kitchen-door” a lot than worry about internal collision between “kitchen”, “door”, and “kitchen door”. I7 usually gets that stuff right – I just choose not to rely on it.)
For local variables and function parameters, I always use upper-case single letters. (They stand out better.)
I also like to keep names as close as possible to one word unless I’m confident there will be no issues with a longer name.
The temporary variable names I use are often swears and when that gets old, I’ll try certain celebrities or fictional characters. This naming strategy is unhelpful even to me at times, but I see it as a kind of personal duty and unalienable right.
As for the subject in general, I think it’s more important to develop your own personal set of guidelines, as I7 is fairly lenient and you’ll ultimately be most comfortable that way. As long as it allows the stuff to compile and behave in runtime, that is.
I try to make everything read as close to natural English as possible, even in extensions.
and this. I’ve found that both make maintenance a more pleasant experience.
Thanks, all… That’s exactly what I was curious about.
I7’s ability for identifiers to have spaces is nifty in that it can make code look more like regular prose, but it can get confusing at times, playing find-the-variable. I’ve found myself falling back into using underscores and such, keeping variable names a single unit.
Appreciate the sharing of style habits.
I also aim for the natural language look as much as possible (unless I’m writing for performance and the I6 it entails), but if a long phrase is causing some find-the-var I’ll insert additional spaces on each side of the var to make it stand out a little.