North Central College 2017 Game Camp

Introduction to Programming

A computer is a machine for carrying out instructions. The instructions that the computer carries out are called computer programs, or just programs. The human activity of creating computer programs is called computer programming, or just programming.

A computer program is a system of parts that work together to perform a task, just like an automobile is a system of parts (engine, exhaust system, instrument panel, transmission) that work together. In the most commonly used approach to programming, the various parts of the program are called objects.

An object in a computer program has two very important characteristics:

  1. The object has data members that describe its structure. These data members are called called properties, or sometimes, variables, because their value can change as the program is executing.
  2. The object has certain capabilities: that is the object knows how to carry out certain tasks. These capabilities are represented by lists of instructions, and are called methods.

Object Variables and Properties

To help you understand object variables and methods, think of yourself as an object. You have certain descriptive properties that can be described by values of numeric data types or even other data types. Here are some of your object variables

  1. height: this is a numeric value (given, say, in feet) that tells how tall you are. Maybe 5.6 or 6.0 or some other value. Notice this is variable because the value can change as you grow (assuming you are still growing).
  2. weight: another variable with a numeric value, given, say in pounds. This can change as you lose or gain weight.
  3. name: this is a variable whose value is what we call a character string type, or just a string. An example value might be "John Q. Public".

Object Methods

Still thinking of yourself as an object, what are some things for which you have instructions on how to do (tucked away in your brain, memory, subconscious, or whatever)? Well, you have methods for

  1. Eating
  2. Breathing
  3. Walking
  4. Playing basketball


Next