HOME

TheInfoList




In
imperative programming In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Algori ...
, a computer program is a sequence of instructions in a
programming language A programming language is a formal language In logic, mathematics, computer science, and linguistics, a formal language consists of string (computer science), words whose symbol (formal), letters are taken from an alphabet (computer science) ...

programming language
that a
computer A computer is a machine that can be programmed to Execution (computing), carry out sequences of arithmetic or logical operations automatically. Modern computers can perform generic sets of operations known as Computer program, programs. These ...

computer
can execute or interpret. In
declarative programming In computer science, declarative programming is a programming paradigm—a style of building the structure and elements of computer programs—that expresses the logic of a computation without describing its control flow. Many languages that app ...
, a ''computer program'' is a set of instructions. A computer program in its human-readable form is called
source code In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and ...

source code
. Source code needs another computer program to execute because computers can only execute their native
machine instructions In computer programming, machine code, consisting of machine language instruction set, instructions, is a low-level programming language used to directly control a computer's central processing unit (CPU). Each instruction causes the CPU to perf ...
. Therefore, source code may be translated to machine instructions using the language's
compiler In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily ...

compiler
. (
Machine language In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, ...
programs are translated using an
assembler Assembler may refer to: Arts and media * Nobukazu Takemura Nobukazu Takemura (竹村延和 ''Takemura Nobukazu'') is a Japanese musician and artist. Born in Hirakata, Osaka in August 1968, he became interested in music at a young age by listenin ...

assembler
.) The resulting file is called an
executable In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and ...
. Alternatively, source code may execute within the language's interpreter. The programming language
Java Java ( id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 147.7 million people, Java is the world's List of ...
compiles into an
a intermediate form
a intermediate form
which is then executed by a Java interpreter. If the executable is requested for execution, then the
operating system An operating system (OS) is system software System software is software designed to provide a platform for other software. Examples of system software include operating systems (OS) like macOS, Linux, Android (operating system), Android and Mi ...

operating system
loads it into
memory Memory is the faculty of the by which or is , stored, and retrieved when needed. It is the retention of information over time for the purpose of influencing future action. If s could not be remembered, it would be impossible for language, r ...
and starts a
process A process is a series or set of activities that interact to produce a result; it may occur once-only or be recurrent or periodic. Things called a process include: Business and management *Business process A business process, business method or ...
. The
central processing unit A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuit 200px, A circuit built on a printed circuit board (PCB). An electronic circuit is composed of individual electroni ...

central processing unit
will soon
switch In , a switch is an that can disconnect or connect the conducting path in an , interrupting the or diverting it from one conductor to another. The most common type of switch is an electromechanical device consisting of one or more sets of movab ...
to this process so it can fetch, decode, and then execute each machine instruction. If the source code is requested for execution, then the operating system loads the corresponding interpreter into memory and starts a process. The interpreter then loads the source code into memory to translate and execute each statement. Running the source code is slower than running an executable. Moreover, the interpreter must be installed on the computer.


History


Analytical Engine

In 1837,
Charles Babbage Charles Babbage (; 26 December 1791 – 18 October 1871) was an English polymath A polymath ( el, πολυμαθής, , "having learned much"; la, homo universalis, "universal human") is an individual whose knowledge spans a subs ...

Charles Babbage
was inspired by Jacquard's loom to attempt to build the
Analytical Engine The Analytical Engine was a proposed mechanical general-purpose computer designed by English mathematician and computer pioneer Charles Babbage. It was first described in 1837 as the successor to Babbage's difference engine, which was a des ...
. The names of the components of the calculating device were borrowed from the textile industry. In the textile industry, yarn was brought from the store to be milled. The device had a "store" which was memory to hold 1,000 numbers of 40 decimal digits each. Numbers from the "store" were transferred to the "mill" for processing. It was programmed using two sets of perforated cards. One set to direct the operation and the other for the input variables. However, after more than 17,000 pounds of the British government's money, the thousands of cogged wheels and gears never fully worked together. During a nine-month period in 1842–43,
Ada Lovelace Augusta Ada King, Countess of Lovelace (''née'' Byron; 10 December 1815 – 27 November 1852) was an English mathematician and writer, chiefly known for her work on Charles Babbage's proposed mechanical general-purpose computer, the Analy ...

Ada Lovelace
translated the memoir of Italian mathematician
Luigi Menabrea Luigi Federico Menabrea (4 September 1809 – 24 May 1896), later made 1st Count Menabrea and 1st Marquess of Valdora, was an Italian general, statesman and mathematician who served as the Prime Minister of Italy from 1867 to 1869. Biography M ...
. The memoir covered the Analytical Engine. The translation contained Note G which completely detailed a method for calculating
Bernoulli number In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). ...
s using the Analytical Engine. This note is recognized by some historians as the world's first written computer program.


Universal Turing machine

In 1936,
Alan Turing Alan Mathison Turing (; 23 June 1912 – 7 June 1954) was an English mathematician A mathematician is someone who uses an extensive knowledge of mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such to ...

Alan Turing
introduced the
Universal Turing machine In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of , ...

Universal Turing machine
—a theoretical device that can model every computation that can be performed on a
Turing complete Alan Mathison Turing (; 23 June 1912 – 7 June 1954) was an English mathematician A mathematician is someone who uses an extensive knowledge of mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such to ...
computing machine. It is a
finite-state machine A finite-state machine (FSM) or finite-state automaton (FSA, plural: ''automata''), finite automaton, or simply a state machine, is a mathematical model of computation In computer science Computer science deals with the theoretical fou ...
that has an infinitely long read/write tape. The machine can move the tape back and forth, changing its contents as it performs an
algorithm In and , an algorithm () is a finite sequence of , computer-implementable instructions, typically to solve a class of problems or to perform a computation. Algorithms are always and are used as specifications for performing s, , , and other ...

algorithm
. The machine starts in the initial state, goes through a sequence of steps, and halts when it encounters the halt state.


Relay-based computers

The Z3 computer, invented by
Konrad Zuse Konrad Zuse (; 22 June 1910 – 18 December 1995) was a German civil engineer, pioneering computer scientist, inventor and businessman. His greatest achievement was the world's first programmable computer; the functional program-controlled ...

Konrad Zuse
(1941), was a digital and programmable computer. Zuse became aware of the "Babbage Engine" in 1939 while attempting to file a
German German(s) may refer to: Common uses * of or related to Germany * Germans, Germanic ethnic group, citizens of Germany or people of German ancestry * For citizens of Germany, see also German nationality law * German language The German la ...

German
patent. The ''Analytical Engine'' was
base-10 The decimal numeral system (also called the base-ten positional numeral system, and occasionally called denary or decanary) is the standard system for denoting integer and non-integer numbers. It is the extension to non-integer numbers of the Hi ...
— which was easy to comprehend. Zuse recognized that a
binary Binary may refer to: Science and technology Mathematics * Binary number In mathematics and digital electronics, a binary number is a number expressed in the base-2 numeral system or binary numeral system, which uses only two symbols: ty ...

binary
machine was easy to construct. are two-position switches — open or closed. The Z3 had approximately 2,600 relays: 1,800 for the memory, 600 for the arithmetic, and 200 for the
punch tape Five- and eight-hole punched paper tape Paper tape reader on the Harwell computer with a small piece of five-hole tape connected in a circle – creating a physical program loop Punched tape or perforated paper tape is a form of data storage ...

punch tape
reader, keyboard, and display. The circuits provided a
floating-point In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithm of an algorithm (Euclid's algorithm) for calculating the greatest com ...
, nine-instruction computer. Programming the Z3 was through a specially designed keyboard and punch tape. Manual input was through a calculator-style keyboard that accepted decimal numbers. The machine converted the input to binary and passed them through a series of calculating modules. The result was converted back to decimal and displayed on an output panel. Simultaneously developed was its successor — the Z4 computer. (An air-raid on April 6, 1945 destroyed the Z3.) In 1950, the Z4 was placed into production at the Federal Technical Institute in Zurich. It pioneered the short tenure of relay-based computers.


ENIAC

The (ENIAC) was built between July 1943 and Fall 1945. It was a
Turing complete Alan Mathison Turing (; 23 June 1912 – 7 June 1954) was an English mathematician A mathematician is someone who uses an extensive knowledge of mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such to ...
, general-purpose computer that used 17,468
vacuum tube A vacuum tube, electron tube, valve (British usage), or tube (North America), is a device that controls electric current flow in a high vacuum between electrodes to which an electric voltage, potential difference has been applied. The type kn ...
s to create the
circuitsCircuit may refer to: Science and technology Electrical engineering * Electrical circuit, a complete electrical network with a closed-loop giving a return path for current ** Analog circuit, uses continuous signal levels ** Balanced circuit, p ...

circuits
. At its core, it was a series of
Pascaline A Pascaline signed by Pascal in 1652 Top view and overview of the entire mechanism Pascal's calculator (also known as the arithmetic machine or Pascaline) is a mechanical calculator A mechanical calculator, or calculating machine, is a mechanic ...

Pascaline
s wired together. Its 40 units weighed 30 tons, occupied , and consumed $650 per hour () in electricity when idle. It had 20
base-10 The decimal numeral system (also called the base-ten positional numeral system, and occasionally called denary or decanary) is the standard system for denoting integer and non-integer numbers. It is the extension to non-integer numbers of the Hi ...
accumulators. Programming the ENIAC took up to two months. Three function tables were on wheels and needed to be rolled to fixed function panels. Function tables were connected to function panels using heavy black cables. Each function table had 728 rotating knobs. Programming the ENIAC also involved setting some of the 3,000 switches. Debugging a program took a week. It ran from 1947 until 1955 at
Aberdeen Proving Ground Aberdeen Proving Ground (APG) (sometimes erroneously called Aberdeen Proving ''Grounds'') is a United States Army, U.S. Army facility located adjacent to Aberdeen, Maryland, Aberdeen, Harford County, Maryland, Harford County, Maryland, United Stat ...
, calculating hydrogen bomb parameters, predicting weather patterns, and producing firing tables to aim artillery guns.


Stored-program computers

Instead of plugging in cords and turning switches, a
stored-program computer A stored-program computer is a computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern computers can perform generic sets of operations known as Computer pro ...
loads its instructions into memory just like it loads its data into memory. As a result, the computer could be programmed quickly and perform calculations at very fast speeds.
Presper Eckert John Adam Presper Eckert Jr. (April 9, 1919 – June 3, 1995) was an American electrical engineer and computer pioneer. With John Mauchly John William Mauchly (August 30, 1907 – January 8, 1980) was an American physicist A physicist ...
and
John Mauchly John William Mauchly (August 30, 1907 – January 8, 1980) was an American physicist A physicist is a scientist A scientist is a person who conducts Scientific method, scientific research to advance knowledge in an Branches of science, ...
built the ENIAC. The two engineers introduced the ''stored-program concept'' in a three-page memo dated February 1944. Later, in September 1944, began working on the ENIAC project. On June 30, 1945, von Neumann published the ''
First Draft of a Report on the EDVAC The ''First Draft of a Report on the EDVAC'' (commonly shortened to ''First Draft'') is an incomplete Incomplete may refer to: * Unfinished creative work * Gödel's incompleteness theorems, a specification of logic * Incomplete (Bad Religion song) ...
'' which equated the structures of the computer with the structures of the human brain. The design became known as the
von Neumann architecture The von Neumann architecture — also known as the von Neumann model or Princeton architecture — is a computer architecture In computer engineering Computer engineering (CoE or CpE) is a branch of engineering Engineering is ...

von Neumann architecture
. The architecture was simultaneously deployed in the constructions of the
EDVAC EDVAC (Electronic Discrete Variable Automatic Computer) was one of the earliest electronic Electronic may refer to: *Electronics Electronics comprises the physics, engineering, technology and applications that deal with the emission, flow and ...

EDVAC
and
EDSAC The Electronic delay storage automatic calculator (EDSAC) was an early British computer. Inspired by John von Neumann John von Neumann (; hu, Neumann János Lajos, ; December 28, 1903 – February 8, 1957) was a Hungarian America ...
computers in 1949. In 1961, the
Burroughs B5000Burroughs may refer to: * Former spelling of boroughs *Burroughs, Georgia, a historically African American community now a neighborhood of Savannah, Georgia * Burroughs Corporation, a maker of adding machines and computers * Burroughs (surname), peo ...
was built specifically to be programmed in the
Algol 60 ALGOL 60 (short for ''Algorithmic Language 1960'') is a member of the ALGOL Algol , designated Beta Persei (β Persei, abbreviated Beta Per, β Per), known colloquially as the Demon Star, is a bright multiple st ...
language. The hardware featured circuits to ease the phase. In 1964, the
IBM System/360 The IBM System/360 (S/360) is a family of mainframe computer A mainframe computer, informally called a mainframe or big iron, is a computer A computer is a machine that can be programmed to carry out sequences of arithmetic or ...
was a line of six computers each having the same
instruction set architecture In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of , ...
. The Model 30 was the smallest and least expensive. Customers could upgrade and retain the same
application software Application software (app for short) is computing software designed to carry out a specific task other than one relating to the operation of the computer itself, typically to be used by end-users. Examples of an application Application may refer ...
. The Model 75 was the most premium. Each System/360 model featured multiprogramming — having multiple
processes A process is a series or set of Action (philosophy), activities that interact to produce a result; it may occur once-only or be recurrent or periodic. Things called a process include: Business and management *Business process, activities that pro ...
in
memory Memory is the faculty of the brain A brain is an organ Organ may refer to: Biology * Organ (anatomy) An organ is a group of Tissue (biology), tissues with similar functions. Plant life and animal life rely on many organs that co-exis ...
at once. When one process was waiting for
input/output In computing, input/output (I/O, or informally io or IO) is the communication between an information processing system, such as a computer, and the outside world, possibly a human or another information processing system. Information, Inputs are ...
, another could compute. IBM planned for each model to be programmed using
PL/1 PL/I (Programming Language One, pronounced and sometimes written PL/1) is a procedural, imperative computer programming language A programming language is a formal language comprising a Instruction set architecture, set of instructions that ...
. A committee was formed that included
COBOL COBOL (; an acronym An acronym is a word In linguistics, a word of a spoken language can be defined as the smallest sequence of phonemes that can be uttered in isolation with semantic, objective or pragmatics, practical meaning (lingui ...

COBOL
,
Fortran Fortran (; formerly FORTRAN) is a general-purpose, compiled language, compiled imperative programming, imperative programming language that is especially suited to numerical analysis, numeric computation and computational science, scientific com ...

Fortran
and
ALGOL Algol , designated Beta Persei (β Persei, abbreviated Beta Per, β Per), known colloquially as the Demon Star, is a bright multiple star in the constellation A constellation is an area on the celestial s ...
programmers. The purpose was to develop a language that was comprehensive, easy to use, extendible, and would replace Cobol and Fortran. The result was a large and complex language that took a long time to . Computers manufactured until the 1970s had front-panel switches for manual programming. The computer program was written on paper for reference. An instruction was represented by a configuration of on/off settings. After setting the configuration, an execute button was pressed. This process was then repeated. Computer programs also were automatically inputted via
paper tape Five- and eight-hole punched paper tape file:Harwell-dekatron-witch-10.jpg, Paper tape reader on the Harwell computer with a small piece of five-hole tape connected in a circle – creating a physical program loop Punched tape or perforated pape ...

paper tape
or
punched cards A punched card (also punch cardSteven Pinker, in ''The Stuff of Thought'', Viking, 2007, p.362, notes the loss of ''-ed'' in pronunciation ''as it did in ice cream, mincemeat, and box set, formerly iced cream, minced meat, and boxed set.'' or p ...
. After the medium was loaded, the starting address was set via switches, and the execute button was pressed.


Programming languages

Computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, generating algorithms, Profilin ...
(also known as
software development Software development is the process of conceiving, specifying, designing, programming, documenting, testing, and bug fixing involved in creating and maintaining applications Application may refer to: Mathematics and computing * Application ...
and
software engineering Software engineering is the systematic application of engineering Engineering is the use of scientific principles to design and build machines, structures, and other items, including bridges, tunnels, roads, vehicles, and buildings. The d ...
) is the process of writing or editing
source code In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and ...

source code
. In a formal environment, a
systems analystA systems analyst, also known as business technology analyst, is an information technology (IT) professional who specializes in analyzing, designing and implementing information systems. Systems analysts assess the suitability of information system ...
will gather information from managers about all the business processes to automate. This professional then prepares a detailed plan for the new or modified system. The plan is analogous to an architect's blueprint. A
computer programmer A computer programmer, sometimes called a software developer, a programmer or more recently a coder (especially in more informal contexts), is a person who creates computer software Software is a collection of Instruction (computer science) ...
is a specialist responsible for writing or modifying the source code to implement the detailed plan. A
programming language A programming language is a formal language In logic, mathematics, computer science, and linguistics, a formal language consists of string (computer science), words whose symbol (formal), letters are taken from an alphabet (computer science) ...

programming language
is a set of keywords,
symbols A symbol is a mark, sign, or word In linguistics Linguistics is the scientific study of language A language is a structured system of communication used by humans, including speech (spoken language), gestures (Signed languag ...
,
identifiers An identifier is a name that identifies (that is, labels the identity of) either a unique object or a unique ''class'' of objects, where the "object" or class may be an idea, physical countable In mathematics Mathematics (from Greek: ) i ...
, and rules by which programmers can communicate instructions to the computer. They follow a set of rules called a
syntax In linguistics Linguistics is the scientific study of language, meaning that it is a comprehensive, systematic, objective, and precise study of language. Linguistics encompasses the analysis of every aspect of language, as well as the ...
. * ''Keywords'' are reserved words to form declarations and
statements Statement or statements may refer to: Common uses *Statement (computer science)In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to ...
. * ''Symbols'' are characters to form
operations Operation or Operations may refer to: Science and technology * Surgical operation Surgery ''cheirourgikē'' (composed of χείρ, "hand", and ἔργον, "work"), via la, chirurgiae, meaning "hand work". is a medical or dental specialty that ...
, assignments,
control flow In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Algor ...
, and delimiters. * ''Identifiers'' are words created by programmers to form constants, variable names, structure names, and . * ''Syntax Rules'' are defined in the
Backus–Naur form In computer science, Backus–Naur form or Backus normal form (BNF) is a metasyntax notation for context-free grammars, often used to describe the Syntax (programming languages), syntax of Formal language#Programming languages, languages used in c ...
. ''Programming languages'' get their basis from
formal languages In logic, mathematics, computer science, and linguistics, a formal language consists of string (computer science), words whose symbol (formal), letters are taken from an alphabet (computer science), alphabet and are well-formedness, well-formed a ...
. The purpose of defining a solution in terms of its ''formal language'' is to generate an
algorithm In and , an algorithm () is a finite sequence of , computer-implementable instructions, typically to solve a class of problems or to perform a computation. Algorithms are always and are used as specifications for performing s, , , and other ...

algorithm
to solve the underlining problem. An ''algorithm'' is a sequence of simple instructions that solve a problem.


Generation of programming languages

The evolution of programming languages began when the
EDSAC The Electronic delay storage automatic calculator (EDSAC) was an early British computer. Inspired by John von Neumann John von Neumann (; hu, Neumann János Lajos, ; December 28, 1903 – February 8, 1957) was a Hungarian America ...
(1949) used the first stored computer program in its
von Neumann architecture The von Neumann architecture — also known as the von Neumann model or Princeton architecture — is a computer architecture In computer engineering Computer engineering (CoE or CpE) is a branch of engineering Engineering is ...

von Neumann architecture
. Programming the EDSAC was in the first generation of programming languages. * The first generation of programming languages is
machine language In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, ...
. ''Machine language'' requires the programmer to enter instructions using ''instruction numbers'' called
machine code In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, ge ...
. For example, the ADD operation on the
PDP-11 The PDP-11 is a series of 16-bit 16-bit microcomputer A microcomputer is a small, relatively inexpensive computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically ...
has instruction number 24576. * The second generation of programming languages is
assembly language In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, gene ...
. ''Assembly language'' allows the programmer to use
mnemonic A mnemonic () device, or memory device, is any learning technique that aids information retention or retrieval (remembering) in the human memory Memory is the faculty of the by which or is , stored, and retrieved when needed. It is the ...
instructions instead of remembering instruction numbers. An
assembler Assembler may refer to: Arts and media * Nobukazu Takemura Nobukazu Takemura (竹村延和 ''Takemura Nobukazu'') is a Japanese musician and artist. Born in Hirakata, Osaka in August 1968, he became interested in music at a young age by listenin ...

assembler
translates each assembly language mnemonic into its machine language number. For example, on the PDP-11, the operation 24576 can be referenced as ADD in the source code. The four basic arithmetic operations have assembly instructions like ADD, SUB, MUL, and DIV. Computers also have instructions like DW (Define
Word In linguistics Linguistics is the scientific study of language A language is a structured system of communication used by humans, including speech (spoken language), gestures (Signed language, sign language) and writing. Most lang ...
) to reserve
memory Memory is the faculty of the by which or is , stored, and retrieved when needed. It is the retention of information over time for the purpose of influencing future action. If s could not be remembered, it would be impossible for language, r ...
cells. Then the MOV instruction can copy
integers An integer (from the Latin Latin (, or , ) is a classical language belonging to the Italic languages, Italic branch of the Indo-European languages. Latin was originally spoken in the area around Rome, known as Latium. Through the power of t ...
between registers and memory. :* The basic structure of an assembly language statement is label, operation, operand, and comment. ::* ''Labels'' allow the programmer to work with variable names. The assembler will later translate labels into physical memory addresses. ::* ''Operations'' allow the programmer to work with mnemonics. The assembler will later translate mnemonics into instruction numbers. ::* ''Operands'' tell the assembler which data the operation will process. ::* ''Comments'' allow the programmer to articulate a narrative because the instructions alone are vague. :: The key characteristic of an assembly language program is it forms a one-to-one mapping to its corresponding machine language target. * The third generation of programming languages use
compilers In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithm of an algorithm (Euclid's algorithm) for calculating the greatest com ...

compilers
and
interpreters Interpreting is a Translation studies, translational activity in which one produces a first and final translation on the basis of a one-time exposure to an expression in a Source language (translation), source language. The most common two modes ...
to execute computer programs. Unlike assembly language, these languages generate many machine language instructions for each symbolic statement. The distinguishing feature of ''third generation'' languages is their independence from a particular hardware. They began with the languages of
Fortran Fortran (; formerly FORTRAN) is a general-purpose, compiled language, compiled imperative programming, imperative programming language that is especially suited to numerical analysis, numeric computation and computational science, scientific com ...

Fortran
(1958),
COBOL COBOL (; an acronym An acronym is a word In linguistics, a word of a spoken language can be defined as the smallest sequence of phonemes that can be uttered in isolation with semantic, objective or pragmatics, practical meaning (lingui ...

COBOL
(1959),
ALGOL Algol , designated Beta Persei (β Persei, abbreviated Beta Per, β Per), known colloquially as the Demon Star, is a bright multiple star in the constellation A constellation is an area on the celestial s ...
(1960), and
BASIC BASIC (Beginners' All-purpose Symbolic Instruction Code) is a family of general-purpose, high-level programming language In computer science Computer science deals with the theoretical foundations of information, algorithms and the ar ...

BASIC
(1964). In 1973, C emerged as a high-level language that produced efficient machine language instructions. Today, an entire
paradigm In science Science () is a systematic enterprise that Scientific method, builds and organizes knowledge in the form of Testability, testable explanations and predictions about the universe."... modern science is a discovery as well as ...
of languages fill the
imperative Imperative may refer to: *Imperative mood, a grammatical mood (or mode) expressing commands, direct requests, and prohibitions *Imperative programming, a programming paradigm in computer science *Imperative logic *Imperative (film), ''Imperative'' ...
''third generation'' spectrum. * The fourth generation of programming languages emphasize what output results are desired, rather than how programming statements should be constructed. Declarative languages attempt to limit
side effects In medicine, a side effect is an effect, whether therapeutic or adverse, that is secondary to the one intended; although the term is predominantly employed to describe adverse effects, it can also apply to beneficial, but unintended, consequences ...
and allow programmers to write code with relatively few errors. One popular ''fourth generation'' language is called (SQL).
Database In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and sof ...

Database
developers no longer need to process each database record one at a time. Also, a simple instruction can generate output records without having to understand how it's retrieved. * The fifth generation of programming languages use visual tools to generate source code. An
integrated development environment An integrated development environment (IDE) is a software application Application software (app for short) is computing software designed to carry out a specific task other than one relating to the operation of the computer itself, typically ...
allows the programmer to draw the
graphical user interface The graphical user interface (GUI "UI" by itself is still usually pronounced . or ) is a form of user interface In the industrial design Industrial design is a process of design A design is a plan or specification for the construction ...
(GUI) on the screen using a
mouse A mouse, plural mice, is a small mammal Mammals (from Latin language, Latin , 'breast') are a group of vertebrate animals constituting the class (biology), class Mammalia (), and characterized by the presence of mammary glands which ...

mouse
. The programmer writes
event handling Event may refer to: Gatherings of people * Ceremony, an event of ritual significance, performed on a special occasion * Convention (meeting), a gathering of individuals engaged in some common interest * Event management, the organization of event ...
functions Function or functionality may refer to: Computing * Function key A function key is a key on a computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern comp ...

functions
that will be executed when
fields File:A NASA Delta IV Heavy rocket launches the Parker Solar Probe (29097299447).jpg, FIELDS heads into space in August 2018 as part of the ''Parker Solar Probe'' FIELDS is a science instrument on the ''Parker Solar Probe'' (PSP), designed to mea ...
are hovered over, entered into, or exited from. The development system couples the functions to the GUI and outputs a ''computer program''.


Imperative languages

''Imperative languages'' specify a sequential
algorithm In and , an algorithm () is a finite sequence of , computer-implementable instructions, typically to solve a class of problems or to perform a computation. Algorithms are always and are used as specifications for performing s, , , and other ...
using declarations, expressions, and statements: * A ''
declaration Declaration may refer to: Arts, entertainment, and media Literature * ''Declaration'' (book), a self-published electronic pamphlet by Michael Hardt and Antonio Negri * ''The Declaration'' (novel), a 2008 children's novel by Gemma Malley Music ...
'' introduces a variable name to the ''computer program'' and assigns it to a
datatype In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of c ...
– for example: var x: integer; * An '' expression'' yields a value – for example: 2 + 2 yields 4 * A ''
statement Statement or statements may refer to: Common uses *Statement (computer science), the smallest standalone element of an imperative programming language *Statement (logic), declarative sentence that is either true or false *Statement, a Sentence_(lin ...
'' might assign an expression to a variable or use the value of a variable to alter the program's
control flow In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Algor ...
– for example: x := 2 + 2; if x = 4 then do_something();


Fortran

FORTRAN Fortran (; formerly FORTRAN) is a general-purpose, compiled language, compiled imperative programming, imperative programming language that is especially suited to numerical analysis, numeric computation and computational science, scientific com ...

FORTRAN
(1958) was unveiled as "The IBM Mathematical FORmula TRANslating system." It first compiled correctly in 1958. It was designed for scientific calculations, without
string String or strings may refer to: *String (structure), a long flexible structure made from threads twisted together, which is used to tie, bind, or hang other objects Arts, entertainment, and media Films * Strings (1991 film), ''Strings'' (1991 fil ...
handling facilities. Along with ''declarations'', ''expressions'' and ''statements'', it supported: *
arrays ARRAY, also known as ARRAY Now, is an independent distribution company launched by film maker and former publicist Ava DuVernay Ava Marie DuVernay (; born August 24, 1972) is an American filmmaker. She won the directing award in the U.S. drama ...
. *
subroutines In computer programming, a subroutine is a sequence of Instruction (computer science), program instructions that performs a specific task, packaged as a unit. This unit can then be used in programs wherever that particular Task (computing), task sho ...
. * . It succeeded because: * programming and debugging costs were below computer running costs. * it was supported by IBM. * applications at the time were scientific. However, non IBM vendors also wrote Fortran compilers, but with a syntax that would likely fail IBM's compiler. The
American National Standards Institute The American National Standards Institute (ANSI ) is a private non-profit organization that oversees the development of Standardization, voluntary consensus standards for products, services, processes, systems, and personnel in the United Sta ...
(ANSI) developed the first Fortran standard in 1966. In 1978, Fortran 77 became the standard until 1991. Fortran 90 supports: *
records A record, recording or records may refer to: An item or collection of data Computing * Record (computer science) In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures ...
. *
pointers Pointer may refer to: Places * Pointer, Kentucky * Pointers, New Jersey * Pointers Airport, Wasco County, Oregon, United States * The Pointers, a pair of rocks off Antarctica People with the name * Pointer (surname), a surname (including a list of ...
to arrays.


COBOL

COBOL COBOL (; an acronym An acronym is a word In linguistics, a word of a spoken language can be defined as the smallest sequence of phonemes that can be uttered in isolation with semantic, objective or pragmatics, practical meaning (lingui ...

COBOL
(1959) stands for "COmmon Business Oriented Language." Fortran manipulated symbols. It was soon realized that symbols didn't need to be numbers, so strings were introduced. The
US Department of Defense The United States Department of Defense (DoD, USDOD or DOD) is an executive branch department of the federal government A federation (also known as a federal state) is a political entity characterized by a union of partially self-go ...
influenced COBOL's development, with
Grace Hopper Grace Brewster Murray Hopper ( December 9, 1906 – January 1, 1992) was an American computer scientist and United States Navy ), (unofficial)."''Non sibi sed patriae''" ( en, "Not for self but for country") (unofficial). , colors ...

Grace Hopper
being a major contributor. The statements were English-like and verbose. The goal was to design a language so managers could read the programs. However, the lack of structured statements hindered this goal. COBOL's development was tightly controlled, so dialects didn't emerge to require ANSI standards. As a consequence, it wasn't changed for 25 years until 1974. The 1990s version did make consequential changes like
object-oriented programming Object-oriented programming (OOP) is a programming paradigm Programming paradigms are a way to classify programming languages based on their features. Languages can be classified into multiple paradigms. Some paradigms are concerned mai ...
.


Algol

ALGOL Algol , designated Beta Persei (β Persei, abbreviated Beta Per, β Per), known colloquially as the Demon Star, is a bright multiple star in the constellation A constellation is an area on the celestial s ...
(1960) stands for "ALGOrithmic Language." It had a profound influence on programming language design. Emerging from a committee of European and American programming language experts, it used standard mathematical notation and had a readable structured design. Algol was first to define its
syntax In linguistics Linguistics is the scientific study of language, meaning that it is a comprehensive, systematic, objective, and precise study of language. Linguistics encompasses the analysis of every aspect of language, as well as the ...
using the
Backus–Naur form In computer science, Backus–Naur form or Backus normal form (BNF) is a metasyntax notation for context-free grammars, often used to describe the Syntax (programming languages), syntax of Formal language#Programming languages, languages used in c ...
. This led to syntax-directed compilers. It added features like: * block structure, where variables were local to their block. * arrays with variable bounds. * . *
functions Function or functionality may refer to: Computing * Function key A function key is a key on a computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern comp ...

functions
. *
recursion Recursion (adjective: ''recursive'') occurs when a thing is defined in terms of itself or of its type. Recursion is used in a variety of disciplines ranging from linguistics Linguistics is the scientific study of language, meaning tha ...
. Algol's direct descendants include
Pascal Pascal, Pascal's or PASCAL may refer to: People and fictional characters * Pascal (given name), including a list of people with the name * Pascal (surname), including a list of people and fictional characters with the name ** Blaise Pascal, French ...
,
Modula-2 Modula-2 is a structured, procedural programming language A programming language is a formal language In logic, mathematics, computer science, and linguistics, a formal language consists of string (computer science), words whose symbol ( ...
,
Ada Ada may refer to: Places Africa * Ada Foah Ada Foah is a town on the southeast coast of Ghana, where the Volta River meets the Atlantic Ocean. The town is located along the Volta River, off of the Accra-Aflao motorway. Known for Palm tree, pal ...
,
Delphi Delphi (; ), in legend previously called Pytho (Πυθώ), in ancient times was a sacred precinct that served as the seat of Pythia, the major oracle who was consulted about important decisions throughout the ancient classical world. The oracle ...
and
Oberon Oberon () is a king of the fairy, fairies in Middle ages, medieval and Renaissance literature. He is best known as a character in William Shakespeare's play ''A Midsummer Night's Dream'', in which he is King of the Fairies and spouse of Titania, ...
on one branch. On another branch there's C,
C++ C++ () is a general-purpose programming language In computer software, a general-purpose programming language is a programming language dedicated to a general-purpose, designed to be used for writing software in a wide variety of application ...

C++
and
Java Java ( id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 147.7 million people, Java is the world's List of ...
.


Basic

BASIC BASIC (Beginners' All-purpose Symbolic Instruction Code) is a family of general-purpose, high-level programming language In computer science Computer science deals with the theoretical foundations of information, algorithms and the ar ...

BASIC
(1964) stands for "Beginner's All Purpose Symbolic Instruction Code." It was developed at
Dartmouth College Dartmouth College ( ) is a private Private or privates may refer to: Music * "In Private "In Private" was the third single in a row to be a charting success for United Kingdom, British singer Dusty Springfield, after an absence of nearly t ...
for all of their students to learn. If a student didn't go on to a more powerful language, the student would still remember Basic. A Basic interpreter was installed in the
microcomputers A microcomputer is a small, relatively inexpensive computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern computers can perform generic sets of operations k ...
manufactured in the late 1970s. As the microcomputer industry grew, so did the language. Basic pioneered the interactive session. It offered
operating system An operating system (OS) is system software System software is software designed to provide a platform for other software. Examples of system software include operating systems (OS) like macOS, Linux, Android (operating system), Android and Mi ...

operating system
commands within its environment: * The 'new' command created an empty slate. * Statements evaluated immediately. * Statements could be programmed by preceding them with a line number. * The 'list' command displayed the program. * The 'run' command executed the program. However, the Basic syntax was too simple for large programs. Recent dialects have added structure and object-oriented extensions.
Visual Basic Visual Basic is a name for a family of programming languages from Microsoft. It may refer to: * Visual Basic (classic) The original Visual Basic (also referred to as Classic Visual Basic) is a third-generation programming language, third-gener ...
is still widely used and produces a
graphical user interface The graphical user interface (GUI "UI" by itself is still usually pronounced . or ) is a form of user interface In the industrial design Industrial design is a process of design A design is a plan or specification for the construction ...
.


C

C programming language (1973) got its name because the language
BCPL BCPL ("Basic Combined Programming Language") is a procedural, imperative Imperative may refer to: *Imperative mood, a grammatical mood (or mode) expressing commands, direct requests, and prohibitions *Imperative programming, a programming pa ...
was replaced with B, and
AT&T Bell Labs Nokia Bell Labs (formerly named Bell Labs Innovations (1996–2007), AT&T Bell Laboratories (1984–1996) and Bell Telephone Laboratories (1925–1984)) is an American industrial Research and development, research and scientific development S.A. ...
called the next version "C." Its purpose was to write the
UNIX Unix (; trademarked as UNIX) is a family of multitasking, multiuser Multi-user software is computer software Software is a collection of Instruction (computer science), instructions that tell a computer how to work. This is in contrast t ...

UNIX
operating system An operating system (OS) is system software System software is software designed to provide a platform for other software. Examples of system software include operating systems (OS) like macOS, Linux, Android (operating system), Android and Mi ...

operating system
. C is a relatively small language -- making it easy to write compilers. Its growth mirrored the hardware growth in the 1980s. Its growth also was because it has the facilities of
assembly language In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, gene ...
, but uses a high-level syntax. It added advanced features like: *
inline assemblerIn computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a specific task. Programming involves tasks such as: analysis, generatin ...
. * arithmetic on pointers. * pointers to functions. * bit operations. * freely combining complex operators. ''C'' allows the programmer to control which region of memory data is to be stored. ''Global variables'' and ''static variables'' require the fewest
clock cycles In electronics Electronics comprises the physics, engineering, technology and applications that deal with the emission, flow and control of electrons in vacuum and matter. It uses active devices to control electron flow by amplifier, amplificati ...

clock cycles
to store. The ''stack'' is automatically used for the standard variable declarations. ''Heap'' memory is returned to a ''pointer variable'' from the malloc() function. * The ''global and static data'' region is located just above the ''program'' region. (The program region is technically called the ''text'' region. It's where machine instructions are stored.) :* The global and static data region is technically two regions. One region is called the ''initialized
data segment In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and softwar ...
'' where variables declared with default values are stored. The other region is called the '' block started by segment'' where variables declared without default values are stored. :* Variables stored in the ''global and static data'' region have their addresses set at compile-time. They retain their values throughout the life of the process. :* The global and static region stores the ''global variables'' that are declared on top of (outside) the main() function. Global variables are visible to main() and every other function in the source code. : On the other hand, variable declarations inside of main(), other functions, or within block delimiters are ''local variables''. Local variables also include '' formal parameter variables''. Parameter variables are enclosed within the parenthesis of function definitions. They provide an
interface Interface or interfacing may refer to: Academic journals * Interface (journal), ''Interface'' (journal), by the Electrochemical Society * ''Interface, Journal of Applied Linguistics'', now merged with ''ITL International Journal of Applied Lin ...
to the function. :* ''Local variables'' declared using the static prefix are also stored in the ''global and static data'' region. Unlike global variables, static variables are only visible within the function or block. Static variables always retain their value. An example usage would be the function int increment_counter() * The '' stack'' region is a contiguous block of memory located near the top memory address. Variables placed in the stack, ironically, are populated from top to bottom. A
stack pointer In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Algor ...
is a special-purpose
register A register is an authoritative list of one kind of information. Register or registration may refer to: Arts entertainment, and media Music * Register (music), the relative "height" or range of a note, melody, part, instrument, etc. * ''Regis ...
that keeps track of the last memory address populated. Variables are placed into the stack via the ''assembly language'' PUSH instruction. Therefore, the addresses of these variables are set during runtime. The method for stack variables to lose their scope is via the POP instruction. :* ''Local variables'' declared without the static prefix, including formal parameter variables, are called ''automatic variables'' and are stored in the stack. They are visible inside the function or block and lose their scope upon exiting the function or block. * The ''heap'' region is located below the stack. It is populated from the bottom to the top. The
operating system An operating system (OS) is system software System software is software designed to provide a platform for other software. Examples of system software include operating systems (OS) like macOS, Linux, Android (operating system), Android and Mi ...

operating system
manages the heap using a ''heap pointer'' and a list of allocated memory blocks. Like the stack, the addresses of heap variables are set during runtime.
Out of memory Out of memory (OOM) is an often undesired state of computer operation where no additional memory can be allocated for use by programs or the operating system. Such a system will be unable to load any additional programs, and since many programs m ...
errors occur when the heap pointer and the stack pointer meet. :* ''C'' provides the malloc() library function to allocate heap memory. Populating the heap with data is an additional copy function. Variables stored in the heap are economically passed to functions using pointers. Without pointers, the entire block of data would need to be passed to the function via the stack.


C++

In the 1970s, software engineers needed language support to break large projects down into
modules Broadly speaking, modularity is the degree to which a system's components may be separated and recombined, often with the benefit of flexibility and variety in use. The concept of modularity is used primarily to reduce complexity by breaking a syst ...
. One obvious feature was to decompose large projects ''physically'' into separate
files File or filing may refer to: Mechanical tools and processes * File (tool), used to remove fine amounts of material from a workpiece **Filing (metalworking), a material removal process in manufacturing ** Nail file, a tool used to gently abrade aw ...
. A less obvious feature was to decompose large projects ''logically'' into abstract
datatypes In computer science and computer programming, a data type or simply type is an attribute of data which tells the compiler or Interpreter (computing), interpreter how the programmer intends to use the data. Most programming languages support basi ...
. At the time, languages supported concrete (
scalar Scalar may refer to: *Scalar (mathematics), an element of a field, which is used to define a vector space, usually the field of real numbers *Scalar (physics), a physical quantity that can be described by a single element of a number field such as ...
) datatypes like
integer An integer (from the Latin Latin (, or , ) is a classical language A classical language is a language A language is a structured system of communication Communication (from Latin ''communicare'', meaning "to share" or "to ...
numbers,
floating-point In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithm of an algorithm (Euclid's algorithm) for calculating the greatest com ...
numbers, and
strings String or strings may refer to: *String (structure), a long flexible structure made from threads twisted together, which is used to tie, bind, or hang other objects Arts, entertainment, and media Films * Strings (1991 film), ''Strings'' (1991 fil ...
of
characters Character(s) may refer to: Arts, entertainment, and media Literature * Character (novel), ''Character'' (novel), a 1936 Dutch novel by Ferdinand Bordewijk * Characters (Theophrastus), ''Characters'' (Theophrastus), a classical Greek set of char ...
. Concrete datatypes have their representation as part of their name. Abstract datatypes are
structures A structure is an arrangement and organization of interrelated elements in a material object or system A system is a group of Interaction, interacting or interrelated elements that act according to a set of rules to form a unified whole. A sy ...
of concrete datatypes — with a new name assigned. For example, a
list A ''list'' is any set of items. List or lists may also refer to: People * List (surname)List or Liste is a European surname. Notable people with the surname include: List * Friedrich List (1789–1846), German economist * Garrett List (194 ...
of integers could be called integer_list. In object-oriented jargon, abstract datatypes are called Class (computer programming), classes. However, a ''class'' is only a definition; no memory is allocated. When memory is allocated to a class, it's called an Object (computer science), object. ''Object-oriented programming, Object-oriented imperative languages'' developed by combining the need for classes and the need for safe functional programming. A function, in an object-oriented language, is assigned to a class. An assigned function is then referred to as a Method (computer programming), method, Method_(computer_programming)#Member_functions_in_C++, member function, or ''Operation (mathematics), operation''. ''Object-oriented programming'' is executing ''operations'' on ''objects''. ''Object-oriented languages'' support a syntax to model subset, subset/superset relationships. In set theory, an Element (mathematics), element of a subset inherits all the attributes contained in the superset. For example, a student is a person. Therefore, the set of students is a subset of the set of persons. As a result, students inherit all the attributes common to all persons. Additionally, students have unique attributes that other persons don't have. ''Object-oriented languages'' model ''subset/superset'' relationships using Inheritance (object-oriented programming), inheritance. ''Object-oriented programming'' became the dominant language paradigm by the late 1990s.
C++ C++ () is a general-purpose programming language In computer software, a general-purpose programming language is a programming language dedicated to a general-purpose, designed to be used for writing software in a wide variety of application ...

C++
(1985) was originally called "C with Classes." It was designed to expand C (programming language), C's capabilities by adding the object-oriented facilities of the language Simula. An object-oriented module is composed of two files. The definitions file is called the Include directive, header file. Here is a C++ ''header file'' for the ''GRADE class'' in a simple school application: // grade.h // ------- // Used to allow multiple source files to include // this header file without duplication errors. // ---------------------------------------------- #ifndef GRADE_H #define GRADE_H class GRADE ; #endif A Constructor (object-oriented programming), constructor operation is a function with the same name as the class name. It is executed when the calling operation executes the new statement. A module's other file is the ''source file''. Here is a C++ source file for the ''GRADE class'' in a simple school application: // grade.cpp // --------- #include "grade.h" GRADE::GRADE( const char letter ) int GRADE::grade_numeric( const char letter ) Here is a C++ ''header file'' for the ''PERSON class'' in a simple school application: // person.h // -------- #ifndef PERSON_H #define PERSON_H class PERSON ; #endif Here is a C++ ''source code'' for the ''PERSON class'' in a simple school application: // person.cpp // ---------- #include "person.h" PERSON::PERSON ( const char *name ) Here is a C++ ''header file'' for the ''STUDENT class'' in a simple school application: // student.h // --------- #ifndef STUDENT_H #define STUDENT_H #include "person.h" #include "grade.h" // A STUDENT is a subset of PERSON. // -------------------------------- class STUDENT : public PERSON; #endif Here is a C++ ''source code'' for the ''STUDENT class'' in a simple school application: // student.cpp // ----------- #include "student.h" #include "person.h" STUDENT::STUDENT ( const char *name ): // Execute the constructor of the PERSON superclass. // ------------------------------------------------- PERSON( name ) Here is a driver program for demonstration: // student_dvr.cpp // --------------- #include #include "student.h" int main( void ) Here is a makefile to compile everything: # makefile # -------- all: student_dvr clean: rm student_dvr *.o student_dvr: student_dvr.cpp grade.o student.o person.o c++ student_dvr.cpp grade.o student.o person.o -o student_dvr grade.o: grade.cpp grade.h c++ -c grade.cpp student.o: student.cpp student.h c++ -c student.cpp person.o: person.cpp person.h c++ -c person.cpp


Declarative languages

''Imperative languages'' have one major criticism: assigning an expression to a ''non-local'' variable may produce an unintended Side effect (computer science), side effect. Declarative languages generally omit the assignment statement and the control flow. They describe ''what'' computation should be performed and not ''how'' to compute it. Two broad categories of declarative languages are functional languages and Logic programming, logical languages. The principle behind a ''functional language'' is to use lambda calculus as a guide for a well defined Semantics (computer science), semantic. In mathematics, a function is a rule that maps elements from an ''expression'' to a range of ''values''. Consider the function: times_10(x) = 10 * x The ''expression'' 10 * x is mapped by the function times_10() to a range of ''values''. One ''value'' happens to be 20. This occurs when x is 2. So, the application of the function is mathematically written as: times_10(2) = 20 A ''functional language'' compiler will not store this value in a variable. Instead, it will ''push'' the value onto the computer's Call stack, stack before setting the Program counter, program counter back to the calling function. The calling function will then ''pop'' the value from the stack. ''Imperative languages'' do support functions. Therefore, ''functional programming'' can be achieved in an imperative language, if the programmer uses discipline. However, ''functional languages'' force this discipline onto the programmer through its syntax. Functional languages have a syntax tailored to emphasize the ''what''. A functional program is developed with a set of primitive functions followed by a single driver function. Consider the Snippet (programming), snippet: function max(a,b) function min(a,b) function difference_between_largest_and_smallest(a,b,c) The primitives are max() and min(). The driver function is difference_between_largest_and_smallest(). Executing: put(difference_between_largest_and_smallest(10,4,7)); will output 6. ''Functional languages'' are used in computer science research to explore new language features. Moreover, their lack of side-effects have made them popular in Parallel computing, parallel programming and Concurrent computing, concurrent programming. However, application developers prefer the object-oriented programming, object-oriented features of ''imperative languages''.


Lisp

Lisp (programming language), Lisp (1958) stands for "LISt Processor." It is tailored to process List (abstract data type), lists. A full structure of the data is formed by building lists of lists. In memory, a Tree (data structure), tree data structure is built. Internally, the tree structure lends nicely for Recursion (computer science), recursive functions. The syntax to build a tree is to enclose the space-separated Element (mathematics), elements within parenthesis. The following is a list of three elements. The first two elements are themselves lists of two elements: ((A B) (HELLO WORLD) 94) Lisp has functions to extract and reconstruct elements. The function head() returns a list containing the first element in the list. The function tail() returns a list containing everything but the first element. The function cons() returns a list that is the concatenation of other lists. Therefore, the following expression will return the list x: cons(head(x), tail(x)) One drawback of Lisp is when many functions are nested, the parentheses may look confusing. Modern Lisp Integrated development environment, environments help ensure parenthesis match. As an aside, Lisp does support the ''imperative language'' operations of the assignment statement and goto loops. Also, ''Lisp'' is not concerned with the data type, datatype of the elements at compile time. Instead, it assigns the datatypes at runtime. This may lead to programming errors not being detected early in the development process. Writing large, reliable, and readable Lisp programs requires forethought. If properly planned, the program may be much shorter than an equivalent ''imperative language'' program. ''Lisp'' is widely used in artificial intelligence. However, its usage has been accepted only because it has ''imperative language'' operations, making unintended side-effects possible.


ML

ML (programming language), ML (1973) stands for "Meta Language." ML checks to make sure only data of the same type are compared with one another. For example, this function has one input parameter (an integer) and returns an integer: fun times_10(n : int) : int = 10 * n; ''ML'' is not parenthesis-eccentric like ''Lisp''. The following is an application of times_10(): times_10 2 It returns "20 : int". (Both the results and the datatype are returned.) Like ''Lisp'', ''ML'' is tailored to process lists. Unlike ''Lisp'', each element is the same datatype.


Prolog

Prolog (1972) stands for "PROgramming in LOgic." It was designed to process natural languages. The building blocks of a Prolog program are ''Object (philosophy), objects'' and their ''relationships'' to other objects. ''Objects'' are built by stating true ''facts'' about them. Set (mathematics), Set theory ''facts'' are formed by assigning objects to sets. The syntax is setName(object). * Cat is an animal. : animal(cat). * Mouse is an animal. : animal(mouse). * Tom is a cat. : cat(tom). * Jerry is a mouse. : mouse(jerry). Adjective ''facts'' are formed using adjective(object). * Cat is big. : big(cat). * Mouse is small. : small(mouse). ''Relationships'' are formed using multiple items inside the parentheses. In our example we have verb(object,object) and verb(adjective,adjective). * Mouse eats cheese. : eat(mouse,cheese). * Big animals eat small animals. : eat(big,small). After all the facts and relationships are entered, then a question can be asked: : Will Tom eat Jerry? : ?- eat(tom,jerry). Prolog's usage has expanded to become a goal-oriented language. In a goal-oriented application, the goal is defined by providing a list of subgoals. Then each subgoal is defined by further providing a list of its subgoals, etc. If a path of subgoals fails to find a solution, then that subgoal is backtracking, backtracked and another path is systematically attempted. Practical applications include solving the shortest path problem and producing Family tree, family trees.


Program modules

Modular programming is a technique to refine ''imperative language'' programs. A ''program module'' is a sequence of statements that are bounded within a Block (programming), block and together identified by a name. Modules have a ''function'', ''context'', and ''logic'': * The ''function'' of a module is what it does. * The ''context'' of a module are the elements being performed upon. * The ''logic'' of a module is how it performs the function. The module's name should be derived first by its ''function'', then by its ''context''. Its ''logic'' should not be part of the name. For example, function compute_square_root( x ) or function compute_square_root_integer( i : integer ) are appropriate module names. However, function compute_square_root_by_division( x ) is not. The degree of interaction ''within'' a module is its level of Cohesion (computer science), cohesion. ''Cohesion'' is a judgement of the relationship between a module's name and its ''function''. The degree of interaction ''between'' modules is the level of Coupling (computer science), coupling. ''Coupling'' is a judgement of the relationship between a module's ''context'' and the elements being performed upon.


Cohesion

The levels of cohesion from worst to best are: * ''Coincidental Cohesion'': A module has coincidental cohesion if it performs multiple functions, and the functions are completely unrelated. For example, function read_sales_record_print_next_line_convert_to_float(). Coincidental cohesion occurs in practice if management enforces silly rules. For example, "Every module will have between 35 and 50 executable statements." * Logical Cohesion: A module has logical cohesion if it has available a series of functions, but only one of them is executed. For example, function perform_arithmetic( perform_addition ). * ''Temporal Cohesion'': A module has temporal cohesion if it performs functions related to time. One example, function initialize_variables_and_open_files(). Another example, stage_one(), stage_two(), ... * ''Procedural Cohesion'': A module has procedural cohesion if it performs multiple functions, but only loosely related. For example, function read_part_number_update_employee_record(). * ''Communicational Cohesion'': A module has communicational cohesion if it performs multiple functions, but closely related. For example, function read_part_number_update_sales_record(). * ''Informational Cohesion'': A module has informational cohesion if it performs multiple functions, but each function has its own entry and exit points. Moreover, the functions share the same data structure. Object-oriented classes work at this level. * ''Functional Cohesion'': a module has functional cohesion if it achieves a single goal working only on local variables. Moreover, it may be reusable in other contexts.


Coupling

The levels of coupling from worst to best are: * ''Content Coupling'': A module has content coupling if it modifies a local variable of another function. COBOL used to do this with the ''alter'' verb. * ''Common Coupling'': A module has common coupling if it modifies a global variable. * ''Control Coupling'': A module has control coupling if another module can modify its
control flow In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Algor ...
. For example, perform_arithmetic( perform_addition ). Instead, control should be on the makeup of the returned object. * ''Stamp Coupling'': A module has stamp coupling if an element of a data structure passed as a parameter is modified. Object-oriented classes work at this level. * '' Data Coupling'': A module has data coupling if all of its input parameters are needed and none of them are modified. Moreover, the result of the function is returned as a single object.


Data flow analysis

''Data flow analysis'' is a design method used to achieve modules of ''functional cohesion'' and ''data coupling''. The input to the method is a data-flow diagram. A data-flow diagram is a set of ovals representing modules. Each module's name is displayed inside its oval. Modules may be at the executable level or the function level. The diagram also has arrows connecting modules to each other. Arrows pointing into modules represent a set of inputs. Each module should have only one arrow pointing out from it to represent its single output object. (Optionally, an additional exception arrow points out.) A Daisy chain (electrical engineering), daisy chain of ovals will convey an entire
algorithm In and , an algorithm () is a finite sequence of , computer-implementable instructions, typically to solve a class of problems or to perform a computation. Algorithms are always and are used as specifications for performing s, , , and other ...

algorithm
. The input modules should start the diagram. The input modules should connect to the transform modules. The transform modules should connect to the output modules.


Object-oriented programming

Object-oriented programming need not be confined to an ''object-oriented language''. ''Object-oriented programming'' is executing ''operations'' on ''objects''. In object-oriented languages, classes are objects. In non-object-oriented languages, data structures (which are also known as
records A record, recording or records may refer to: An item or collection of data Computing * Record (computer science) In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures ...
) may also be objects. To turn a data structure into an object, operations need to be written specifically for the structure. The resulting structure is called an ''abstract datatype''. However, Inheritance (object-oriented programming), inheritance will be missing. Nonetheless, this shortcoming can be overcome. Here is a C programming language ''header file'' for the ''GRADE abstract datatype'' in a simple school application: /* grade.h */ /* ------- */ /* Used to allow multiple source files to include */ /* this header file without duplication errors. */ /* ---------------------------------------------- */ #ifndef GRADE_H #define GRADE_H typedef struct GRADE; /* Constructor */ /* ----------- */ GRADE *grade_new( char letter ); int grade_numeric( char letter ); #endif The grade_new() function performs the same algorithm as the C++ Constructor (object-oriented programming), constructor operation. Here is a C programming language source file for the ''GRADE abstract datatype'' in a simple school application: /* grade.c */ /* ------- */ #include "grade.h" GRADE *grade_new( char letter ) int grade_numeric( char letter ) In the constructor, the function calloc() is used instead of malloc() because each memory cell will be set to zero. Here is a C programming language ''header file'' for the ''PERSON abstract datatype'' in a simple school application: /* person.h */ /* -------- */ #ifndef PERSON_H #define PERSON_H typedef struct PERSON; /* Constructor */ /* ----------- */ PERSON *person_new( char *name ); #endif Here is a C programming language ''source code'' for the ''PERSON abstract datatype'' in a simple school application: /* person.c */ /* -------- */ #include "person.h" PERSON *person_new( char *name ) Here is a C programming language ''header file'' for the ''STUDENT abstract datatype'' in a simple school application: /* student.h */ /* --------- */ #ifndef STUDENT_H #define STUDENT_H #include "person.h" #include "grade.h" typedef struct STUDENT; /* Constructor */ /* ----------- */ STUDENT *student_new( char *name ); #endif Here is a C programming language ''source code'' for the ''STUDENT abstract datatype'' in a simple school application: /* student.c */ /* --------- */ #include "student.h" #include "person.h" STUDENT *student_new( char *name ) Here is a driver program for demonstration: /* student_dvr.c */ /* ------------- */ #include #include "student.h" int main( void ) Here is a makefile to compile everything: # makefile # -------- all: student_dvr clean: rm student_dvr *.o student_dvr: student_dvr.c grade.o student.o person.o gcc student_dvr.c grade.o student.o person.o -o student_dvr grade.o: grade.c grade.h gcc -c grade.c student.o: student.c student.h gcc -c student.c person.o: person.c person.h gcc -c person.c The formal strategy to build object-oriented objects is to: * Identify the objects. Most likely these will be nouns. * Identify each object's attributes. What helps to describe the object? * Identify each object's actions. Most likely these will be verbs. * Identify the relationships from object to object. Most likely these will be verbs. For example: * A person is a human identified by a name. * A grade is an achievement identified by a letter. * A student is a person who earns a grade.


Functional categories

Computer programs may be categorized along functional lines. The main functional categories are
application software Application software (app for short) is computing software designed to carry out a specific task other than one relating to the operation of the computer itself, typically to be used by end-users. Examples of an application Application may refer ...
and system software. System software includes the
operating system An operating system (OS) is system software System software is software designed to provide a platform for other software. Examples of system software include operating systems (OS) like macOS, Linux, Android (operating system), Android and Mi ...

operating system
which couples computer hardware with application software. The purpose of the operating system is to provide an environment where application software executes in a convenient and efficient manner. In addition to the operating system, system software includes Firmware, embedded programs, Booting, boot programs, and Microcode, micro programs. Application software designed for end users have a Interface (computing), user interface. Application software not designed for end users includes middleware, which couples one application with another. Both system software and application software execute Utility software, utility programs.


Application software

Application software is the key to unlocking the potential of the computer system. Enterprise software, Enterprise application software bundles accounting, personnel, customer, and vendor applications. Examples include enterprise resource planning, customer relationship management, and supply chain management software. Enterprise applications may be developed in-house as a one-of-a-kind proprietary software. Alternatively, they may be purchased as Commercial off-the-shelf, off-the-shelf software. Purchased software may be modified to provide custom software. If the application is customized, then either the company's resources are used or the resources are outsourced. Outsourced software development may be from the original software vendor or a third-party developer. The advantages of proprietary software are features and reports may be exact to specification. Management may also be involved in the development process and offer a level of control. Management may decide to counteract a competitor's new initiative or implement a customer or vendor requirement. A merger or acquisition will necessitate enterprise software changes. The disadvantages of proprietary software are the time and resource costs may be extensive. Furthermore, risks concerning features and performance may be looming. The advantages of off-the-shelf software are its identifiable upfront costs, the basic needs should be fulfilled, and its performance and reliability have a track record. The disadvantages of off-the-shelf software are it may have unnecessary features that confuse end users, it may lack features the enterprise needs, and the data flow may not match the enterprise's work processes. One approach to economically obtaining a customized enterprise application is through an Application service provider, application service provider. Specialty companies provide the hardware, custom software, and end-user support. They may speed development of new applications because they possess skilled information system staff. The biggest advantage is it frees in-house resources from staffing and managing complex computer projects. Many application service providers target small, fast-growing companies with limited information system resources. On the other hand, larger companies with major systems will likely have their technical infrastructure in place. One risk is having to trust an external organization with sensitive information. Another risk is having to trust the provider's infrastructure reliability.


Operating system

An
operating system An operating system (OS) is system software System software is software designed to provide a platform for other software. Examples of system software include operating systems (OS) like macOS, Linux, Android (operating system), Android and Mi ...

operating system
is the low-level software that supports a computer's basic functions, such as Scheduling (computing), scheduling tasks and controlling Peripheral, peripherals. In the 1950s, the programmer, who was also the operator, would write a program and run it. After the program finished executing, the output may have been printed, or it may have been punched onto paper tape or cards for later processing. More often than not the program did not work. The programmer then looked at the console lights and fiddled with the console switches. If less fortunate, a memory printout was made for further study. In the 1960s, programmers reduced the amount of wasted time by automating the operator's job. A program called an ''operating system'' was kept in the computer at all times. The term ''operating system'' may refer to two levels of software. The operating system may refer to the Kernel (operating system), kernel program that manages the
processes A process is a series or set of Action (philosophy), activities that interact to produce a result; it may occur once-only or be recurrent or periodic. Things called a process include: Business and management *Business process, activities that pro ...
, Computer memory, memory, and Peripheral, devices. More broadly, the operating system may refer to the entire package of the central software. The package includes a kernel program, Command-line interface, command-line interpreter, Graphical user interface, graphical user interface, Utility software, utility programs, and Text editor, editor. * The kernel program should perform Scheduling (computing), process scheduling. The kernel creates a process control block when a program is selected for execution. However, an executing program gets exclusive access to the
central processing unit A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuit 200px, A circuit built on a printed circuit board (PCB). An electronic circuit is composed of individual electroni ...

central processing unit
only for a Preemption (computing)#time slice, time slice. To provide each user with the illusion of exclusive access, the kernel Preemption (computing), preempts the process control block to execute another one. The goal for Systems programming, system developers is to minimize Latency (engineering), latency. * The kernel program should perform memory management. :* When the kernel initially loads an executable into memory, it divides the address space logically into Region-based memory management, regions. The kernel maintains a master-region table and many per-process-region (pregion) tables — one for each running process. These tables constitute the virtual address space. The master-region table is used to determine where its contents are located in Computer_data_storage#Primary_storage, physical memory. The pregion tables allow each process to have its own program (text) pregion, data pregion, and stack pregion. The program pregion stores machine instructions. Since the machine instructions won't change, the program pregion may be shared by many processes (instances) of the same executable. The kernel is responsible for translating virtual addresses into physical addresses. The kernel may request data from the memory controller and, instead, receive a page fault. If so, the kernel accesses the memory management unit to populate the physical data region and translate the address. :* To save time and memory, the kernel may load only blocks of execution instructions from the disk drive, not the entire execution file completely. :* The kernel allocates memory from the ''heap'' upon request by a process. When the process is finished with the memory, the process may request for it to be freed. If the process exits without requesting all allocated memory to be freed, then the kernel performs Garbage collection (computer science), garbage collection to free the memory. :* The kernel also insures that a process only accesses its own memory, and not that of the kernel or other processes. * The kernel program should perform File system, file system management. The kernel has instructions to create, retrieve, update, and delete files. * The kernel program should perform Peripheral, device management. The kernel provides programs to standardize and simplify the interface to the mouse, keyboard, disk drives, printers, and other devices. Moreover, the kernel should arbitrate access to a device if two processes requests it at the same time. * The kernel program should perform network management. The kernel transmits and receives Network packet, packets on behalf of processes. One key service is to find an efficient Routing table, route to the target system. * The kernel program should provide system calls, system level functions for programmers to use. ** Programmers access files through a relatively simple interface that in turn executes a relatively complicated low-level I/O interface. The low-level interface includes file creation, File descriptor, file descriptors, file seeking, physical reading, and physical writing. ** Programmers create processes through a relatively simple interface that in turn executes a relatively complicated low-level interface. ** Programmers perform date/time arithmetic through a relatively simple interface that in turn executes a relatively complicated low-level time interface. * The kernel program should provide a Inter-process communication, communication channel between executing processes. For a large software system, it may be desirable to Software engineering, engineer the system into smaller processes. Processes may communicate with one another by sending and receiving Signal (IPC), signals. Originally, operating systems were programmed in assembly language, assembly; however, modern operating systems are typically written in higher level languages like C,
C++ C++ () is a general-purpose programming language In computer software, a general-purpose programming language is a programming language dedicated to a general-purpose, designed to be used for writing software in a wide variety of application ...

C++
, Objective-C, and Swift (programming language), Swift.


Utility program

A Utility software, utility program is designed to aid system administration and software execution. Operating systems execute hardware utility programs to check the status of disk drives, memory, speakers, and printers. A utility program may optimize the placement of a file on a crowded disk. System utility programs monitor hardware and network performance. When a metric is outside an acceptable range, a trigger alert is generated. Utility programs include compression programs so data files are stored on less disk space. Compressed programs also save time when data files are transmitted over the network. Utility programs can sort and merge data sets. Utility programs detect Computer virus, computer viruses.


Boot program

A
stored-program computer A stored-program computer is a computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern computers can perform generic sets of operations known as Computer pro ...
requires an initial ''boot program'' stored in its read-only memory to booting, boot. It is to identify and initialize all aspects of the system, from processor registers to device driver, device controllers to volatile memory, memory contents. Following the initialization process, the boot program loads the
operating system An operating system (OS) is system software System software is software designed to provide a platform for other software. Examples of system software include operating systems (OS) like macOS, Linux, Android (operating system), Android and Mi ...

operating system
and sets the program counter to begin normal operations.


Embedded program

Independent of the host computer, a Peripheral, hardware device might have embedded firmware to control its operation. Firmware is used when the computer program is rarely or never expected to change, or when it must not be lost when the power is off. On a larger scale, an embedded microcontroller is used to control part of a larger system. Examples include aircraft components and life support systems. Applications running on these systems are large and complex. Moreover, they run in Real-time computing, real-time and must be Robustness (computer science), robust. The United States Department of Defense contracted with Groupe Bull, CII Honeywell Bull to develop
Ada Ada may refer to: Places Africa * Ada Foah Ada Foah is a town on the southeast coast of Ghana, where the Volta River meets the Atlantic Ocean. The town is located along the Volta River, off of the Accra-Aflao motorway. Known for Palm tree, pal ...
(1983) as a real-time programming language. Central to real-time systems is a Daemon (computing), task facility to permit Parallel computing, parallel processing. Also important are Interrupt, interrupt controls.


Microcode program

A Microcode, microcode program is the bottom-level interpreter that controls the Datapath, data path of software driven computers. (Advances in hardware have migrated these operations to hardware execution circuits.) Microcode instructions allow the programmer to more easily implement the Logic level, digital logic level—the computer's real hardware. The digital logic level is the boundary between computer science and computer engineering. A Field-effect transistor#Gate, gate is a tiny transistor that can return one of two signals: on or off. * Having one transistor forms the Inverter (logic gate), NOT gate. * Connecting two transistors in series forms the NAND gate. * Connecting two transistors in parallel forms the NOR gate. * Connecting a NOT gate to a NAND gate forms the AND gate. * Connecting a NOT gate to a NOR gate forms the OR gate. These five gates form the building blocks of Boolean algebra, binary algebra—the digital logic functions of the computer. Microcode instructions are Assembly language#Mnemonics, mnemonics programmers may use to execute digital logic functions instead of forming them in binary algebra. They are stored in a central processing unit, central processing unit's (CPU) Control store, control store. These hardware-level instructions move data throughout the Datapath, data path. Microcode instructions move data between a CPU's registers and throughout the Motherboard, motherboard. The micro-instruction cycle begins when the microsequencer uses its microprogram counter to ''fetch'' the next Machine code, machine instruction from random access memory. The next step is to ''decode'' the machine instruction by selecting the proper output line to the hardware module. The final step is to ''execute'' the instruction using the hardware module's set of gates. Instructions to perform arithmetic are passed through an arithmetic logic unit (ALU). The ALU has circuits to perform elementary operations to add, shift, and compare integers. By combining and looping the elementary operations through the ALU, the CPU performs its complex arithmetic. Microcode instructions move data between the CPU and the Memory controller, memory controller. Memory controller microcode instructions manipulate two registers. The Memory address register, memory address register is used to access each memory cell's address. The Memory buffer register, memory data register is used to set and read each cell's contents. Microcode instructions move data between the CPU and the many Bus (computing), computer buses. The Disk controller, disk controller bus writes to and reads from Hard disk drive, hard disk drives. Data is also moved between the CPU and other functional units via the PCI Express, peripheral component interconnect express bus.


See also

* * * * * * * * *


References


Further reading

* * * {{DEFAULTSORT:Computer Program Computer programming Software