AnsweredAssumed Answered

Re2: Global Variables

Question asked by VRFuser on Mar 25, 1998
At 09:26 25/03/98 -0800, you wrote:
>>      Brent,
>>      Both of the suggestions posted thus far require VEE 4.x.  Earlier
>>      versions of VEE do not have the find feature used by both methods.
>'tis true. This is one of the very useful innovations in VEE 4.
>> >
>> > In the program explorer, point to the variable, click the right mouse
>> > button, select 'references'
>> > Similair function is available for functions ('called by')
>>      The above method will only work for "realized" globals - variables
>>      which have been created during execution.  It will not find variables
>>      that have not yet been created by unexecuted code.
>Yep. However EDIT | FIND will work just fine on unexecuted code.
>Stan Bischof

>From my point of view, it is very difficult (maybe impossible) to work
complex applications without using global variables.

On the other hand and according to modern programming languages, data have
to be typed and managed only by the object what export them (that is,
Oriented Object Programming). But VEE is not Oriented to Objects but
Oriented to Functions, which it is not a great problem, from my point of view.

It is not a good practice that a variable could be modified in any part of
the application. Of course, the possibility of modifying a variable in any
part of the code is a more quick and powerful programming tool, but it is
also more insecure and difficult to control. That is, you can update your
data in any moment, but it is more difficult to control the time in which
some data are updated and used.

One additional feature related of this item is the possibility of declaring
global variables (feature implemented only from V4.x). In modern programming
languages it is strongly required to declare any variable previously it be
used. It is because these variables can be better controlled and could
include inheritance  properties from objects where they are declared (not
applicable to VEE).

In VEE V3.x it is very difficult to be able to know (if the application is
not documented) what User Object (UO) or User Function (UF) generate, update
or use one specific global variable. And due to that, programs in VEE 3.x
are not easy to maintain.

In VEE V4.x it easier by using the 'find' (icon) utility of main menu that
is one of the most important upgrades from the before VEE version.

However variables that are calculated (their name) programmatically and
updated are out of this point. One error (in run time: dinamic) in this
point cannot be obtained without running the code (static). It is difficult
to evaluate: you must to debugger and check continuously in order to see
which is the UO or UF that modify the not desired value.

>From my point of view, in order to reduce this kind of problems, it is
recommended to use local UO or UF and local to library global variables.
This is implemented from VEE 4.x.

At the end (I am sorry this heavy explanation), we use to modify the default
colour of the object that declare or modify ("Set" or "Assign", "Formula"
objects) a global variable in the detail view. In this way it is more easier
to follow what happen into a UO or UF code.


Juan Carlos Martin
E-mail     :
Phone      : 34-91-3963995
Fax     : 34-91-3963912
Earth Stations Department