Terms You Should Already Understand

(from your introductory high level language course)

Hopefully this material is review for you. However, for those that didn't learn it the first time around, these are some important terms that you must understand. Note that memorization is not enough; if you do not understand these terms, then more advanced material will be inaccessible. They relate to high level language programming.

variable

In essence, a symbol standing in for an unknown quantity.

See this Wikipedia link. Also see the section within this article called "Scope and extent" to help you understand the term scope.

declaration

In essence, a declaration specifies a variable or function's type and the identifier that goes with it.

See this Wikipedia link. The first paragraph is the real definition that we are after for the purposes of this class.

instantiation

When a variable (or function) comes into being or exists in a running program.

scope, scoping rules

In essence, for a programming language, describes when and where something such as a variable can be seen (referred to).

See this Wikipedia link.

The GNU C Programming Tutorial has some good prose describing scope.

initialization

Giving a variable an initial value.

This may seem trivial, but the term is included in this list, as a students who learn Java as their first high level language do not often realize that an instantiation of a variable does not imply initialization.

In the C programming language, neither a declaration nor an instantiation imply that a variable has been or will be given an initial value. No initialization? The variable takes on the value of whatever the bits in memory are at the location where that variable resides.

compilation

A compiler is a program that translates high level language code into assembly language code. Compilation is the act of compiling.

run time, execution time

The time during which a program is being executed.

a binary, executable

The machine code for a program, usually in a file with a format specific to the operating system, such that the program could be executed.

invocation

In essence, to cause something to run (execute). A program can be invoked, as can a function. At run time, an invocation of a function is known as a function call, and it causes the function to be executed.

For Java programmers

The 3 separate concepts of declaration, instantiation, and initialization are generally rolled up into a single statement in Java programs. For example, the statement

    ObjectType  myObject = new ObjectType(12);
does all 3:
  1. The part in bold is the declaration. It names a variable called myObject, and it specifies the type as of the ObjectType class.
  2. For the executing program, the new operator instantiates the object.
  3. Given the instantiated object, the constructor is invoked, presumably initializing the data members of the object.

For all programmers

In a C program, Karen suggests that you separate the declaration from the initialization in order to cement the distinct nature of these concepts. So, the declaration of a local variable within a function is given in this example in bold, and the initialization is italicized.

  int myFunction() {
     int  count;   /* declaration */

    count = 12;    /* initialization */
  }

In addition, we rarely (never, in this class) want the scope of a local variable to be anything other than that of the invoked function, so we declare these local variables at the top of, but inside the function's definition.


Copyright © Karen Miller, 2011