Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #6920

Re: Export vs Protect and Access

From "Jamal" <someone@example.com>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: Export vs Protect and Access
Date 2014-05-28 11:13 -0400
Organization Aioe.org NNTP Server
Message-ID <lm4uf0$5n2$1@speranza.aioe.org> (permalink)
References <19d01048-056a-41f7-93f6-c11362766a35@googlegroups.com> <lm3ggc$n46$1@speranza.aioe.org> <mjsao9hr40r37jlfegd9pvbeth3niq40v2@4ax.com>

Show all headers | View raw


Karl,

I did not say there anything wrong with EXPORT variables!
To clarify: Access/Assign should only be used with other variables types 
other than EXPORT, like PROTECT. If a programmer needs ACCESS/ASSIGN to 
provide encapsulation and additional variable manipulation, that's fine.

EXPORT variables are extremely useful and can eliminate lots of generated 
code by the Windows Editor especially if windows controls need to accessed 
or assigned. That's why this feature was added to VO ( I think starting 
2.0).
For example: if you have 20 controls like SLEs, with EXPORT: you will have 
20 declaration in the class, however, with PROTECT variables, you will have 
20 declarations, 20 ACCESS methods and 20 ASSIGN methods.  This an overhead 
that is not needed that can really bloat the app when you have many windows.

Jamal

Regarding speed, I am going by what the help file says about "early bound".

"Karl Faller"  wrote in message 
news:mjsao9hr40r37jlfegd9pvbeth3niq40v2@4ax.com...

Jamal et all,
nothing wrong with Export. But it was a great achievement, to be able
to put Acc/ass in front of them - as you ever can do, if need arises.
Problem is, programmers are men, and men are lazy, so often they
rather add methods instead of changing from Export to A/A.
Just a sample: in one app i have a logic db-field, called Abo,
initially this only had to to hold, if some property was true or
false, UI-wise controlled by a checkbox .  Later on, i had to provide
background activity bound to this, so i used the A/A and what
initially was a
Assign Abo(uValue)
Return

changed to something like:
ASSIGN Abo( uValue )
LOCAL cSearch AS STRING
LOCAL lSet AS LOGIC
IF uValue
lSet:= TRUE
ELSE
lSet:= FALSE
ENDIF

cSearch:= SELF:BLOCK-PadL(AllTrim(SELF:REIHE), 2,
"0")-PadL(AllTrim(SELF:PLATZ), 2, "0")
IF SLen(AllTrim(cSearch)) =5
IF SELF:ConnectWithSeats(cSearch, lSet, SELF:PNo)
SELF:RLOCK()
SUPER:ABO:=uValue
SELF:Commit()
SELF:UnLock(SELF:RecNo)
IF SLen(AllTrim(SELF:RECMASTER)) > 0 IF lSet
LOCAL nRetVal AS WORD
nRetval:=JNoderPrompt("Kategorie " + SELF:KAT + " ok (Ja)",
"oder in Schüler- (Nein)  oder FreiAbo (Abbrechen) ändern?")
IF nRetVal = 2 // ändern SELF:RLOCK()
SELF:KAT:="3"
SELF:Commit()
SELF:unlock()
ELSEIF nRetVal = 3
SELF:RLOCK()
SELF:KAT:="0"
SELF:Commit()
SELF:unlock()
ENDIF
ENDIF
SELF:ReCalcAboSum(SELF:RECMASTER)
ENDIF
ENDIF
ELSE
Meldung("FEHLER!",  "Keine Platzdaten eingetragen!  " +  cSearch)
SELF:Skip(0)  wird
ENDIF
RETURN

Quite some functionality added, but UI-wise nothing changed at all!

BTW, i use this app myself, didn't notice any change speedwise...

Karl


>EXPORT variables will always be faster than access/assign since you do not
>have the overhead of extra method calls.
>I would only use access/assign if a block of code is needed to assign or
>return a value.
>
>INSTANCE variables are the slowest.
>
>From the help file:
>Since there is no need for a runtime lookup with early bound instance
>variables, using them instead of late bound variables will significantly
>improve the performance of your application.  The following table 
>summarizes
>the binding and visibility issues for the four types of instance variables:
>
>Variable Type Binding        Visibility
>
>EXPORT Early, if possible        Application-wide for CLASS and module-wide
>for STATIC CLASS
>
>INSTANCE Always late        In class and subclasses
>
>HIDDEN Always early        In class only
>
>PROTECT Always early        In class and subclasses
>
>HTH,
>Jamal
>
>
>"CMc"  wrote in message
>news:19d01048-056a-41f7-93f6-c11362766a35@googlegroups.com...
>
>Finally making the move from 2.7b to 2.8 and am getting a lot of
>"Access/Assign method has same name as Protected ivar" compiler errors that
>I need to clean up.  Can someone tell me what's the difference between:
>
>CLASS MyClass
>EXPORT cVar AS STRING
>
>and
>
>CLASS MyClass
>PROTECT _cVar AS STRING
>
>ACCESS cVar CLASS MyClass
>RETURN SELF:_cVar
>
>Is one more efficient, better for memory management, easier to port to
>Vulcan?  Other than coding style, why should I use one over the other?
>
>Thanks,
>Chris 

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Export vs Protect and Access CMc <cmccaul@ruddwisdom.com> - 2014-05-25 16:44 -0700
  Re: Export vs Protect and Access Farid <faridwatson@gmail.com> - 2014-05-25 20:41 -0700
    Re: Export vs Protect and Access CMc <cmccaul@ruddwisdom.com> - 2014-05-26 05:37 -0700
      Re: Export vs Protect and Access Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> - 2014-05-26 15:51 +0200
  Re: Export vs Protect and Access D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2014-05-26 10:17 +0200
    Re: Export vs Protect and Access "Marc Verkade [MITCon]" <marc@mitNOSPAMconDELETE.nl> - 2014-05-26 16:45 +0200
      Re: Export vs Protect and Access D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2014-05-26 17:27 +0200
        Re: Export vs Protect and Access "Marc Verkade [MITCon]" <marc@mitNOSPAMconDELETE.nl> - 2014-05-28 20:47 +0200
  Re: Export vs Protect and Access Massimo Bighelli <info@arcasistemi.it> - 2014-05-26 17:29 +0200
  Re: Export vs Protect and Access "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2014-05-26 22:36 +0200
  Re: Export vs Protect and Access "Jamal" <someone@example.com> - 2014-05-27 22:09 -0400
    Re: Export vs Protect and Access Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> - 2014-05-28 07:30 +0200
      Re: Export vs Protect and Access "Jamal" <someone@example.com> - 2014-05-28 11:13 -0400

csiph-web