Cofounded Host Collective (DiscountASP.net). Cofounded Player Axis (Social Gaming). Computer Scientist and Technology Evangelist with 20+ years of experience with JavaScript!
Global is difficult to define. The issue with globals is not that they are global, but that they have a shared mutable state. We should be switching from saying global variables are bad to shared mutable state is bad.
I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
I want to agree, but I've seen the result of this as well, such "single modifier" principles. You end up with a bunch of code that hides variables only to expose a set_x( value ) { x = value; } function -- missing the fact that it makes x a shared mutable variable.
Though I'd say the notion of ownership and control is important, and should be on a list of essential knowledge for programmers. Just like lifetime and visiblity, it plays a major role in where variables are defined.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Global is difficult to define. The issue with globals is not that they are global, but that they have a shared mutable state. We should be switching from saying global variables are bad to shared mutable state is bad.
I'd say "global" simply means "not namespaced or otherwise explicitly scoped".
When you look at it like that, they're untethered, untrustworthy and unnecessary.
I want to agree, but I've seen the result of this as well, such "single modifier" principles. You end up with a bunch of code that hides variables only to expose a
set_x( value ) { x = value; }
function -- missing the fact that it makesx
a shared mutable variable.Though I'd say the notion of ownership and control is important, and should be on a list of essential knowledge for programmers. Just like lifetime and visiblity, it plays a major role in where variables are defined.