BFOIT - Introduction to Computer Programming

Appendix A (Jargon)

-   S   -

source code
The text form of a computer program, the one that you type into a computer with an editor, is the program's source code. The source code is the human-readable representation of a computer program. There are many purposes for source code:

  1. It is often embedded in explanations, notes, educational materials, etc...; as a way for people to explain algorithms, ways in which to do things, to communicate unambiguously about how something is done.
  2. It is used to distribute computer programs. Since most executable versions of programs depend upon certain operating system/processor combos (e.g., Wintel which is Windows running on Intel), it is sometimes necessary to distribute programs via source code.
  3. It is the format of a program that's input to an interpreter or a compiler to execute or produce an executable form of a program (respectively).

As an example, in the BFOIT jLogo lessons, you enter source code into the TG applet and/or application.

The state of something is a detailed description of the thing at some point in time.  It's sort of like a bunch of adjectives and adverbs used to describe the thing and maybe what it is up to.

When we talk in detail about anything, the properties of the thing usually come up.  As an example, if we were talking about a balloon, we would probably talk about its color, its size, or whether it is inflated or not.  If it is inflated, we might say what it is filled with, e.g., air, water, hydrogen, or helium.

Now, think about representing a balloon in a computer program.  Most likely, we would represent the properties as variables in our program.  The contents of all of the variables needed for our balloon, at any point in time when the program is executing, is called the state of the balloon.

Imagine a program that models the behavior of a weather balloon.  At some point in time during the execution of our program, the variable isInflated would contain true.  Another variable, diameter, could contain 1.45, and a third, altitude, could be 32.6.  These values represent (make up) the state of the balloon - it is inflated, is 1.45 meters in diameter, and is 32.6 kilometers above earth's surface.

Wikipedia has a more detailed entry for state.

Strings in Java are objects. But, Java has features in it that make them appear to be primitive types, like ints. Specifically, Java has support for:

  1. String literals,
  2. the concatenation operator ("+"), and
  3. conversion of all other types into Strings in support of concatenation.

An example of the last feature is:

    int variable = 123;
    System.out.println( "variable contains: " + variable );
In this case, the contents of variable is converted from an integer into a String and then combined with "variable contains: " into a single String object which is passed as an argument to println( ).

In OOP (Object Oriented Programming) there is the idea of a family-like structure amoung classes.  When a class extends some other class it can be thought of as a child - parent relationship, with the new extended class, the subclass, being the child.  The class that was extended is referred to as the parent class, or the superclass.

All languages have rules that you need to follow in order to construct meaningful phrases, sentences, paragraphs, and so on. This set of rules, the ways the words and symbolic separators and terminators (commas, periods, question marks, etc...) are combined, is the syntax of the language.

The syntax of a programming language is very specific so that its interpreter or compiler can do exactly what the programmer wants.  Some languages have a simple syntax, others can be more complex.  jLogo is simple (a limited subset of the computer language Logo); it has a fairly simple syntax.  On the other hand, Java has a much more complex syntax.

Common syntax errors that you will probably make, regardless of which language you are using are:

  • Misspell keywords and names
  • Forget closing things, like a right square bracket in Logo and the right squiggly bracket in Java

Syntax errors unique to Java that are common include:

  • Mix the case of an identifier, e.g. define a field with a name "some_Data" and then type it in later in the class as "some_data"; "some_Data" and "some_data" are not the same! I used "D" and "d" on purpose in this example. But, what about "lst" versus "1st"? It is very easy to confuse the lower case L with the digit one.
  • Forget a statement separator - a semicolon (";")

Syntax errors are caught by the Logo interpreter and the Java compiler; so, a program that has syntax errors will never run.  Logo complains when it discovers a syntax error and ignores the command that's bad, and the rest of the commands on the line.  The Java compiler also complains when it discovers errors.  It will not generate the .class file as long as there are syntax errors. 

There are lots of little things you can do to help you keep from making syntax errors, mostly conventions that you adopt and then stick to, every time you write some source code.  An example is indenting parts of the source code so that things line up and/or stick out to show the structure of the program.

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.