BFOIT - Introduction to Computer Programming

Appendix A (Jargon)

-   I   -

identifier
An identifier is another word for the name of something.  In Logo, we give names to procedures and variables.  In Java we give names to classes, methods, and variables.

The rules for constructing identifiers are:

  • An identifier must start with a letter.
  • After the first letter, you may use any combination of letters and numbers.
  • In Java, the underscore character ("_"), and the dollar sign ("$") are also allowed after the first letter.
  • In Java, identifiers must not match any of the language's keywords
  • In Logo, identifiers must not match the names of the language's primitive procedures.

BIG GOTCHA: In Java, character case matters!  An uppercase 'A' is a different letter than a lowercase 'a'.  Java identifiers "anIdentifier" and "anidentifier" are NOT the same, each is a unique identifier.

indentation conventions
Programming is hard enough just by itself; the last thing you want to do is make it more difficult. Believe it or not, if you find that you really want to become a competent programmer, you will end up reading a lot more code than you write! This is the fastest way to figure out how to do something - see how someone else has done it. When I started to learn Java, one of the first books I bought was "Java Examples in a Nutshell," by David Flanagan. David's examples all follow a specific indentation convention which makes reading his code easier.

Indentation helps in two ways:

  1. Done consistently, it prevents you from forgeting a squiggly bracket. As I enter a class, method, or statement, I always type in the keywords and punctuation first and then fill in the stuff specific to what I'm writing at the time. Say you are going to start a new class called xyzzy, type the following before adding anything else
                    public class xyzzy
                    {
    
                    } // end class xyzzy
                    
    Then you are ready to start defining fields and methods. Each one is indented one level, whatever you prefer, as long as you are consistent. I like four character positions, but used two in this web booklet to cut down on the size of examples.

    When you add a method, type it in through its ending squiggly bracket before filling it in

                    public class xyzzy
                    {
                      public void swap_places()
                      {
    
                      }
    
                    } // end class xyzzy
                    
    And, as you add variable declarations and statements to your methods, indent them one more level and complete them too.
                    public class xyzzy
                    {
                      void swap_places()
                      {
                        if (  )
                        {
    
                        }
                      }
    
                    } // end class xyzzy
                    
  2. Indentation quickly conveys the structure of a program. When you see a snippet of code like:
                    for ( int i=1; i < tbl.length; i++ )
                    {
                      if ( tbl[i] > item )
                        item = tbl[i];
                      two_x = item * 2;
                    }
                    
    It is easy to see which statements make up the body of the for statement and what gets executed when the boolean expression is true in the if statement.  To see examples of indentations of Java statements, see Appendix F - Java Statements.

inheritance
One of the powerful features of OOP (Object Oriented Programming) is inheritance.  When a class extends some other class, it is thought of as a child of the parent class it extended.  The new class inherits everything that its parent has.  You get to take advantage of this feature as early as the lesson: Extending Existing Classes.

input
Input is the term used in Logo for parameters in procedure definitions.  Inputs are one kind of a thing called a variable.  Inputs allow procedures to do different things, what happens depends upon the value that a parameter is given when it is invoked.

As an example, the forward command is defined with an input for the number of steps to move.  When you invoke forward your instruction consists of the command name ("forward") followed by a number that is the actual amount to move.

instantiation
Instantiation simply means the process of creating an instance of something. In Java, you use the new operator to create an instance of an array or an object.  This is called instantiation.

instance variable
An instance variable is a field in a class that is defined without using the static modifier in its definition. Every time you create an object, an instance of the class, you get space allocated for all of the instance variables. Remember, this does not happen for class variables which are defined using the static modifier.

Instance variables must always be accessed using the syntax:

reference_variable_identifier.instance_variable_identifier

interpreter
An interpreter is a computer program which executes the source code of a program written in a computer programming language.  The execution is performed immediately, as the source code is input to the interpreter, often one line at a time.  Interpreters provide friendy programming environments because of their interactivity, making them excellent for exploring.

This is in contrast to a compiler which translates source code into a low-level language (often the native language of a microprocessor), without executing the result. The output of the compiler is then combined (linked) with machine-dependent stuff to create a program which then can be executed.  The advantage - execution speed, compiled programs run faster.

invocation/invoke
Invoke is a word used to refer to requesting execution of some Logo procedure or a Java method.  Procedure/method invocation transfers control from the point in your program where the invocation has been made to the procedure/method being invoked.  When the procedure/method finishes doing its stuff, execution comes back to just after where the invocation was made.

In other programming languages, like C and FORTRAN, the word "call" is similarly used to mean pretty much the same thing, e.g., a FORTRAN statement would "CALL" a subroutine.

I first covered procedure invocation in Logo in Lesson 4, Defining Your Own Commands.

iteration
Iteration is a process. Iteration means to repeat performing some set of instructions over and over again. Or, in other words: a repetitive process.  All programming languages have some mechanism for repeating stuff.

Logo has a repeat command that looks like:

    repeat <count> [ <instruction> ... ]
            
the interpreter knows that repeat means to execute the following list of instructions the specified count.

Java has two varieties, and one comes in two flavors.  One is a lot like Logo's "repeat" command; it's just a little bit more flexible.

    for ( <init-expr;> <boolean-expr;> <update-expr> )
           <statement>;
            

Java's simpler kind of iteration is:

    while ( <boolean-expr> )
           <statement>;
            

The basic concept is that a boolean expression controls execution of a statement - which can be, and most of the time is, a block-statement. Just like the if statement, the boolean expression determines whether we execute the statement or not. The difference is that once the statement has completed, we go back and evaluate the boolean expression again - if it is still true, we execute the statement again. This continues until the boolean expression evaluates to false.


Other jargon:  A   B   C   D   E   F  G H  I   J  K  L   M  N  O   P  Q  R   S   T  U  V   W  X Y Z

Back to HomePage

Public Domain Mark
This work (BFOIT: Introduction to Computer Programming, by Guy M. Haas),
identified by Berkeley Foundation for Opportunities in IT (BFOIT),
is free of known copyright restrictions.