From: Lyndon Samson Date: 2006-01-10T12:15:43+09:00 Subject: Re: global variables are bad?? ------=_Part_15097_9814468.1136862929803 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 1/10/06, David Vallner wrote: > > Lyndon Samson wrote: > > >On 1/9/06, John Maclean wrote: > > > > > >>Chaps, > >> > >>I'm not sure were I have read this but I recall a page or two saying > that > >>global variables are bad for some reason. I've overcome my main hurdle, > of > >>understanding some of the basics of OO. > >> > >> > > > > > >Interestingly it's allmost universally accepted that Global Variables ar= e > >bad ( in the same camp along with GOTO ), yet instance variables are jus= t > a > >more restrictive variation on the same theme, yet they are best practice > :-) > >Guess the functional guys hold the high ground here. > > > > > > > The main advantage of instance variables to global variables is that > they allow you to scope the variables down to -very- narrow contexts of > validity, and they can be hidden outside said scope. If that's what you > mean by "more restrictive variation", then scoping is the restriction > that matters. And giving context to relate global variables via naming > conventions sounds pretty painful. I guess what I was thinking was, conceivably you could have a class with sa= y 100s of methods, all with full access to any ( private/protected/public ) instance variables. How is that different to 100s of functions accessing global variables? David Vallner > > -- Into RFID? www.rfidnewsupdate.com Simple, fast, news. ------=_Part_15097_9814468.1136862929803--