(1) To write the lines of code in a program.|
(2) A collection of instructions that tell the computer what to do. A program is generically known as "software" and the programs users work with, such as word processors and spreadsheets, are called "applications" or "application programs." Thus, the terms software, application, program and instruction are synonymous in the sense that they all tell the computer what to do.
A program is written in a programming language, such as C or C++, and the statements and commands written by the programmer are converted into the computer's machine language by software called "assemblers," "compilers" and "interpreters." The program contains machine instructions, buffers, constants and counters.
Instructions, Buffers, Constants and Counters
Machine instructions are the directions that the computer actually follows, and they embody the program's logic. Buffers are reserved space, or input/output areas, in the program that accept and hold the data while they are being processed.
Constants are fixed values used to compare the data against, such as minimums and maximums and dates. Menu titles and error messages are another type of constant. Counters, also called "variables," are reserved space for summing money amounts, quantities, virtually any calculations, including those necessary to keep track of internal operations, such as how many times a function should be repeated.
The program calls for data in an input-process-output sequence. After data has been input into one of the program's buffers from a peripheral device (keyboard, disk, etc.), it is processed. The results are then output to a peripheral device (screen, printer, etc.). If data has been updated, it is output back onto the disk.
The Application Talks to the OS
The application program, which does the actual data processing, does not instruct the computer to do everything. When it is ready for input or needs to output data, it sends a request to the operating system (OS), which performs those services and then turns control back to the application program.
The Illustration Below
Following is a conceptual illustration of a program residing in memory. In the physical reality of memory, everything would be binary (0s and 1s).
Although represented as tiny, black blocks below, machine instructions can be variable in length, and they reside in the program in some logical order. Noted as arrows below, some of the instructions would point back to the beginning of a routine or to other parts of the program.
For an understanding of what the computer does to process data, look up computer and read about The 3 C's (calculate, compare and copy).
A program is made up of machine instructions, buffers, constants and counters. The program's logic is embedded within the instructional sequence.