[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: more info - performance with local procedures...



Global and local procedures have nothing to do with whether the procedure is
defined in an SQC or not.

Global procedures are procedures with no parameters.

Eg:  begin-procedure print-report
       ...
       ...
       end-procedure

Local procedures are procedures with parameters or procedures that are
dclared with the LOCAL keyword.

Eg:  begin-procedure Get-Setid ($setcntrl,$recname, :$setid)
       ...
      end-procedure

      begin-procedure my-local-procedure  LOCAL
      ...
     end-procedure

Local procedures promote encapsulation of your code which basically makes
your code structured!
Local procedures also promote reusability of variables and database table
aliases. You can use local variables without fear of them conflicting with
any global variables... (so you could have a global variable say, #counter
and also a local vraiable #counter and they are treated as two different
variables!)

Sam Rao


> -----Original Message-----
> From: Love, Kristin [SMTP:klove@MSA.COM]
> Sent: Monday, August 30, 1999 4:23 PM
> To:   Multiple recipients of list SQR-USERS
> Subject:      Re: more info - performance with local procedures...
>
> OK, I'm lost.
>
> I thought global meant that you would make an SQC file and then reuse it
> later.
>
> I thought local meant your procedure is only in your program.
>
> How does global "negate data abstraction". What is data abstraction?
>
> How could having an SQC already compiled and waiting reduce reusability?
>
> I'm relly not trying to be combative:  I'm totally confused now!
>
> :) Kristin
> I'm not a programmer, I just play one on TV
> > -----Original Message-----
> > From: Johnson, Dan [SMTP:Dan_Johnson@WRIGHTEXPRESS.COM]
> > Sent: Monday, August 30, 1999 5:12 PM
> > To:   Multiple recipients of list SQR-USERS
> > Subject:      Re: more info - performance with local procedures...
> >
> >         If I learned one thing in school it's this; GLOBAL IS BAD! I
> don't
> > dispute the possibility that global procedures may be a little bit
> slower
> > and that if you want to save a few seconds you should write global code
> > but
> > in the meantime you are breaking several rules of the structured
> > programming
> > approach. Here's why you don't want to use global procedures:
> > 1.      Negates data abstraction
> > 2.      Drastically Reduces reusability
> > 3.      Makes code less modular because of the above two problems
> > Sure SQR seems to promote the use of global procedures and variables but
> > it
> > is up to you, the anal retentive programmer, to take the path that leads
> > not
> > unto the land of evil globalness but instead take the road less
> traveled,
> > the road to the land of localness where all is pure and good. (boy, did
> > the
> > grammar check hate that sentence)
> >
> >