under construction




Data Objects

In structured and procedural programming languages such as Basic, Fortran and C, the emphasis in programming is on functions and subroutines which manipulate data. In Object Oriented Programming (OOP) languages such as Aurora, the emphasis is on data. In OOP languages, data is often referred to as 'Objects'.

Data which is information, can be stored in computer memory, retrieved, manipulated and deleted. Data is stored in computer memory, accessed and used by a computer program through the use of variables (in OOP these variables are also referred to as 'Object Members').

Variables

Data/information is stored in computer memory in such a way that it can be accessed and used. A variable can be thought of as a location or address to that storage location. A variable is an identifier which tells the computer where in memory to find a specific piece of information that is wanted. The variable is not the information itself.

The amount of memory required to store a specific piece of data (information) will depend on the type of information (data) stored. Some forms (types) of data are larger than others and some require special handling.

Variable names can be any identifier you choose as long as they follow some specific rules:

  1. Name may be up to 64 characters long
  2. Name may include alphabetic characters and numbers
  3. Name can have lower case and upper case letters (mixed)
  4. Name must not conflict with any other variable name - Aurora is not case sensitive when reading variable names
  5. Name must not conflict with any reserved word or constant
  6. Name must not begin with a number
  7. Name must not include any punctuation characters (except _ )
  8. Name must not include any operator characters

  9. Some acceptable names:

    n
    AnIntegerNumber
    Filename
    _SomeVariable2
    This_is_OK_2
    

    Some unacceptable names:

    N                  N conflicts with n above   
    -AnIntegerNumber   minus sign is an operator
    2Filenames         starts with the number 2
    (SomethingWrong    has a parenthesis in it
    


    Basic Variable Declarations

    To declare a variable in Aurora simply specify the data type followed by the variable name as follows:

    someDataType SomeVariableName;

    Once declared a variable can be assigned a value to store. In Aurora you can assign a value to a variable at the same time that the variable is declared. This is called an 'initialization' statement and it looks like this:

    someDataType SomeOtherVariableName = xxx;

    where xxx is a value that matches the data type of someDataType

    Constant Variables

    Variable are called variables primarily because the value of the data stored in memory can vary during program execution. There are times when it is desirable to have a variable which does not vary, but maintains the same value during program execution. Such variable are call Constants or Constant Variables. Constants can only be 'initialized' and can not be declared and assigned a value later. The initialization of a constant looks like this:

    CONST DataType aConstantVariable = xxx;

    where xxx is a value that matches the data type of DataType

    Variable Scope

    The concept of variable scope will only be introduced here and will be expanded upon in other areas such as the discussions on Classes and functions. Variable scope is a measure of how far a variable's influence can be felt in a program and how different parts of a program can in turn influence the variable. It is also described as whether different parts of a program can "see" the variable in question. In general, there are two types (or degrees) of scope: Global and Local.

    Most variables declared with the main part of a program are considered to be Global and are visible throughout the program and its functions (subroutines). Variables declared from within functions (subroutines) are generally not visible to other functions (subroutines) or the main body of the program.







    under construction







    top of page

    prev

    next