Published on October 11, 2011 by Aaron Saunders (Platform Evangelist)
The problem with this approach is that it will eventually come back to bite us; we will forget about the global variable, someone else won’t be aware of it and, consequently, they will create some other way to get the same information. Worst of all – it won’t always work.
Three notes we need to write on bright yellow stickies and attach to our monitor:
- We are going to write modular code (from now on, at least)
- Event-based programming is a good thing
- Global variables should be used only as a last resort