When using global proprieties you can either put them inside a global module or call them with app.myvariable…
Whats the best of two ? Whats the best coding practice ?
Thanks
When using global proprieties you can either put them inside a global module or call them with app.myvariable…
Whats the best of two ? Whats the best coding practice ?
Thanks
I put them inside a global module, but I refer to the module by name just for my own clarity.
Like so: Globals.isAwesome
I would use a module personally.
Personally the only code I ever put in APP is things that are called by the APP events… everything else especially if it has a Public/Global scope goes in a module or window, again depending on its maximum scope requirement.
[quote=121614:@Horacio Vilches]When using global proprieties you can either put them inside a global module or call them with app.myvariable…
Whats the best of two ? Whats the best coding practice ?
[/quote]
In fact an App variable is not really global, it is accessible from anywhere in the app as public with the prefix, just like windows properties.
I personally have a module for the very few global variables I use.
Just a general note, globals are a bad practice and should be used sparingly.
I good read, http://c2.com/cgi/wiki?GlobalVariablesAreBad
Not to say they shouldn’t be used, but used sparingly and in those cases really scrutinize the design to see if there is a better way.