HOME

TheInfoList



OR:

A computer program is a sequence or set of instructions in a
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
for a
computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations ( computation) automatically. Modern digital electronic computers can perform generic sets of operations known as programs. These prog ...
to execute. Computer programs are one component of
software Software is a set of computer programs and associated documentation and data. This is in contrast to hardware, from which the system is built and which actually performs the work. At the lowest programming level, executable code consist ...
, which also includes
documentation Documentation is any communicable material that is used to describe, explain or instruct regarding some attributes of an object, system or procedure, such as its parts, assembly, installation, maintenance and use. As a form of knowledge manageme ...
and other intangible components. A computer program in its human-readable form is called
source code In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the ...
. Source code needs another computer program to execute because computers can only execute their native machine instructions. Therefore, source code may be translated to machine instructions using the language's
compiler In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs tha ...
. (
Assembly language In computer programming, assembly language (or assembler language, or symbolic machine code), often referred to simply as Assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence b ...
programs are translated using an assembler.) The resulting file is called an
executable In computing, executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, causes a computer "to perform indicated tasks according to encoded instructions", as opposed to a data fil ...
. Alternatively, source code may execute within the language's interpreter. If the executable is requested for execution, then the
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
loads it into
memory Memory is the faculty of the mind by which data or information is encoded, stored, and retrieved when needed. It is the retention of information over time for the purpose of influencing future action. If past events could not be remember ...
and starts a process. The
central processing unit A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuitry that executes instructions comprising a computer program. The CPU performs basic arithmetic, logic, controlling, a ...
will soon switch 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.


Example computer program

The "Hello, World!" program is used to illustrate a language's basic
syntax In linguistics, syntax () is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure ( constituenc ...
. The syntax of the language BASIC (1964) was intentionally limited to make the language easy to learn. For example, variables are not declared before being used. Also, variables are automatically initialized to zero. Here is an example computer program, in Basic, to
average In ordinary language, an average is a single number taken as representative of a list of numbers, usually the sum of the numbers divided by how many numbers are in the list (the arithmetic mean). For example, the average of the numbers 2, 3, 4, 7 ...
a list of numbers: 10 INPUT "How many numbers to average?", A 20 FOR I = 1 TO A 30 INPUT "Enter number:", B 40 LET C = C + B 50 NEXT I 60 LET D = C/A 70 PRINT "The average is", D 80 END Once the mechanics of basic computer programming are learned, more sophisticated and powerful languages are available to build large computer systems.


History

Improvements in
software development Software development is the process of conceiving, specifying, designing, programming, documenting, testing, and bug fixing involved in creating and maintaining applications, frameworks, or other software components. Software development invo ...
are the result of improvements in
computer hardware Computer hardware includes the physical parts of a computer, such as the case, central processing unit (CPU), random access memory (RAM), monitor, mouse, keyboard, computer data storage, graphics card, sound card, speakers and motherboard. ...
. At each stage in hardware's history, the task of
computer programming Computer programming is the process of performing a particular computation (or more generally, accomplishing a specific computing result), usually by designing and building an executable computer program. Programming involves tasks such as anal ...
changed dramatically.


Analytical Engine

In 1837,
Charles Babbage Charles Babbage (; 26 December 1791 – 18 October 1871) was an English polymath. A mathematician, philosopher, inventor and mechanical engineer, Babbage originated the concept of a digital programmable computer. Babbage is considered ...
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 desig ...
. 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 consisted of memory to hold 1,000 numbers of 50 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 directed the operation and the other set inputted the 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. Ada Lovelace worked for Charles Babbage to create a description of the Analytical Engine (1843). The description contained Note G which completely detailed a method for calculating Bernoulli numbers using the Analytical Engine. This note is recognized by some historians as the world's first computer program.


Universal Turing machine

In 1936,
Alan Turing Alan Mathison Turing (; 23 June 1912 – 7 June 1954) was an English mathematician, computer scientist, logician, cryptanalyst, philosopher, and theoretical biologist. Turing was highly influential in the development of theoretical ...
introduced the Universal Turing machine, a theoretical device that can model every computation. It is a finite-state machine 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 mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing ...
. The machine starts in the initial state, goes through a sequence of steps, and halts when it encounters the halt state. All present-day computers are
Turing complete Alan Mathison Turing (; 23 June 1912 – 7 June 1954) was an English mathematician, computer scientist, logician, cryptanalyst, philosopher, and theoretical biologist. Turing was highly influential in the development of theoretical ...
.


ENIAC

The Electronic Numerical Integrator And Computer (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, computer scientist, logician, cryptanalyst, philosopher, and theoretical biologist. Turing was highly influential in the development of theoretical ...
, 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 potential difference has been applied. The type known as ...
s to create the circuits. At its core, it was a series of Pascalines wired together. Its 40 units weighed 30 tons, occupied , and consumed $650 per hour ( in 1940s currency) in electricity when idle. It had 20 base-10 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 by plugging heavy black cables into plugboards. 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, 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 that stores program instructions in electronically or optically accessible memory. This contrasts with systems that stored the program instructions with plugboards or similar mechanisms. The definition ...
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 and John Mauchly built the ENIAC. The two engineers introduced the ''stored-program concept'' in a three-page memo dated February 1944. Later, in September 1944, Dr. John von Neumann began working on the ENIAC project. On June 30, 1945, von Neumann published the '' First Draft of a Report on the EDVAC'' 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 based on a 1945 description by John von Neumann, and by others, in the '' First Draft of a Report on the EDVAC''. T ...
. The architecture was simultaneously deployed in the constructions of the EDVAC and
EDSAC The Electronic Delay Storage Automatic Calculator (EDSAC) was an early British computer. Inspired by John von Neumann's seminal '' First Draft of a Report on the EDVAC'', the machine was constructed by Maurice Wilkes and his team at the Univer ...
computers in 1949. The
IBM System/360 The IBM System/360 (S/360) is a family of mainframe computer systems that was announced by IBM on April 7, 1964, and delivered between 1965 and 1978. It was the first family of computers designed to cover both commercial and scientific applic ...
(1964) was a line of six computers, each having the same
instruction set architecture In computer science, an instruction set architecture (ISA), also called computer architecture, is an abstract model of a computer. A device that executes instructions described by that ISA, such as a central processing unit (CPU), is called an ...
. The Model 30 was the smallest and least expensive. Customers could upgrade and retain the same
application software Application may refer to: Mathematics and computing * Application software, computer software designed to help the user to perform specific tasks ** Application layer, an abstraction layer that specifies protocols and interface methods used in a ...
. The Model 75 was the most premium. Each System/360 model featured multiprogramming—having multiple
processes 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, activities that produce a specific se ...
in
memory Memory is the faculty of the mind by which data or information is encoded, stored, and retrieved when needed. It is the retention of information over time for the purpose of influencing future action. If past events could not be remember ...
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. Inputs are the signals ...
, another could compute. IBM planned for each model to be programmed using PL/1. A committee was formed that included
COBOL COBOL (; an acronym for "common business-oriented language") is a compiled English-like computer programming language designed for business use. It is an imperative, procedural and, since 2002, object-oriented language. COBOL is primarily u ...
, Fortran and ALGOL 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
compile In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs th ...
. 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 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 ...
or punched cards. After the medium was loaded, the starting address was set via switches, and the execute button was pressed.


Very Large Scale Integration

A major milestone in software development was the invention of the Very Large Scale Integration (VLSI) circuit (1964). Following
World War II World War II or the Second World War, often abbreviated as WWII or WW2, was a world war that lasted from 1939 to 1945. It involved the World War II by country, vast majority of the world's countries—including all of the great power ...
, tube-based technology was replaced with point-contact transistors (1947) and bipolar junction transistors (late 1950s) mounted on a circuit board. During the 1960s, the
aerospace Aerospace is a term used to collectively refer to the atmosphere and outer space. Aerospace activity is very diverse, with a multitude of commercial, industrial and military applications. Aerospace engineering consists of aeronautics and ast ...
industry replaced the circuit board with an integrated circuit chip. Robert Noyce, co-founder of
Fairchild Semiconductor Fairchild Semiconductor International, Inc. was an American semiconductor company based in San Jose, California. Founded in 1957 as a division of Fairchild Camera and Instrument, it became a pioneer in the manufacturing of transistors and of int ...
(1957) and
Intel Intel Corporation is an American multinational corporation and technology company headquartered in Santa Clara, California. It is the world's largest semiconductor chip manufacturer by revenue, and is one of the developers of the x86 ser ...
(1968), achieved a technological improvement to refine the production of
field-effect transistor The field-effect transistor (FET) is a type of transistor that uses an electric field to control the flow of current in a semiconductor. FETs (JFETs or MOSFETs) are devices with three terminals: ''source'', ''gate'', and ''drain''. FETs co ...
s (1963). The goal is to alter the electrical resistivity and conductivity of a
semiconductor junction A semiconductor is a material which has an electrical conductivity value falling between that of a conductor, such as copper, and an insulator, such as glass. Its resistivity falls as its temperature rises; metals behave in the opposite way. ...
. First, naturally occurring
silicate minerals Silicate minerals are rock-forming minerals made up of silicate groups. They are the largest and most important class of minerals and make up approximately 90 percent of Earth's crust. In mineralogy, silica (silicon dioxide, ) is usually con ...
are converted into
polysilicon Polycrystalline silicon, or multicrystalline silicon, also called polysilicon, poly-Si, or mc-Si, is a high purity, polycrystalline form of silicon, used as a raw material by the solar photovoltaic and electronics industry. Polysilicon is produce ...
rods using the
Siemens process Chemical vapor deposition (CVD) is a vacuum deposition method used to produce high quality, and high-performance, solid materials. The process is often used in the semiconductor industry to produce thin films. In typical CVD, the wafer (substr ...
. The Czochralski process then converts the rods into a monocrystalline silicon, boule crystal. The
crystal A crystal or crystalline solid is a solid material whose constituents (such as atoms, molecules, or ions) are arranged in a highly ordered microscopic structure, forming a crystal lattice that extends in all directions. In addition, macro ...
is then thinly sliced to form a wafer substrate. The planar process of photolithography then ''integrates'' unipolar transistors,
capacitor A capacitor is a device that stores electrical energy in an electric field by virtue of accumulating electric charges on two close surfaces insulated from each other. It is a passive electronic component with two terminals. The effect of ...
s,
diode A diode is a two-terminal electronic component that conducts current primarily in one direction (asymmetric conductance); it has low (ideally zero) resistance in one direction, and high (ideally infinite) resistance in the other. A diod ...
s, and
resistor A resistor is a passive two-terminal electrical component that implements electrical resistance as a circuit element. In electronic circuits, resistors are used to reduce current flow, adjust signal levels, to divide voltages, bias active e ...
s onto the wafer to build a matrix of metal–oxide–semiconductor (MOS) transistors. The MOS transistor is the primary component in ''integrated circuit chips''. Originally, integrated circuit chips had their function set during manufacturing. During the 1960s, controlling the electrical flow migrated to programming a
matrix Matrix most commonly refers to: * ''The Matrix'' (franchise), an American media franchise ** '' The Matrix'', a 1999 science-fiction action film ** "The Matrix", a fictional setting, a virtual reality environment, within ''The Matrix'' (franchi ...
of
read-only memory Read-only memory (ROM) is a type of non-volatile memory used in computers and other electronic devices. Data stored in ROM cannot be electronically modified after the manufacture of the memory device. Read-only memory is useful for storing ...
(ROM). The matrix resembled a two-dimensional array of fuses. The process to embed instructions onto the matrix was to burn out the unneeded connections. There were so many connections,
firmware In computing, firmware is a specific class of computer software that provides the low-level control for a device's specific hardware. Firmware, such as the BIOS of a personal computer, may contain basic functions of a device, and may provide h ...
programmers wrote a ''computer program'' on another chip to oversee the burning. The technology became known as Programmable ROM. In 1971, Intel installed the computer program onto the chip and named it the Intel 4004
microprocessor A microprocessor is a computer processor where the data processing logic and control is included on a single integrated circuit, or a small number of integrated circuits. The microprocessor contains the arithmetic, logic, and control circ ...
. The terms ''microprocessor'' and
central processing unit A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuitry that executes instructions comprising a computer program. The CPU performs basic arithmetic, logic, controlling, a ...
(CPU) are now used interchangeably. However, CPUs predate microprocessors. For example, the
IBM System/360 The IBM System/360 (S/360) is a family of mainframe computer systems that was announced by IBM on April 7, 1964, and delivered between 1965 and 1978. It was the first family of computers designed to cover both commercial and scientific applic ...
(1964) had a CPU made from circuit boards containing discrete components on ceramic substrates.


Sac State 8008

The Intel 4004 (1971) was a 4- bit microprocessor designed to run the
Busicom was a Japanese company that manufactured and sold computer-related products headquartered in Taito, Tokyo. It owned the rights to Intel's first microprocessor, the Intel 4004, which they created in partnership with Intel in 1970. Busicom ask ...
calculator. Five months after its release, Intel released the Intel 8008, an 8-bit microprocessor. Bill Pentz led a team at
Sacramento State California State University, Sacramento (CSUS, Sacramento State, or informally Sac State) is a public university in Sacramento, California. Founded in 1947 as Sacramento State College, it is the eleventh oldest school in the 23-campus California ...
to build the first
microcomputer A microcomputer is a small, relatively inexpensive computer having a central processing unit (CPU) made out of a microprocessor. The computer also includes memory and input/output (I/O) circuitry together mounted on a printed circuit board (PC ...
using the Intel 8008: the ''Sac State 8008'' (1972). Its purpose was to store patient medical records. The computer supported a disk operating system to run a Memorex, 3-
megabyte The megabyte is a multiple of the unit byte for digital information. Its recommended unit symbol is MB. The unit prefix ''mega'' is a multiplier of (106) in the International System of Units (SI). Therefore, one megabyte is one million bytes o ...
,
hard disk drive A hard disk drive (HDD), hard disk, hard drive, or fixed disk is an electro-mechanical data storage device that stores and retrieves digital data using magnetic storage with one or more rigid rapidly rotating platters coated with mag ...
. It had a color display and keyboard that was packaged in a single console. The disk operating system was programmed using IBM's Basic Assembly Language (BAL). The medical records application was programmed using a BASIC interpreter. However, the computer was an evolutionary dead-end because it was extremely expensive. Also, it was built at a public university lab for a specific purpose. Nonetheless, the project contributed to the development of the Intel 8080 (1974)
instruction set In computer science, an instruction set architecture (ISA), also called computer architecture, is an abstract model of a computer. A device that executes instructions described by that ISA, such as a central processing unit (CPU), is called an ...
.


x86 series

In 1978, the modern software development environment began when Intel upgraded the Intel 8080 to the Intel 8086. Intel simplified the Intel 8086 to manufacture the cheaper Intel 8088. IBM embraced the Intel 8088 when they entered the
personal computer A personal computer (PC) is a multi-purpose microcomputer whose size, capabilities, and price make it feasible for individual use. Personal computers are intended to be operated directly by an end user, rather than by a computer expert or te ...
market (1981). As
consumer A consumer is a person or a group who intends to order, or uses purchased goods, products, or services primarily for personal, social, family, household and similar needs, who is not directly related to entrepreneurial or business activities. ...
demand for personal computers increased, so did Intel's microprocessor development. The succession of development is known as the x86 series. The x86 assembly language is a family of backward-compatible machine instructions. Machine instructions created in earlier microprocessors were retained throughout microprocessor upgrades. This enabled consumers to purchase new computers without having to purchase new
application software Application may refer to: Mathematics and computing * Application software, computer software designed to help the user to perform specific tasks ** Application layer, an abstraction layer that specifies protocols and interface methods used in a ...
. The major categories of instructions are: * Memory instructions to set and access numbers and strings in
random-access memory Random-access memory (RAM; ) is a form of computer memory that can be read and changed in any order, typically used to store working data and machine code. A random-access memory device allows data items to be read or written in almost the ...
. * Integer
arithmetic logic unit In computing, an arithmetic logic unit (ALU) is a combinational digital circuit that performs arithmetic and bitwise operations on integer binary numbers. This is in contrast to a floating-point unit (FPU), which operates on floating point num ...
(ALU) instructions to perform the primary arithmetic operations on integers. * Floating point ALU instructions to perform the primary arithmetic operations on
real number In mathematics, a real number is a number that can be used to measure a ''continuous'' one-dimensional quantity such as a distance, duration or temperature. Here, ''continuous'' means that values can have arbitrarily small variations. Every ...
s. *
Call stack In computer science, a call stack is a stack data structure that stores information about the active subroutines of a computer program. This kind of stack is also known as an execution stack, program stack, control stack, run-time stack, or mac ...
instructions to push and pop words needed to allocate memory and interface with functions. *
Single instruction, multiple data Single instruction, multiple data (SIMD) is a type of parallel processing in Flynn's taxonomy. SIMD can be internal (part of the hardware design) and it can be directly accessible through an instruction set architecture (ISA), but it should ...
(SIMD) instructions to increase speed when multiple processors are available to perform the same
algorithm In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing ...
on an array of data.


Changing programming environment

VLSI circuits enabled the
programming environment An integrated development environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of at least a source code editor, build automation tools ...
to advance from a computer terminal (until the 1990s) to a
graphical user interface The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, ins ...
(GUI) computer. Computer terminals limited programmers to a single shell running in a command-line environment. During the 1970s, full-screen source code editing became possible through a text-based user interface. Regardless of the technology available, the goal is to program in a
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
.


Programming paradigms and languages

Programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
features exist to provide building blocks to be combined to express programming ideals. Ideally, a programming language should: * express ideas directly in the code. * express independent ideas independently. * express relationships among ideas directly in the code. * combine ideas freely. * combine ideas only where combinations make sense. * express simple ideas simply. The programming style of a programming language to provide these building blocks may be categorized into programming paradigms. For example, different paradigms may differentiate: * procedural languages, functional languages, and logical languages. * different levels of data abstraction. * different levels of class hierarchy. * different levels of input datatypes, as in container types and generic programming. Each of these programming styles has contributed to the synthesis of different ''programming languages''. A ''programming language'' is a set of keywords,
symbols A symbol is a mark, sign, or word that indicates, signifies, or is understood as representing an idea, object, or relationship. Symbols allow people to go beyond what is known or seen by creating linkages between otherwise very different co ...
, identifiers, and rules by which programmers can communicate instructions to the computer. They follow a set of rules called a
syntax In linguistics, syntax () is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure ( constituenc ...
. * ''Keywords'' are reserved words to form declarations and statements. * ''Symbols'' are characters to form operations, assignments,
control flow In computer science, control flow (or flow of control) is the order in which individual statements, instructions or function calls of an imperative program are executed or evaluated. The emphasis on explicit control flow distinguishes an '' ...
, and delimiters. * ''Identifiers'' are words created by programmers to form
constants Constant or The Constant may refer to: Mathematics * Constant (mathematics), a non-varying value * Mathematical constant, a special number that arises naturally in mathematics, such as or Other concepts * Control variable or scientific const ...
, variable names, structure names, and function names. * ''Syntax Rules'' are defined in the Backus–Naur form. ''Programming languages'' get their basis from
formal language In logic, mathematics, computer science, and linguistics, a formal language consists of words whose letters are taken from an alphabet and are well-formed according to a specific set of rules. The alphabet of a formal language consists of sym ...
s. The purpose of defining a solution in terms of its ''formal language'' is to generate an
algorithm In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing ...
to solve the underlining problem. An ''algorithm'' is a sequence of simple instructions that solve a problem.


Generations of programming language

The evolution of programming language began when the
EDSAC The Electronic Delay Storage Automatic Calculator (EDSAC) was an early British computer. Inspired by John von Neumann's seminal '' First Draft of a Report on the EDVAC'', the machine was constructed by Maurice Wilkes and his team at the Univer ...
(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 based on a 1945 description by John von Neumann, and by others, in the '' First Draft of a Report on the EDVAC''. T ...
. Programming the EDSAC was in the first generation of programming language. * The first generation of programming language is
machine language In computer programming, machine code is any low-level programming language, consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). Each instruction causes the CPU to perform a ver ...
. ''Machine language'' requires the programmer to enter instructions using ''instruction numbers'' called machine code. For example, the ADD operation on the
PDP-11 The PDP-11 is a series of 16-bit minicomputers sold by Digital Equipment Corporation (DEC) from 1970 into the 1990s, one of a set of products in the Programmed Data Processor (PDP) series. In total, around 600,000 PDP-11s of all models were sol ...
has instruction number 24576. * The second generation of programming language is
assembly language In computer programming, assembly language (or assembler language, or symbolic machine code), often referred to simply as Assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence b ...
. ''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 for better understanding. Mnemonics make use of elaborative encoding, retrieval cues, and image ...
instructions instead of remembering instruction numbers. An 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 A word is a basic element of language that carries an objective or practical meaning, can be used on its own, and is uninterruptible. Despite the fact that language speakers often have an intuitive grasp of what a word is, there is no conse ...
) to reserve
memory Memory is the faculty of the mind by which data or information is encoded, stored, and retrieved when needed. It is the retention of information over time for the purpose of influencing future action. If past events could not be remember ...
cells. Then the MOV instruction can copy
integer An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the languag ...
s between registers and memory. :* The basic structure of an assembly language statement is a 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 language uses
compiler In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs tha ...
s and interpreters to execute computer programs. The distinguishing feature of a ''third generation'' language is its independence from particular hardware. Early languages include Fortran (1958),
COBOL COBOL (; an acronym for "common business-oriented language") is a compiled English-like computer programming language designed for business use. It is an imperative, procedural and, since 2002, object-oriented language. COBOL is primarily u ...
(1959), ALGOL (1960), and BASIC (1964). In 1973, the
C programming language ''The C Programming Language'' (sometimes termed ''K&R'', after its authors' initials) is a computer programming book written by Brian Kernighan and Dennis Ritchie, the latter of whom originally designed and implemented the language, as well a ...
emerged as a high-level language that produced efficient machine language instructions. Whereas ''third-generation'' languages historically generated many machine instructions for each statement, C has statements that may generate a single machine instruction. Moreover, an optimizing compiler might overrule the programmer and produce fewer machine instructions than statements. Today, an entire
paradigm In science and philosophy, a paradigm () is a distinct set of concepts or thought patterns, including theories, research methods, postulates, and standards for what constitute legitimate contributions to a field. Etymology ''Paradigm'' comes f ...
of languages fill the imperative, ''third generation'' spectrum. * The fourth generation of programming language emphasizes 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, consequenc ...
and allow programmers to write code with relatively few errors. One popular ''fourth generation'' language is called Structured Query Language (SQL).
Database In computing, a database is an organized collection of data stored and accessed electronically. Small databases can be stored on a file system, while large databases are hosted on computer clusters or cloud storage. The design of databases ...
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.


Imperative languages

''Imperative languages'' specify a sequential
algorithm In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing ...
using declarations, expressions, and statements: * A ''declaration'' introduces a variable name to the ''computer program'' and assigns it to a datatype – for example: var x: integer; * An ''expression'' yields a value – for example: 2 + 2 yields 4 * A ''statement'' might assign an expression to a variable or use the value of a variable to alter the program's
control flow In computer science, control flow (or flow of control) is the order in which individual statements, instructions or function calls of an imperative program are executed or evaluated. The emphasis on explicit control flow distinguishes an '' ...
– for example: x := 2 + 2; if x = 4 then do_something();


Fortran

FORTRAN (1958) was unveiled as "The IBM Mathematical FORmula TRANslating system." It was designed for scientific calculations, without string handling facilities. Along with declarations, expressions, and statements, it supported: * arrays. *
subroutine In computer programming, a function or subroutine is a sequence of program instructions that performs a specific task, packaged as a unit. This unit can then be used in programs wherever that particular task should be performed. Functions may ...
s. * "do" loops. 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 voluntary consensus standards for products, services, processes, systems, and personnel in the United States. The orga ...
(ANSI) developed the first Fortran standard in 1966. In 1978, Fortran 77 became the standard until 1991. Fortran 90 supports: * records. * pointers to arrays.


COBOL

COBOL COBOL (; an acronym for "common business-oriented language") is a compiled English-like computer programming language designed for business use. It is an imperative, procedural and, since 2002, object-oriented language. COBOL is primarily u ...
(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 charged with coordinating and supervising all agencies and functions of the government directly related to national sec ...
influenced COBOL's development, with 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 15 years until 1974. The 1990s version did make consequential changes, like
object-oriented programming Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of ...
.


Algol

ALGOL (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, syntax () is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure ( constituenc ...
using the Backus–Naur form. This led to syntax-directed compilers. It added features like: * block structure, where variables were local to their block. * arrays with variable bounds. * "for" loops. * 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 to logic. The most common application of recursion is in mathematic ...
. 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, Frenc ...
, Modula-2,
Ada Ada may refer to: Places Africa * Ada Foah, a town in Ghana * Ada (Ghana parliament constituency) * Ada, Osun, a town in Nigeria Asia * Ada, Urmia, a village in West Azerbaijan Province, Iran * Ada, Karaman, a village in Karaman Province, T ...
,
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 orac ...
and Oberon on one branch. On another branch there's C, 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 151.6 million people, Java is the world's mo ...
.


Basic

BASIC (1964) stands for "Beginner's All-Purpose Symbolic Instruction Code." It was developed at
Dartmouth College Dartmouth College (; ) is a private research university in Hanover, New Hampshire. Established in 1769 by Eleazar Wheelock, it is one of the nine colonial colleges chartered before the American Revolution. Although founded to educate Native ...
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 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 that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
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 added structure and object-oriented extensions. Microsoft's
Visual Basic Visual Basic is a name for a family of programming languages from Microsoft. It may refer to: * Visual Basic .NET (now simply referred to as "Visual Basic"), the current version of Visual Basic launched in 2002 which runs on .NET * Visual Basic ( ...
is still widely used and produces a
graphical user interface The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, ins ...
.


C

C programming language ''The C Programming Language'' (sometimes termed ''K&R'', after its authors' initials) is a computer programming book written by Brian Kernighan and Dennis Ritchie, the latter of whom originally designed and implemented the language, as well a ...
(1973) got its name because the language
BCPL BCPL ("Basic Combined Programming Language") is a procedural, imperative, and structured programming language. Originally intended for writing compilers for other languages, BCPL is no longer in common use. However, its influence is still ...
was replaced with B, and AT&T Bell Labs called the next version "C." Its purpose was to write the
UNIX Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, ...
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
. 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, assembly language (or assembler language, or symbolic machine code), often referred to simply as Assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence b ...
, but uses a high-level syntax. It added advanced features like: * inline assembler. * 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 to store. The
stack Stack may refer to: Places * Stack Island, an island game reserve in Bass Strait, south-eastern Australia, in Tasmania’s Hunter Island Group * Blue Stack Mountains, in Co. Donegal, Ireland People * Stack (surname) (including a list of people ...
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'', 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 In computer programming, a parameter or a formal argument is a special kind of variable used in a subroutine to refer to one of the pieces of data provided as input to the subroutine. These pieces of data are the values of the arguments (often ...
variables''. Parameter variables are enclosed within the parenthesis of function definitions. They provide an interface 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 Stack may refer to: Places * Stack Island, an island game reserve in Bass Strait, south-eastern Australia, in Tasmania’s Hunter Island Group * Blue Stack Mountains, in Co. Donegal, Ireland People * Stack (surname) (including a list of people ...
region is a contiguous block of memory located near the top memory address. Variables placed in the stack are populated from top to bottom. A stack pointer is a special-purpose
register 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. * ''Register'', a 2017 album by Travis Miller * Registration (organ), th ...
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 Scope or scopes may refer to: People with the surname * Jamie Scope (born 1986), English footballer * John T. Scopes (1900–1970), central figure in the Scopes Trial regarding the teaching of evolution Arts, media, and entertainment * Cinema ...
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 that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
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. An out of memory error occurs 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 have to be passed to the function via the stack.


C++

In the 1970s,
software engineers Software engineering is a systematic engineering approach to software development. A software engineer is a person who applies the principles of software engineering to design, develop, maintain, test, and evaluate computer software. The term ' ...
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 s ...
. One obvious feature was to decompose large projects ''physically'' into separate files. A less obvious feature was to decompose large projects ''logically'' into abstract datatypes. At the time, languages supported concrete ( scalar) datatypes like
integer An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the languag ...
numbers,
floating-point In computing, floating-point arithmetic (FP) is arithmetic that represents real numbers approximately, using an integer with a fixed precision, called the significand, scaled by an integer exponent of a fixed base. For example, 12.345 can ...
numbers, and strings of characters. Concrete datatypes have their representation as part of their name. Abstract datatypes are structures of concrete datatypes, with a new name assigned. For example, a list of integers could be called integer_list. In object-oriented jargon, abstract datatypes are called classes. However, a ''class'' is only a definition; no memory is allocated. When memory is allocated to a class, it's called an
object Object may refer to: General meanings * Object (philosophy), a thing, being, or concept ** Object (abstract), an object which does not exist at any particular time or place ** Physical object, an identifiable collection of matter * Goal, an ...
. '' Object-oriented imperative languages'' developed by combining the need for classes and the need for safe
functional programming In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions tha ...
. A function, in an object-oriented language, is assigned to a class. An assigned function is then referred to as a method, member function, or ''
operation Operation or Operations may refer to: Arts, entertainment and media * ''Operation'' (game), a battery-operated board game that challenges dexterity * Operation (music), a term used in musical set theory * ''Operations'' (magazine), Multi-Man ...
''. ''Object-oriented programming'' is executing ''operations'' on ''objects''. ''Object-oriented languages'' support a syntax to model subset/superset relationships. In
set theory Set theory is the branch of mathematical logic that studies sets, which can be informally described as collections of objects. Although objects of any kind can be collected into a set, set theory, as a branch of mathematics, is mostly concern ...
, an 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 people don't have. ''Object-oriented languages'' model ''subset/superset'' relationships using
inheritance Inheritance is the practice of receiving private property, titles, debts, entitlements, privileges, rights, and obligations upon the death of an individual. The rules of inheritance differ among societies and have changed over time. Of ...
. ''Object-oriented programming'' became the dominant language paradigm by the late 1990s. C++ (1985) was originally called "C with Classes." It was designed to expand 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 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 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 file'' 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 file'' 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 In software development, Make is a build automation tool that automatically builds executable programs and libraries from source code by reading files called ''Makefiles'' which specify how to derive the target program. Though integrated ...
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. 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 logical languages. The principle behind a ''functional language'' is to use
lambda calculus Lambda calculus (also written as ''λ''-calculus) is a formal system in mathematical logic for expressing computation based on function abstraction and application using variable binding and substitution. It is a universal model of computation th ...
as a guide for a well defined
semantic Semantics (from grc, σημαντικός ''sēmantikós'', "significant") is the study of reference, meaning, or truth. The term can be used to refer to subfields of several distinct disciplines, including philosophy, linguistics and comput ...
. 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
stack Stack may refer to: Places * Stack Island, an island game reserve in Bass Strait, south-eastern Australia, in Tasmania’s Hunter Island Group * Blue Stack Mountains, in Co. Donegal, Ireland People * Stack (surname) (including a list of people ...
before setting the
program counter The program counter (PC), commonly called the instruction pointer (IP) in Intel x86 and Itanium microprocessors, and sometimes called the instruction address register (IAR), the instruction counter, or just part of the instruction sequencer, i ...
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, a ''functional language'' will 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 A snippet is defined as a small piece of something; it may in more specific contexts refer to: * Sampling (music), the use of a short phrase of a recording as an element in a new piece of music * Snipets {{Infobox television , image ...
: 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 Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to Applied science, practical discipli ...
research to explore new language features. Moreover, their lack of side-effects have made them popular in parallel programming and concurrent programming. However, application developers prefer the object-oriented features of ''imperative languages''.


Lisp

Lisp (1958) stands for "LISt Processor." It is tailored to process
lists A ''list'' is any set of items in a row. List or lists may also refer to: People * List (surname) Organizations * List College, an undergraduate division of the Jewish Theological Seminary of America * SC Germania List, German rugby union ...
. A full structure of the data is formed by building lists of lists. In memory, a
tree data structure In computer science, a tree is a widely used abstract data type that represents a hierarchical tree structure with a set of connected nodes. Each node in the tree can be connected to many children (depending on the type of tree), but must be c ...
is built. Internally, the tree structure lends nicely for recursive functions. The syntax to build a tree is to enclose the space-separated 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
environments Environment most often refers to: __NOTOC__ * Natural environment, all living and non-living things occurring naturally * Biophysical environment, the physical and biological factors along with their chemical interactions that affect an organism or ...
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 datatype of the elements at compile time. Instead, it assigns (and may reassign) the datatypes at runtime. Assigning the datatype at runtime is called
dynamic binding Dynamic binding may refer to: * Dynamic binding (computing), also known as late binding * Dynamic scoping in programming languages * Dynamic binding (chemistry) See also * Dynamic dispatch *Dynamic linking In computing, a dynamic linker is the p ...
. Whereas dynamic binding increases the language's flexibility, programming errors may linger until late in the software 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 Artificial intelligence (AI) is intelligence—perceiving, synthesizing, and inferring information—demonstrated by machines, as opposed to intelligence displayed by animals and humans. Example tasks in which this is done include speech ...
. However, its usage has been accepted only because it has ''imperative language'' operations, making unintended side-effects possible.


ML

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: ''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. Moreover, ''ML'' assigns the datatype of an element at compile-time. Assigning the datatype at compile-time is called static binding. Static binding increases reliability because the compiler checks the context of variables before they are used.


Prolog

Prolog (1972) stands for "PROgramming in LOgic." It was designed to process natural languages. The building blocks of a Prolog program are ''
objects Object may refer to: General meanings * Object (philosophy), a thing, being, or concept ** Object (abstract), an object which does not exist at any particular time or place ** Physical object, an identifiable collection of matter * Goal, an ai ...
'' and their ''relationships'' to other objects. ''Objects'' are built by stating true ''facts'' about them.
Set theory Set theory is the branch of mathematical logic that studies sets, which can be informally described as collections of objects. Although objects of any kind can be collected into a set, set theory, as a branch of mathematics, is mostly concern ...
''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 In linguistics, an adjective ( abbreviated ) is a word that generally modifies a noun or noun phrase or describes its referent. Its semantic role is to change information given by the noun. Traditionally, adjectives were considered one of the ...
''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 backtracked and another path is systematically attempted. Practical applications include solving the
shortest path problem In graph theory, the shortest path problem is the problem of finding a path between two vertices (or nodes) in a graph such that the sum of the weights of its constituent edges is minimized. The problem of finding the shortest path between ...
and producing
family tree A family tree, also called a genealogy or a pedigree chart, is a chart representing family relationships in a conventional tree structure. More detailed family trees, used in medicine and social work, are known as genograms. Representations ...
s.


Object-oriented programming

Object-oriented programming Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of ...
is a programming method to execute operations ( functions) on
objects Object may refer to: General meanings * Object (philosophy), a thing, being, or concept ** Object (abstract), an object which does not exist at any particular time or place ** Physical object, an identifiable collection of matter * Goal, an ai ...
. The basic idea is to group the characteristics of a
phenomenon A phenomenon ( : phenomena) is an observable event. The term came into its modern philosophical usage through Immanuel Kant, who contrasted it with the noumenon, which ''cannot'' be directly observed. Kant was heavily influenced by Gottfrie ...
into an object container and give the container a name. The ''operations'' on the phenomenon are also grouped into the container. ''Object-oriented programming'' developed by combining the need for containers and the need for safe
functional programming In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions tha ...
. This programming method need not be confined to an ''object-oriented language''. In an object-oriented language, an object container is called a
class Class or The Class may refer to: Common uses not otherwise categorized * Class (biology), a taxonomic rank * Class (knowledge representation), a collection of individuals or objects * Class (philosophy), an analytical concept used differently ...
. In a non-object-oriented language, a
data structure In computer science, a data structure is a data organization, management, and storage format that is usually chosen for efficient access to data. More precisely, a data structure is a collection of data values, the relationships among them, ...
(which is also known as a record) may become an object container. To turn a data structure into an object container, operations need to be written specifically for the structure. The resulting structure is called an abstract datatype. However,
inheritance Inheritance is the practice of receiving private property, titles, debts, entitlements, privileges, rights, and obligations upon the death of an individual. The rules of inheritance differ among societies and have changed over time. Of ...
will be missing. Nonetheless, this shortcoming can be overcome. Here is a
C programming language ''The C Programming Language'' (sometimes termed ''K&R'', after its authors' initials) is a computer programming book written by Brian Kernighan and Dennis Ritchie, the latter of whom originally designed and implemented the language, as well a ...
''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 is 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 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 file'' 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 file'' 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 In software development, Make is a build automation tool that automatically builds executable programs and libraries from source code by reading files called ''Makefiles'' which specify how to derive the target program. Though integrated ...
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.


Syntax and semantics

The
syntax In linguistics, syntax () is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure ( constituenc ...
of a programming language is a list of production rules which govern its ''form''. A programming language's ''form'' is the correct placement of its declarations, expressions, and statements. Complementing the syntax of a language are its
semantics Semantics (from grc, σημαντικός ''sēmantikós'', "significant") is the study of reference, meaning, or truth. The term can be used to refer to subfields of several distinct disciplines, including philosophy, linguistics and comput ...
. The ''semantics'' describe the meanings attached to various syntactic constructs. A syntactic construct may need a semantic description because a form may have an invalid interpretation. Also, different languages might have the same syntax; however, their behaviors may be different. The syntax of a language is formally described by listing the ''production rules''. Whereas the syntax of a natural language is extremely complicated, a subset of the English language can have this production rule listing: # a sentence is made up of a noun-phrase followed by a verb-phrase; # a noun-phrase is made up of an article followed by an adjective followed by a noun; # a verb-phrase is made up of a verb followed by a noun-phrase; # an article is 'the'; # an adjective is 'big' or # an adjective is 'small'; # a noun is 'cat' or # a noun is 'mouse'; # a verb is 'eats'; The words in bold-face are known as "non-terminals". The words in 'single quotes' are known as "terminals". From this production rule listing, complete sentences may be formed using a series of replacements. The process is to replace ''non-terminals'' with either a valid ''non-terminal'' or a valid ''terminal''. The replacement process repeats until only ''terminals'' remain. One valid sentence is: * sentence * noun-phrase verb-phrase * article adjective noun verb-phrase * ''the'' adjective noun verb-phrase * ''the'' ''big'' noun verb-phrase * ''the'' ''big'' ''cat'' verb-phrase * ''the'' ''big'' ''cat'' verb noun-phrase * ''the'' ''big'' ''cat'' ''eats'' noun-phrase * ''the'' ''big'' ''cat'' ''eats'' article adjective noun * ''the'' ''big'' ''cat'' ''eats'' ''the'' adjective noun * ''the'' ''big'' ''cat'' ''eats'' ''the'' ''small'' noun * ''the'' ''big'' ''cat'' ''eats'' ''the'' ''small'' ''mouse'' However, another combination results in an invalid sentence: * ''the'' ''small'' ''mouse'' ''eats'' ''the'' ''big'' ''cat'' Therefore, a ''semantic'' is necessary to correctly describe the meaning of an ''eat'' activity. One ''production rule'' listing method is called the Backus–Naur form (BNF). BNF describes the syntax of a language and itself has a ''syntax''. This recursive definition is an example of a meta-language. The ''syntax'' of BNF includes: * ::= which translates to ''is made up of a ' when a non-terminal is to its right. It translates to ''is'' when a terminal is to its right. * , which translates to ''or''. * < and > which surround non-terminals. Using BNF, a subset of the English language can have this ''production rule'' listing: ::= ::=
::=
::= the ::= big , small ::= cat , mouse ::= eats Using BNF, a signed-
integer An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the languag ...
has the ''production rule'' listing: ::= ::= + , - ::= , ::= 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 Notice the recursive production rule: ::= , This allows for an infinite number of possibilities. Therefore, a ''semantic'' is necessary to describe a limitation of the number of digits. Notice the leading zero possibility in the production rules: ::= , ::= 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 Therefore, a ''semantic'' is necessary to describe that leading zeros need to be ignored. Two formal methods are available to describe ''semantics''. They are
denotational semantics In computer science, denotational semantics (initially known as mathematical semantics or Scott–Strachey semantics) is an approach of formalizing the meanings of programming languages by constructing mathematical objects (called ''denotations' ...
and
axiomatic semantics Axiomatic semantics is an approach based on mathematical logic for proving the correctness of computer programs. It is closely related to Hoare logic Hoare logic (also known as Floyd–Hoare logic or Hoare rules) is a formal system with a set ...
.


Software engineering and computer programming

Software engineering Software engineering is a systematic engineering approach to software development. A software engineer is a person who applies the principles of software engineering to design, develop, maintain, test, and evaluate computer software. The term '' ...
is a variety of techniques to produce quality software.
Computer programming Computer programming is the process of performing a particular computation (or more generally, accomplishing a specific computing result), usually by designing and building an executable computer program. Programming involves tasks such as anal ...
is the process of writing or editing
source code In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the ...
. In a formal environment, a systems analyst will gather information from managers about all the organization's 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.


Performance objectives

The systems analyst has the objective to deliver the right information to the right person at the right time. The critical factors to achieve this objective are: # The quality of the output. Is the output useful for decision-making? # The accuracy of the output. Does it reflect the true situation? # The format of the output. Is the output easily understood? # The speed of the output. Time-sensitive information is important when communicating with the customer in real time.


Cost objectives

Achieving performance objectives should be balanced with all of the costs, including: # Development costs. # Uniqueness costs. A reusable system may be expensive. However, it might be preferred over a limited-use system. # Hardware costs. # Operating costs. Applying a systems development process will mitigate the axiom: the later in the process an error is detected, the more expensive it is to correct.


Waterfall model

The waterfall model is an implementation of a ''systems development process''. As the ''waterfall'' label implies, the basic phases overlap each other: # The ''investigation phase'' is to understand the underlying problem. # The ''analysis phase'' is to understand the possible solutions. # The ''design phase'' is to plan the best solution. # The ''implementation phase'' is to program the best solution. # The ''maintenance phase'' lasts throughout the life of the system. Changes to the system after it's deployed may be necessary. Faults may exist, including specification faults, design faults, or coding faults. Improvements may be necessary. Adaption may be necessary to react to a changing environment.


Computer programmer

A
computer programmer A computer programmer, sometimes referred to as a software developer, a software engineer, a programmer or a coder, is a person who creates computer programs — often for larger computer software. A programmer is someone who writes/creates ...
is a specialist responsible for writing or modifying the source code to implement the detailed plan. A programming team is likely to be needed because most systems are too large to be completed by a single programmer. However, adding programmers to a project may not shorten the completion time. Instead, it may lower the quality of the system. To be effective, program modules need to be defined and distributed to team members. Also, team members must interact with one another in a meaningful and effective way. Computer programmers may be ''programming-in-the-small'': programming within a single module. Chances are a module will execute modules located in other source code files. Therefore, computer programmers may be ''programming-in-the-large'': programming modules so they will effectively couple with each other. Programming-in-the-large includes contributing to the
application programming interface An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how ...
(API).


Program modules

Modular programming is a technique to refine ''imperative language'' programs. Refined programs may reduce the software size, separate responsibilities, and thereby mitigate
software aging In software engineering, software aging is the tendency for software to fail or cause a system failure after running continuously for a certain time, or because of ongoing changes in systems surrounding the software. Software aging has several ...
. A ''program module'' is a sequence of statements that are bounded within a 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. ''Cohesion'' is a judgment of the relationship between a module's name and its ''function''. The degree of interaction ''between'' modules is the level of 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, a, b ). * ''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 loosely related functions. For example, function read_part_number_update_employee_record(). * ''Communicational Cohesion'': A module has communicational cohesion if it performs multiple closely related functions. 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, control flow (or flow of control) is the order in which individual statements, instructions or function calls of an imperative program are executed or evaluated. The emphasis on explicit control flow distinguishes an '' ...
. For example, perform_arithmetic( perform_addition, a, b ). 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 of ovals will convey an entire
algorithm In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing ...
. 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.


Functional categories

''Computer programs'' may be categorized along functional lines. The main functional categories are
application software Application may refer to: Mathematics and computing * Application software, computer software designed to help the user to perform specific tasks ** Application layer, an abstraction layer that specifies protocols and interface methods used in a ...
and system software. System software includes the
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
, which couples
computer hardware Computer hardware includes the physical parts of a computer, such as the case, central processing unit (CPU), random access memory (RAM), monitor, mouse, keyboard, computer data storage, graphics card, sound card, speakers and motherboard. ...
with application software. The purpose of the operating system is to provide an environment where application software executes in a convenient and efficient manner. Both application software and system software execute utility programs. At the hardware level, a microcode program controls the circuits throughout the
central processing unit A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuitry that executes instructions comprising a computer program. The CPU performs basic arithmetic, logic, controlling, a ...
.


Application software

Application software is the key to unlocking the potential of the computer system. Enterprise application software bundles accounting, personnel, customer, and vendor applications. Examples include enterprise resource planning,
customer relationship management Customer relationship management (CRM) is a process in which a business or other organization administers its interactions with customers, typically using data analysis to study large amounts of information. CRM systems compile data from a r ...
, and supply chain management software. Enterprise applications may be developed in-house as a one-of-a-kind
proprietary software Proprietary software is software that is deemed within the free and open-source software to be non-free because its creator, publisher, or other rightsholder or rightsholder partner exercises a legal monopoly afforded by modern copyright and i ...
. Alternatively, they may be purchased as 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 potential advantages of in-house software are features and reports may be developed exactly 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 may necessitate enterprise software changes. The potential disadvantages of in-house software are time and resource costs may be extensive. Furthermore, risks concerning features and performance may be looming. The potential advantages of off-the-shelf software are upfront costs are identifiable, the basic needs should be fulfilled, and its performance and reliability have a track record. The potential 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. Specialty companies provide hardware, custom software, and end-user support. They may speed the 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 that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
is the low-level software that supports a computer's basic functions, such as scheduling
processes 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, activities that produce a specific se ...
and controlling
peripheral A peripheral or peripheral device is an auxiliary device used to put information into and get information out of a computer. The term ''peripheral device'' refers to all hardware components that are attached to a computer and are controlled by the ...
s. 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 program that manages the
processes 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, activities that produce a specific se ...
,
memory Memory is the faculty of the mind by which data or information is encoded, stored, and retrieved when needed. It is the retention of information over time for the purpose of influencing future action. If past events could not be remember ...
, and devices. More broadly, the operating system may refer to the entire package of the central software. The package includes a kernel program, command-line interpreter,
graphical user interface The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, ins ...
, utility programs, and editor.


Kernel Program

The kernel's main purpose is to manage the limited resources of a computer: * The kernel program should perform 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 circuitry that executes instructions comprising a computer program. The CPU performs basic arithmetic, logic, controlling, a ...
only for a
time slice In computing, preemption is the act of temporarily interrupting an executing task, with the intention of resuming it at a later time. This interrupt is done by an external scheduler with no assistance or cooperation from the task. This preemp ...
. To provide each user with the appearance of continuous access, the kernel quickly preempts each process control block to execute another one. The goal for system developers is to minimize
dispatch latency In computing, scheduling is the action of assigning ''resources'' to perform ''tasks''. The ''resources'' may be processors, network links or expansion cards. The ''tasks'' may be threads, processes or data flows. The scheduling activity is ...
. * The kernel program should perform memory management. :* When the kernel initially loads an executable into memory, it divides the address space logically into 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-pregion table is used to determine where its contents are located in 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 machine instructions don't change, the program pregion may be shared by many processes of the same executable. :* 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 is responsible for translating virtual addresses into physical addresses. The kernel may request data from the memory controller and, instead, receive a
page fault In computing, a page fault (sometimes called PF or hard fault) is an exception that the memory management unit (MMU) raises when a process accesses a memory page without proper preparations. Accessing the page requires a mapping to be added t ...
. If so, the kernel accesses the memory management unit to populate the physical data region and translate the address. :* 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 Waste collection is a part of the process of waste management. It is the transfer of solid waste from the point of use and disposal to the point of treatment or landfill. Waste collection also includes the curbside collection of recyclabl ...
to free the memory. :* The kernel also ensures that a process only accesses its own memory, and not that of the kernel or other processes. * The kernel program should perform
file system management File or filing may refer to: Mechanical tools and processes * File (tool), a 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 ge ...
. The kernel has instructions to create, retrieve, update, and delete files. * The kernel program should perform 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 request it at the same time. * The kernel program should perform network management. The kernel transmits and receives packets on behalf of processes. One key service is to find an efficient route to the target system. * The kernel program should provide 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 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 communication channel between executing processes. For a large software system, it may be desirable to
engineer Engineers, as practitioners of engineering, are professionals who Invention, invent, design, analyze, build and test machines, complex systems, structures, gadgets and materials to fulfill functional objectives and requirements while considerin ...
the system into smaller processes. Processes may communicate with one another by sending and receiving signals. Originally, operating systems were programmed in assembly; however, modern operating systems are typically written in higher-level languages like C, Objective-C, and Swift.


Utility program

A 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 A computer virus is a type of computer program that, when executed, replicates itself by modifying other computer programs and inserting its own code. If this replication succeeds, the affected areas are then said to be "infected" with a comput ...
es.


Microcode program

A microcode program is the bottom-level interpreter that controls the 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 digital logic level—the computer's real hardware. The digital logic level is the boundary between
computer science Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to Applied science, practical discipli ...
and computer engineering. A
logic gate A logic gate is an idealized or physical device implementing a Boolean function, a logical operation performed on one or more binary inputs that produces a single binary output. Depending on the context, the term may refer to an ideal logic ga ...
is a tiny
transistor upright=1.4, gate (G), body (B), source (S) and drain (D) terminals. The gate is separated from the body by an insulating layer (pink). A transistor is a semiconductor device used to Electronic amplifier, amplify or electronic switch, switch ...
that can return one of two signals: on or off. * Having one transistor forms the 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 binary algebra—the digital logic functions of the computer. Microcode instructions are mnemonics programmers may use to execute digital logic functions instead of forming them in binary algebra. They are stored in a central processing unit's (CPU) control store. These hardware-level instructions move data throughout the data path. The micro-instruction cycle begins when the microsequencer uses its microprogram counter to ''fetch'' the next machine instruction from
random-access memory Random-access memory (RAM; ) is a form of computer memory that can be read and changed in any order, typically used to store working data and machine code. A random-access memory device allows data items to be read or written in almost the ...
. 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 In computing, an arithmetic logic unit (ALU) is a combinational digital circuit that performs arithmetic and bitwise operations on integer binary numbers. This is in contrast to a floating-point unit (FPU), which operates on floating point num ...
(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 microcode instructions manipulate two registers. The memory address register is used to access each memory cell's address. The memory data register is used to set and read each cell's contents. Microcode instructions move data between the CPU and the many
computer buses In computer architecture, a bus (shortened form of the Latin '' omnibus'', and historically also called data highway or databus) is a communication system that transfers data between components inside a computer, or between computers. This e ...
. The disk controller bus writes to and reads from
hard disk drive A hard disk drive (HDD), hard disk, hard drive, or fixed disk is an electro-mechanical data storage device that stores and retrieves digital data using magnetic storage with one or more rigid rapidly rotating platters coated with mag ...
s. Data is also moved between the CPU and other functional units via the peripheral component interconnect express bus.


Notes


References

{{DEFAULTSORT:Computer Program Computer programming Software