Main menu:

Site search

Categories

Archive

Global Variables

Have you ever wondered why you should never use global variables? I know why. I have known why for years. My team at work did not know why however, and this is the scenario we’ve run into:

“Of course, you’ll want to limit the use of global variables. Globals are very hard to keep track of, and you never know when another routine is using that value without careful tracking. This can cause a lot of wasted time and effort tracking down a bug that is related to the wrong data in the wrong variable at the wrong time.” [From MSDN Online]

Goodbye, hours of time that we can never have back. Goodbye, hours of time I could have been spending with Nicole. Goodbye.

Okay, we’re back on track. I have killed the appropriate team members and now it’s back to pushing this product to production.

Write a comment