Article Preview
Buy Now
FEATURE
Gummy Globals
Globals variables are like gum in your hair
Issue: 10.2 (January/February 2012)
Author: Jens Bendig
Author Bio: Jens Bendig has been developing Software since 1982, and doing it as a professional since 1992 with C++, PHP, SQL, Real Studio, Processing, and whatever. He analyzes your code and helps to improve its quality.
Article Description: No description available.
Article Length (in bytes): 14,176
Starting Page Number: 35
Article Number: 10208
Resource File(s):
10208 project.zip Updated: 2012-01-04 13:55:01
Related Link(s): None
Excerpt of article text...
Good code is like a good haircut: it's clean, looks good, and is easy to maintain. But using global variables is like getting gum in your hair. The only way out is with scissors, and the end result is a completely different design.
We've known this for ages, but developers still try to ignore this fact. Maybe that's because global "gum" is so subtle—it gets in a little at a time and doesn't seem so bad at first, but eventually you have a sticky, unworkable mess.
Maybe it is just because developers—in the heat of coding—do not see other solutions for inter-object communication.
In this article I will
not show how to completely avoid global variables. I will instead show you how to make themsmarter ... smart enough to cause fewer problems.Why Not Use Global Variables?
Let me say it in a concise but abstract manner:
...End of Excerpt. Please purchase the magazine to read the full article.