Plain text that can be interpreted as instructions to perform a computational process
The simplest program is a single instruction:
print "Hello world!"
def hello
print 'Hello world!'
end
def hello
print 'Hello world!'
end
hello()
“…the whole history of computer science has seen the careful construction of layer upon layer of distancing abstractions upon the basic foundation of zeros and ones. Each time a programmer writes and executes a high-level program, these layers are stripped away one by one in elaborate translations from talk of, say, chat rooms, to talk of windows, to talk of matrices, to talk of variables, registers, and memory addresses too, finally, zeros and ones. As an abstraction, this translation is complete and flawless. (Colburn 16)
An algorithm is an abstract computational method that exists “apart from any programming language.” (Knuth)
A program is a representation and a concrete “embodiment” of an algorithm in a particular language (Knuth)
If it is a weekday, then:
If it is a weekday when this class meets, then:
Get up
For each cup in three cups of coffee:
Drink cup
Walk to campus
Walk to the building where this class meets
Walk to the classroom where this class meets
Else
Do something else
Else
Stay in bed
The word “computer” originally denoted a human occupation:
During the war, BRL [U.S. Army Ballistic Research Laboratory] recruited approximately two hundred women to work as computers, hand-calculating firing tables for rockets and artillery shells. (Light)
During and after WWII, the denotation of “computer” shifted to the electromechanical or electronic machine that automated and replaced that human occupation:
During World War II, a “computer” was a person who calculated artillery firing tables using a desk calculator. Six women “computers” were assigned to serve as ENIAC’s original programming group. Although most were college graduates, the “girls” were told that only “men” could get professional ratings. Finally, in November 1946, many of the women received professional ratings. (Moye)
ENIAC’s first application was to solve an important problem for the Manhatten [sic] Project. Involved were Nicholas Metropolis and Stanley Frankel from the Los Alamos National Laboratory, who worked with Eckert, Mauchly, and the women programmers. Captain (Dr.) Goldstine and his wife, Adele, taught Metropolis and Frankel how to program the machine, and the “girls” would come in and set the switches according to the prepared program. (Moye)
This is really the beginning of the history of what we now call “programming languages”:
By storing a program and data in a common high-speed memory, not only could programs be executed at electronic speeds; the programs could also be operated on as if they were data — the ancestor of today’s high-level languages compiled inside modern computers. (Ceruzzi)
Ceruzzi: the “stored program principle” was so influential that the referent of the word “computer” shifted once again. Now, it described electromechanical or electronic machines designed with a stored program architecture, rather than other designs:
The definition of computer thus changed, and to an extent it remains the one used today, with the criterion of programmability now extended to encompass the internal storage of that program in high-speed memory. (Ceruzzi)
EDSAC (University of Cambridge, 1949)
“Hello World” for EDSAC initial orders 1, from EDSAC Programming Tutorial:
T56F
ZF
TF
O43F
A34F
A41F
U34F
S42F
G33F
ZF
P1F O56F
*F HF EF LF LF OF
!F WF OF RF LF DF &F
…a special kind of program, later called a compiler, would take as its input instructions written in a form that was familiar to human programmers and easy to grasp, and its output would be another program, this one written in the arcane codes that the hardware was able to decode. (Ceruzzi)
#include<stdio.h>
main()
{
printf("Hello World");
}
hello.c
$ gcc -v hello.c
$ ./a.out
Hello world!
Eventually, the term “compiler” came to refer to a software program that performed that translation, while “programming language” came to refer to the particular code used by the programmer to write for the compiler
It was also around this time that these codes came to be called “languages,” because they shared many, though not all, characteristics with spoken languages. (Ceruzzi)
Compare the below with a more “direct” programming using EDSAC’s operation codes:
PRINT *, "Hello World!"
END
Conditional (if) statement that is true if value of a is larger than value of b:
IF A > B
IF EMPLOYEE-HOURS IS GREATER THAN MAXIMUM
EMPLOYEE-HOURS
) instead of simple letter symbols (A
, B
)GREATER THAN
, MAXIMUM
) rather than algebraic symbolsThis is the beginning of a certain confusion caused by the analogy between code and human language
In the years that followed, researchers explored the relationship between machine and human language, and while COBOL was a significant milestone, it gave the illusion that it understood English better than it really did. (Paul Ceruzzi, A History of Modern Computing)
The word “language” turned out to be a dangerous term, implying much more than its initial users foresaw. The English word is derived from the French langue, meaning tongue, implying that it is spoken. Whatever other parallels there may be with natural language, computer languages are not spoken but written, according to a rigidly defined and precise syntax. (Paul Ceruzzi, A History of Modern Computing)
Downey, Elkner & Meyers, “Formal and Natural Languages” (Downey)
Downey, Elkner & Meyers, “Formal and Natural Languages” (Downey)
Downey, Elkner & Meyers, “Formal and Natural Languages” (Downey)
Programming languages are formal languages that were “designed to express computations”