Overview of Programming

Truth be told, computer programming is a complex activity and many people find it difficult. Programming involves many different aspects; all of which must be learned, more or less, at the same time. The purpose of this overview is to give you a general idea of the kinds of skills you must have in order to be a computer programmer.


Mastery of the Language

Perhaps the most obvious skill needed by a programmer is mastery of the programming language. In many respects, learning a programming language is similar to learning any other language. First you must learn the vocabulary of the language; the "words" from which sentences or statements are constructed.

Second you must learn the syntax of the language; the grammar rules that dictate how words and punctuation are used to form grammatically correct statements. Unlike most languages, computer languages require the strictest possible level of adherence to the syntax rules. A single misspelled word or punctuation error makes the entire statement unintelligible.

Finally, you must understand the semantics of the statements; what they mean. When executing a program, the computer does exactly what it is told to do; nothing more and nothing less. It is the job of the programmer to make sure that the program statements mean what he or she intended them to mean.

Life Cycle of a Program

The life cycle of a program consists of five phases: design, write, test, document, and maintain. In the design phase, you clarify the program specifications, determine how your program will be organized, and choose the appropriate data structures. The program specifications include

At first it may seem backwards to begin with the output requirements. However, you can't even begin to think about input and process until you understand what the output is to be. To use an example from the kitchen, you must know what it is you want to make before you look up the recipe to get the list of ingredients and the steps needed to transform those ingredients into a tasty dish.

Once the design is complete, you write and test the program. The preferred process is to write a portion of the program and then test it to make sure it works properly. Then, write a little more, and test the new code. This incremental process continues until the entire program has been written and tested.

In a beginning course, like this, students really never make it past these first three phases. However, in a more realistic environment, there are two more phases. In the documentation phase, documents like the reference manual and user's guide are written. During the maintenance phase, uncorrected errors are fixed and the program is enhanced with new or improved features.

The Programming Environment

The programming environment is comprised of the software tools used to write, compile, and test your computer programs. The simplest environment consists of a text editor and a compiler. The text editor is used to edit the source code; the program written in a high-level language (C++ or Java, for example). The source code is stored as an ordinary text file; usually with an extension that identifies the language in which it was written.

The compiler checks your program for syntax errors, and translates the source code into executable code that can be run on your computer. For most languages, the executable code consists of machine language instructions that can be executed directly by the central processing unit of your computer.

Often, a debugger is available to help find errors (bugs) in your program. The debugger allows you to execute instructions one at a time and provides access to your data allowing you to more easily track down and eliminate logic errors.

For most languages, there is also an integrated development environment (IDE) that includes all of these tools within a single program. In some ways, it is a little harder to learn how to use an IDE because it is more complex. However, once you have mastered the basics, an IDE actually simplifies the task of writing, compiling, and testing a program.

See More on the Quincy IDE

Simple Data Types

Simple data types are used to store a single value of a specific kind of data. Integer data types store a single integer value. Floating point data types store a single real number (i.e., a number with both an integer and fraction component). The character data type stores a single character (typically a letter, numeral, or punction symbol). A logical or boolean data type stores a single logical value (true or false).

See More on Simple Data Types

Data Structures and Classes

A data structure is used to organize a collection of data elements. For example, an array is used to store multiple values of the same type. A one-dimensional array is used to store a list of values and a two-dimensional array is used to store a table of values. Higher dimensional arrays are also possible. A structure is used to store multiple values which can be of different types.

See More on Data Structures

A class can be used to store multiple values which may be of the same type or of different types. However, classes can do far more than just store multiple values. They usually implement methods that manipulate the data as well.

Variables and Constants

A variable is a data element whose state can be observed and/or altered as the program executes. In general, the state of a variable consists of the values of its components (keeping in mind that a primitive data type has only one component). Each variable must be declared and initialized before it can be used. A variable declaration specifies the variable's data type and its name (identifier). A variable is initialized by assigning values to each of its components.

A constant is a data element whose state can be observed but not altered. A constant declaration specifies the constant's data type, identifier, and state. Following its declaration, the state of a constant cannot be altered. A literal constant is a specific value for a primitive data type. For example, the integer 324 and the character 'a' are literal constants.

See More on Data Declarations

Input and Output

A computer program must be able to obtain input from external devices such as the keyboard or a file. A program must also be able to send output to an external device such as the computer monitor, a printer, or a file. In C++, input and output are modeled as streams. One end of a stream is attached to our program and the other end is attached to an external device.

An input stream receives data from an external input device. Our program then extracts that data from the input stream. An output stream receives data from our program and sends it to an external output device. Our program inserts data into an output stream.

See More on Input and Output

Control Structures

Control structures determine the sequence in which program instructions are executed. In a sequential structure, instructions are executed in order; one after the other. In a selection structure, the program determines which block of code to execute next based on its current state. In a looping structure, the program repeatedly executes the same block of code.

See More on Control Structures


A function is a subprogram or module that performs a single clearly-defined task. A modular program is a program composed of a collection of inter-related functions. Modular programs lend themselves to team programming where different members of the team work on different subprograms. The head of the team brings all of the pieces together into the final program.

See More on Functions

Algorithm Development

One of the most challenging (and satisfying) aspects of computer programming is developing an algorithm (a sequence of steps) to perform a specific task. For example, given a list of floating point values, how does one go about sorting them? Or, given an integer value, how does one display that value with the proper grouping (e.g., commas every third digit)?