Are Global Variables Really that bad ? (1 Viewer)

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 12:49
Joined
Feb 28, 2001
Messages
19,699
From Pat:
I get called in to clean up lots of messes.

For about the first 5 to 10 years of my stay with the U.S. Dept. of Defense, my biggest job was cleaning up other people's messes. Which is probably why both Pat and I use globals when needed, but with trepidation because of the dangers inherent. Solo, you will say that this is group-think or prejudice. I must respectfully - but emphatically - tell you that it is called experience.

In 40+ years of computing in private and public environment, I have learned a few things about the fine art of software engineering. You don't only code something to work - but you code it to work well and you code it to be re-usable because otherwise you are pitching dollars down the "wishing it would work" wishing well. It has been my experience that you must constrain the urge to globalize too many things.

Solo, your viewpoint as you express it is, I am sure, heartfelt and in your mind it must seem clear. To my way of seeing it, you are arguing in favor of practices that I have seen to be expensive (in the "time is money" sense of that term.)

You KNOW if you read my posts that I use globals - but only when carefully designed and limited in subject matter. Please understand that I am not saying to never use globals. But I am saying that they are like having feral cats as pets - they will do their business where you least expect it and stink up the place. Not to mention they will attack you when you least expect it. Whereas if you have a place for your globals, it's like a litter box, a place to contain the stink. OK, I use colorful metaphors sometimes, but it's the way I am.

One thing I will say that is important here is simply this: It's a poor tool kit that doesn't have very many tools in it. Globals are just one way to track things. Tempvars are another. And the problem with having too few tools in the kit? If all you have is a hammer, everything you've got gets nailed.
 

static

Registered User.
Local time
Today, 18:49
Joined
Nov 2, 2015
Messages
823
I've never used global variables in a database application. Why would you need a bunch of values sitting in memory when you can load them in, unless you're on a very poor network?

I don't think there's any excuse for unhandled errors, especially if you know you're going to release an MDE/ACCDE.
Trying to sell program crashes as a solution to poor coding is just silly.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 13:49
Joined
Feb 19, 2002
Messages
31,766
I would classify the loosing of global values on unhandled errors as a program bug. It has been present in Access for so long I'm sure that MS classifies it as a feature. Rather than fix the bug, they created TempVars!
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 12:49
Joined
Feb 28, 2001
Messages
19,699
Ah, yes. Microsoft learned that trick from Digital Equipment Corporation in the 1990s when DEC was still in business and MS had a teaming agreement with them.

"It's not a bug, it's a feature!" That was the mantra on DEC PDP-10, PDP-11, and VAX/VMS products - my wheelhouse as it were. Brings back old memories.
 

Users who are viewing this thread

Top Bottom