Re: Globals In 4gl
Posted in 1998
Must be great to debug programs with massive globals definitions ( not ) ! I'm with you though. I have successfully programmed in 4GL for 7 years and have never, repeat, never used a global in any of my programs. This does not necessarily mean that I have always written my code efficiently to only ever cope with local or modular variables. One guy once told me ( an old C programmer ) that the variable stack is pushed and pulled alot more if globals are used ( as local and modular variables pile on them ) but I have never really checked this out ( it was a case of "Oh really ??" and that was that. I have seen globals used effectively in one app. that was written about 5 years ago ( passing static record structures from one program to the next ) but that was about it. Sorry I can't be more of a help but I also avoid them like somehting you would avoid at all costs !! Serrano In article <uZ8Q7vzs9GA.211@upnetnews03>, John Leipold <jleipold@msn.com> writes >The subject of "global" and "modular" data definitions being used in >Informix 4gl code came up the other day. > >The system I am currently working on uses globals as the defacto standard to >pass data from module to module / program to program. Most of the 4gi >programs use 15 to 20 complete global record definitions (DEFINE g_record >LIKE record.*) and a plethora of modular variables for lot's of different >things. >The use of variables with modular modular scope was also being discussed. >Their use in this particular system is worse than the use of abuse of >"globals" in the system. > >All of my experience prior to this contract has lead me to believe that the >fewer globals used the better. I felt that descrete functions without global >impact was the best design methodology. I pretty much have take this as >gospel and never strayed from the "true" path of functions with parameters >passed in and results returned. > >But other than "I've always done it that way" I don't have many specific >arguments against using massive global files. > >I think that arrays most certainly need to be global in scope and certain >variables are okay for modular scope (especially if these variables gain >dramatic performance increases in code) > >Of course I was slapped down pretty hard by the employees that created this >system and was told I didn't know what I was talking about. > >Any thoughts, one way or the other would be greatly appreciated. > >Thanks.... >John Leipold >Access Data Consulting Corp. > > > > --