Important Terms and Concepts
Whenever you take a course, or read a book, it's important to
identify the most important terms and concepts. Watch out for
words that the author (of a book) or instructor (of a course) uses over
and over; if you understand what the author or instructor means by those
words, you're well on the way to understanding the whole course. So
here's a preview of what I think are the most important terms and
concepts in this course. Note that these terms are used essentially the
same way in all programming languages and all programming
courses, so if you "get" them here, you have a head start on
other courses and other languages.
- Information
- In particular, information that's in a form the computer can
understand.
- Variable
- A "box" that can hold a single piece of information. Note
that the same box may hold different information at different times, but
it can always be referred to by the same name.
- Instance
- An individual object of a particular kind. For example,
Adelphi is an instance of University,
green is an instance of color, and 7 is an instance of
number.
- Function
- A process that takes in some information, does something to it,
and produces some new information.
In general, we're interested in
functions that can solve many different instances of the same problem,
depending on what information they are given.
For example,
"+" is a function that takes in two pieces of numeric
information and produces another number, their sum.
"1 + 1" and "3 + 4"
are two different instances of the same problem, "add two numbers".
The "+" function should work correctly
no matter what two numbers you apply it to.
- Definition
- The act of adding something new to the programming
language, so it can be used subsequently.
We'll define, at various times in the semester, three kinds of things:
new variables, new functions, and new data types.
- Parameter/Argument
- Two closely-related terms.
A parameter is a
"placeholder" variable which a function can use to refer to a piece
of information it was given. It appears only inside the
definition of the function.
An argument is a specific piece of information given to a function.
It appears only inside a use or call of the function.
They must match up: the first parameter in the definition will be
"filled in" with the first argument in the function call,
the second parameter with the second argument,
etc.
- Data type
- Any of the various kinds of information. For example, numbers,
names, colors, true/false values, coordinate pairs, student records,
lists, etc. are each data types.
Knowing what type of information a function takes in,
and what type of information it produces, is crucial to
defining the function.
- Contract (sometimes called a Signature)
- A "promise" about how a particular function can be used.
For example, the statement above that
"+" is a function that takes in two pieces of numeric
information and produces another number, their sum
is a contract for the "+" function.
A contract specifies the name of the function, how many
pieces of information of what types it depends on, and what
type of information it produces. Optionally, the contract may also
specify some relationship between the result and the input(s),
but it should not specify how the function achieves this goal.
Those are the big ones. I'm sure I'll think of a few more as the
semester goes on.