Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview

Buy Now

Issue 10.2 ('Assumption Approach')
Instant purchase and download via GumRoad!


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):

Download Icon 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 them smarter... 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.