Josh McFarlane
darsant at gmail.com
Tue Jun 13 15:17:27 CDT 2006
Or design you project so you don't need a globally scoped variable. Makes maintaining so much easier when you need to make a change in the Foo section, and all you have to worry about is the Foo section, instead of worrying about how you change will affect the Bar and Foobar modules that are completely unrelated. On 6/12/06, DWUTKA at marlow.com <DWUTKA at marlow.com> wrote: > BINGO!!! Thanks Stuart! > > Using a Global variable when a procedural or module level is needed IS bad > practice. But when you need a Globally scoped variable, then you USE a > global variable! > > Drew > > -----Original Message----- > From: Stuart McLachlan [mailto:stuart at lexacorp.com.pg] > Sent: Monday, June 12, 2006 4:32 PM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Class Rebuttal was: Basic Unbound Form ... > > > On 12 Jun 2006 at 16:16, Heenan, Lambert wrote: > > > Sorry , can't agree with that either. Public variables are there so that > > code written for ancient systems, running languages that had only one kind > > of variable - public ones - can continue to be run. It's a backward > > compatibility feature. I know that may seem like a bold, overarching > > statement, but look at the history of programming languages. Why was the > > concept of 'local variables' dreamt up? Because having all global > variables > > was a nightmare The fact that lots people (myself included!) have a > tendency > > to cut corners and use them as a quick and dirty way to get data moving > from > > one module to another does not mean that it's a good idea. There's really > > no excuse for using a global, as rewriting the code to use local variables > > requires very little effort. > > > > I'm with Drew on this one. Just because you now have local variables, > doesn't mean that there is no place for globals. Sure, "all global > viariables was a nightmare" but we're not talking about "all global" here. > There are a still situations where a global is the simplest and best > solution. Why limit yourself to only using some of the tools in you > toolbag? > ... > > it's based on the idea that a global, by its very > > nature can be modified from almost anywhere at all in code, and that > makes > > for a debug/maintenance problem. > > > > It's poor design that makes the problem there, not globals. The same can be > said for any other alternative to a global such as Static Function, Class > Property etc. > > -- > Stuart > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- Darsant Silverstring "Peace cannot be kept by force. It can only be achieved by understanding." -Albert Einstein