
appendChild() method. The method adds a new child node to an existing parent node. It is commonly used to dynamically modify the structure of an HTML document.| Program execution |
|---|
| General concepts |
| Types of code |
| Compilation strategies |
| Notable runtimes |
|
| Notable compilers & toolchains |
|
A computer program is a sequence or set of instructions in a programming language for a computer to execute. It is one component of software, which also includes documentation and other intangible components.
A computer program in its human-readable form is called source code. 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 a compiler written for the language. (Assembly language programs are translated using an assembler.) The resulting file is called an executable. Alternatively, source code may execute within an interpreter written for the language.
If the executable is requested for execution, then the operating system loads it into memory and starts a process. The central processing unit 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.
The "Hello, World!" program is used to illustrate a language's basic syntax. 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 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.
Improvements in software development are the result of improvements in computer hardware. At each stage in hardware's history, the task of computer programming changed dramatically.

In 1837, Jacquard's loom inspired Charles Babbage to attempt to build the Analytical Engine. 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. The engine was programmed using two sets of perforated cards. One set directed the operation and the other set inputted the variables. However, 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.

In 1936, Alan Turing 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. 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.

The Electronic Numerical Integrator And Computer (ENIAC) was built between July 1943 and Fall 1945. It was a Turing complete, general-purpose computer that used 17,468 vacuum tubes to create the circuits. At its core, it was a series of Pascalines wired together. Its 40 units weighed 30 tons, occupied 1,800 square feet (167 m2), 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.
Instead of plugging in cords and turning switches, a stored-program computer 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, 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 architecture was simultaneously deployed in the constructions of the EDVAC and EDSAC computers in 1949.
The IBM System/360 (1964) was a family of computers, each having the same instruction set architecture. The Model 20 was the smallest and least expensive. Customers could upgrade and retain the same application software. The Model 195 was the most premium. Each System/360 model featured multiprogramming—having multiple processes in memory at once. When one process was waiting for input/output, another could compute.
IBM planned for each model to be programmed using PL/I. A committee was formed that included COBOL, 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.

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, punched cards or magnetic-tape. After the medium was loaded, the starting address was set via switches, and the execute button was pressed.

A major milestone in software development was the invention of the Very Large Scale Integration (VLSI) circuit.
Robert Noyce, co-founder of Fairchild Semiconductor (1957) and Intel (1968), achieved a technological improvement to refine the production of field-effect transistors (1959). The goal is to alter the electrical resistivity and conductivity of a semiconductor junction. First, naturally occurring silicate minerals are converted into polysilicon rods using the Siemens process. The Czochralski process then converts the rods into a monocrystalline silicon, boule crystal. The crystal is then thinly sliced to form a wafer substrate. The planar process of photolithography then integrates unipolar transistors, capacitors, diodes, and resistors 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. Chip makers designed custom chips for specific applications.
In 1969, Busicom, a Japanese calculator company, contracted with Intel to manufacture 12 integrated circuit chips, each for a specific calculator function. Ted Hoff, the engineer tasked with the assignment, realized he could build one chip that could execute computer programs to perform the 12 calculator functions. The resulting chip was called the Intel 4004 microprocessor.

The terms microprocessor and central processing unit (CPU) are now used interchangeably. However, CPUs predate microprocessors. For example, the IBM System/360 (1964) had a CPU made from circuit boards containing discrete components on ceramic substrates.

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 market (1981). As consumer 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. The major categories of instructions are:

VLSI circuits enabled the programming environment to advance from a computer terminal (until the 1990s) to a graphical user interface (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.
Programming language features exist to provide building blocks to be combined to express programming ideals. Ideally, a programming language should:
The programming style of a programming language to provide these building blocks may be categorized into programming paradigms. For example, different paradigms may differentiate:
Each of these programming styles has contributed to the synthesis of different programming languages.
A programming language is a set of keywords, symbols, identifiers, and rules by which programmers can communicate instructions to the computer. They follow a set of rules called a syntax.
Programming languages get their basis from formal languages. The purpose of defining a solution in terms of its formal language is to generate an algorithm to solve the underlining problem. An algorithm is a sequence of simple instructions that solve a problem.

The evolution of programming languages began when the EDSAC (1949) used the first stored computer program in its von Neumann architecture. Programming the EDSAC was in the first generation of programming language.

Imperative languages specify a sequential algorithm using declarations, expressions, and statements:
var x: integer;2 + 2 yields 4x := 2 + 2; if x = 4 then do_something();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:
It succeeded because:
However, non-IBM vendors also wrote Fortran compilers, but with a syntax that would likely fail IBM's compiler. The American National Standards Institute (ANSI) developed the first Fortran standard in 1966. In 1978, Fortran 77 became the standard until 1991. Fortran 90 supports:
COBOL (1959) stands for "COmmon Business Oriented Language". Fortran manipulated symbols. It was soon realized that symbols did not need to be numbers, so strings were introduced. The US Department of Defense 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 did not emerge to require ANSI standards. As a consequence, it was not changed for 15 years until 1974. The 1990s version did make consequential changes, like object-oriented programming.
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 using the Backus–Naur form. This led to syntax-directed compilers. It added features like:
Algol's direct descendants include Pascal, Modula-2, Ada, Delphi and Oberon on one branch. On another branch the descendants include C, C++ and Java.
BASIC (1964) stands for "Beginner's All-Purpose Symbolic Instruction Code". It was developed at Dartmouth College for all of their students to learn. If a student did not 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 commands within its environment:
However, the Basic syntax was too simple for large programs. Recent dialects added structure and object-oriented extensions. Microsoft's Visual Basic is still widely used and produces a graphical user interface.
C programming language (1973) got its name because the language BCPL was replaced with B, and AT&T Bell Labs called the next version "C". Its purpose was to write the UNIX operating system. C is a relatively small language, making it easy to write compilers. Its growth mirrored the hardware growth in the 1980s. Its growth also was because it has the facilities of assembly language, but it uses a high-level syntax. It added advanced features like:

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 is automatically used for the standard variable declarations. Heap memory is returned to a pointer variable from the malloc() function.
main() function. Global variables are visible to main() and every other function in the source code.main(), other functions, or within { } block delimiters are local variables. Local variables also include formal parameter variables. Parameter variables are enclosed within the parenthesis of a function definition. Parameters provide an interface to the function.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 following function:int increment_counter() {
static int counter = 0;
counter++;
return counter;
}
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.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.In the 1970s, software engineers needed language support to break large projects down into modules. 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 numbers, floating-point numbers, and strings of characters. Abstract datatypes are structures of concrete datatypes, with a new name assigned. For example, a list of integers could be called IntegerList.
In object-oriented terminology, an abstract datatype is called a class. However, a class is only a definition; no memory is allocated. When memory is allocated to a class and bound to an identifier, it is called an object.
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. A C++ class encapsulates related data items with the functions that manipulate them.
Object-oriented imperative languages developed by combining the need for classes and the need for safe functional programming. A function, in an object-oriented language, is assigned to a class. An assigned function is then referred to as a method, member function, or operation. Object-oriented programming is executing operations on objects.
C++ supports a syntax to model subset/superset relationships. In set theory, 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 do not have. C++ models subset/superset relationships using inheritance.
A C++ namespace provides context in case a name conflict occurs. Class names and function names may be duplicated in other source code files or third-party libraries. To wrap class names and function names in a namespace block, use the keyword namespace. The keyword is followed by an identifier, and the block is enclosed in parenthesis.
To instantiate a class or execute a function that is within a namespace, prepend the class or function name with the namespace name followed by a double colon. For example, foo::bar() denotes the function bar() residing in the namespace foo. Alternatively, execute the using directive followed by the namespace name. Then all the class and function names may be accessed without the double colon prefix.
A C++ module provides an improvement over the legacy #include preprocessor directive. The #include directive allows for arbitrary files to be included in a C/C++ program. The goal is to have a common set of constants, datatypes, and function declarations across a large application.
Modules are identified to the compiler by including the export module statement followed by the name of the module. Other source code files then import the same module name to perform the module's task.
Class definitions and other named declarations must also be preceded with the export statement to be visible to other source code files. If a namespace is exported, then everything inside that namespace is also exported.
This is a module for the Grade class in an application modelling a school:
// Grade.cpp
// The "export module" statement allows other programs to "import" the named module 'wikipedia.examples.Grade'
export module wikipedia.examples.Grade;
// Declare the 'wikipedia::examples' namespace
namespace wikipedia::examples {
// Define the class "Grade"
// The "export" statement allows other modules to access this class
export class Grade {
private:
// The class variable "letter" is of type char
char letter;
public:
// Constructor
explicit Grade(char letter):
letter{letter} {}
// A member operation
char getLetter() const {
return letter;
}
};
}
A constructor function has the same name as the class name. It is executed when an object of a class is declared.
This is a module for the Person class in an application modelling a school:
// Person.cpp
export module wikipedia.examples.Person;
// Import the standard library module 'std'
import std;
// Add the type 'std::string' into scope
using std::string;
namespace wikipedia::examples {
export class Person {
protected:
// The class variable "name" is a class type std::string
string name;
public:
explicit Person(const string& name):
name{name} {}
string getName() const {
return name;
}
};
}
This is a module for the Student class in an application modelling a school:
// Student.cpp
export module wikipedia.examples.Student;
import std;
import wikipedia.examples.Grade;
import wikipedia.examples.Person;
using std::string;
namespace wikipedia::examples {
// 'Student' is a subclass of 'Person'
export class Student : public Person {
private:
Grade grade;
public:
Student(const string& name, const Grade& grade):
Person(name), grade{grade} {}
Grade getGrade() const {
return grade;
}
};
}
The syntax public Person means that the Student class extends the Person class, inheriting all of its variables and methods (such as name and getName()).
This is a driver program for demonstration:
// Main.cpp
import std;
import wikipedia.examples.Grade;
import wikipedia.examples.Student;
using wikipedia::examples::Grade;
using wikipedia::examples::Student;
int main() {
Student john("John Doe", Grade('A'));
std::println("Student name: {}, with grade {}", john.getName(), john.getGrade().getLetter());
}
Output:
Student name: John Doe, with grade A
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 as a guide for a well defined semantic. In mathematics, a function is a rule that maps elements from an expression to a range of values. Consider the function:
times_10(x) = 10 * x
The expression 10 * x is mapped by the function times_10() to a range of values. One value happens to be 20. This occurs when x is 2. So, the application of the function is mathematically written as:
times_10(2) = 20
A functional language compiler will not store this value in a variable. Instead, it will push the value onto the computer's stack before setting the program counter back to the calling function. The calling function will then pop the value from the stack.
Imperative languages do support functions. Therefore, functional programming can be achieved in an imperative language, if the programmer uses discipline. However, 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:
int max(int a, int b) {
return a < b ? b : a;
}
int min(int a, int b) {
return a < b ? a : b;
}
int range(int a, int b, int c) {
return max(a, max(b, c)) - min(a, min(b, c));
}
The primitives are max() and min(). The driver function is range().
For example, printf("%d", range(10, 4, 7)); will print 6.
Functional languages are used in computer science research to explore new language features. Moreover, their lack of side-effects have made them popular in parallel programming and concurrent programming. However, application developers prefer the object-oriented features of imperative languages.
Lisp (1958) stands for "LISt Processor". It is tailored to process lists. A full structure of the data is formed by building lists of lists. In memory, a tree data structure 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 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. 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. However, its usage has been accepted only because it has imperative language operations, making unintended side-effects possible.
ML (1979) stands for "Meta Language". ML checks to make sure only data of the same type are compared with one another. For example, this function has one input parameter (an integer) and returns an integer:
fun times_10(n : int) : int = 10 * n;
ML is not parenthesis-eccentric like Lisp. The following is an application of times_10():
times_10 2
It returns "20 : int". (Both the results and the datatype are returned.)
Like Lisp, ML is tailored to process lists. Unlike Lisp, each element is the same datatype. 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 (1972) stands for "PROgramming in LOGic". It is a logic programming language, based on formal logic. The language was developed by Alain Colmerauer and Philippe Roussel in Marseille, France. It is an implementation of Selective Linear Definite clause resolution, pioneered by Robert Kowalski and others at the University of Edinburgh.
The building blocks of a Prolog program are facts and rules. Here is a simple example:
cat(tom). % tom is a cat
mouse(jerry). % jerry is a mouse
animal(X) :- cat(X). % each cat is an animal
animal(X) :- mouse(X). % each mouse is an animal
big(X) :- cat(X). % each cat is big
small(X) :- mouse(X). % each mouse is small
eat(X,Y) :- mouse(X), cheese(Y). % each mouse eats each cheese
eat(X,Y) :- big(X), small(Y). % each big animal eats each small animal
After all the facts and rules are entered, then a question can be asked:
?- eat(tom,jerry).
true
The following example shows how Prolog will convert a letter grade to its numeric value:
numeric_grade('A', 4).
numeric_grade('B', 3).
numeric_grade('C', 2).
numeric_grade('D', 1).
numeric_grade('F', 0).
numeric_grade(X, -1) :- not X = 'A', not X = 'B', not X = 'C', not X = 'D', not X = 'F'.
grade('The Student', 'A').
?- grade('The Student', X), numeric_grade(X, Y).
X = 'A',
Y = 4
Here is a comprehensive example:
1) All dragons billow fire, or equivalently, a thing billows fire if the thing is a dragon:
billows_fire(X) :-
is_a_dragon(X).
2) A creature billows fire if one of its parents billows fire:
billows_fire(X) :-
is_a_creature(X),
is_a_parent_of(Y,X),
billows_fire(Y).
3) A thing X is a parent of a thing Y if X is the mother of Y or X is the father of Y:
is_a_parent_of(X, Y):- is_the_mother_of(X, Y).
is_a_parent_of(X, Y):- is_the_father_of(X, Y).
4) A thing is a creature if the thing is a dragon:
is_a_creature(X) :-
is_a_dragon(X).
5) Norberta is a dragon, and Puff is a creature. Norberta is the mother of Puff.
is_a_dragon(norberta).
is_a_creature(puff).
is_the_mother_of(norberta, puff).
Rule (2) is a recursive (inductive) definition. It can be understood declaratively, without the need to understand how it is executed.
Rule (3) shows how functions are represented by using relations. Here, the mother and father functions ensure that every individual has only one mother and only one father.
Prolog is an untyped language. Nonetheless, inheritance can be represented by using predicates. Rule (4) asserts that a creature is a superclass of a dragon.
Questions are answered using backward reasoning. Given the question:
?- billows_fire(X).
Prolog generates two answers :
X = norberta
X = puff
Practical applications for Prolog are knowledge representation and problem solving in artificial intelligence.
Object-oriented programming is a programming method to execute operations (functions) on objects. The basic idea is to group the characteristics of a phenomenon 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. This programming method need not be confined to an object-oriented language. In an object-oriented language, an object container is called a class. In a non-object-oriented language, a data structure (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 will be missing. Nonetheless, this shortcoming can be overcome.
This is a C header file for the Grade datatype in an application modelling a school:
// Grade.h
#pragma once
typedef struct {
char letter;
} Grade;
// Constructor
Grade *grade_new(char letter);
// Destructor
void grade_delete(Grade *g);
The grade_new() function behaves like the C++ constructor, creating a new Grade instance.
This is a C source file for the Grade datatype in an application modelling a school:
// Grade.c
#include <stdio.h>
#include <stdlib.h>
#include "Grade.h"
Grade *grade_new(char letter) {
Grade *grade;
// Allocate and zero-out heap memory
if (!(grade = calloc(1, sizeof(Grade)))) {
fprintf(stderr, "Error: calloc() returned empty.\n");
return NULL;
}
grade->letter = letter;
return grade;
}
void grade_delete(Grade *g) {
free(g);
}
This is a C header file for the Person datatype in an application modelling a school:
// Person.h
#pragma once
typedef struct {
char *name;
} Person;
Person *person_new(char *name);
void person_delete(Person *p);
Here is a C source file for the Person datatype in an application modelling a school:
// Person.c
#include <stdlib.h>
#include "Person.h"
Person *person_new(char *name) {
Person *person;
// Error checking omitted
person = calloc(1, sizeof(Person));
person->name = name;
return person;
}
void person_delete(Person *p) {
free(p);
}
This is a C header file for the Student datatype in an application modelling a school:
// Student.h
#pragma once
#include "Grade.h"
#include "Person.h"
typedef struct {
Person *person;
Grade *grade;
} Student;
Student *student_new(char *name);
void *student_delete(Student *s);
This is a C source file for the Student datatype in an application modelling a school:
// student.c
#include <stdlib.h>
#include "Person.h"
#include "Student.h"
Student *student_new(char *name) {
Student *student;
// First construct a Student
student = calloc(1, sizeof(Student));
// Second construct a Person
student->person = person_new(name);
return student;
}
void student_delete(Student *s) {
person_delete(s->person);
free(s);
}
This is a driver program for demonstration:
// Main.c
#include <stdio.h>
#include "Student.h"
int main() {
Student *john = student_new("John Doe");
john->grade = grade_new('A');
printf(
"Student name: %s, with grade %d\n"
john->person->name,
john->grade->letter
);
grade_delete(john->grade);
student_delete(john);
return 0;
}
The formal strategy to build object-oriented objects is to:
For example:

The syntax of a computer program is a list of production rules which form its grammar. A programming language's grammar correctly places its declarations, expressions, and statements. Complementing the syntax of a language are its semantics. The semantics describe the meanings attached to various syntactic constructs. A syntactic construct may need a semantic description because a production rule 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:
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:
However, another combination results in an invalid sentence:
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 metalanguage. The syntax of BNF includes:
::= which translates to is made up of a[n] 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:
<sentence> ::= <noun-phrase><verb-phrase>
<noun-phrase> ::= <article><adjective><noun>
<verb-phrase> ::= <verb><noun-phrase>
<article> ::= the
<adjective> ::= big | small
<noun> ::= cat | mouse
<verb> ::= eats
Using BNF, a signed-integer has the production rule listing:
<signed-integer> ::= <sign><integer>
<sign> ::= + | -
<integer> ::= <digit> | <digit><integer>
<digit> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
Notice the recursive production rule:
<integer> ::= <digit> | <digit><integer>
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:
<integer> ::= <digit> | <digit><integer>
<digit> ::= 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 and axiomatic semantics.

Software engineering is a variety of techniques to produce quality computer programs. Computer programming is the process of writing or editing source code. 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.
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:
Achieving performance objectives should be balanced with all of the costs, including:
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.
The waterfall model is an implementation of a systems development process. As the waterfall label implies, the basic phases overlap each other:
A computer programmer 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 (API).
Modular programming is a technique to refine imperative language programs. Refined programs may reduce the software size, separate responsibilities, and thereby mitigate software aging. 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 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.
The levels of cohesion from worst to best are:
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."function perform_arithmetic( perform_addition, a, b ).function initialize_variables_and_open_files(). Another example, stage_one(), stage_two(), ...function read_part_number_update_employee_record().function read_part_number_update_sales_record().The levels of coupling from worst to best are:
perform_arithmetic( perform_addition, a, b ). Instead, control should be on the makeup of the returned object.
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. 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.

Computer programs may be categorized along functional lines. The main functional categories are application software and system software. System software includes the operating system, which couples computer hardware with application software. The purpose of the operating system is to provide an environment where application software executes in a convenient and efficient manner. Both application software and system software execute utility programs. At the hardware level, a microcode program controls the circuits throughout the central processing unit.
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, and supply chain management software.
Enterprise applications may be developed in-house as a one-of-a-kind proprietary software. Alternatively, they may be purchased as 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.

An operating system is the low-level software that supports a computer's basic functions, such as scheduling processes and controlling peripherals.
In the 1950s, the programmer, who was also the operator, would write a program and run it. After the program finished executing, the output may have been printed, or it may have been punched onto paper tape or cards for later processing. More often than not the program did not work. The programmer then looked at the console lights and fiddled with the console switches. If less fortunate, a memory printout was made for further study. In the 1960s, programmers reduced the amount of wasted time by automating the operator's job. A program called an operating system was kept in the computer at all times.
The term operating system may refer to two levels of software. The operating system may refer to the kernel program that manages the processes, memory, 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, utility programs, and editor.

The kernel's main purpose is to manage the limited resources of a computer:

Originally, operating systems were programmed in assembly; however, modern operating systems are typically written in higher-level languages like C, Objective-C, and Swift.
A utility is a program that aids system administration and software execution. An operating system typically provides utilities to check hardware such as storage, memory, speakers, and printers. A utility may optimize the performance of a storage device. System utilities monitor hardware and network performance and may trigger an alert when a metric is outside the nominal range. A utility may compress files to reduce storage space and network transmission time. A utility may sort and merge data sets or detect computer viruses.
A microcode program is the bottom-level interpreter that controls the datapath 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 and computer engineering.
A logic gate is a tiny transistor that can return one of two signals: on or off.
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 CPU's 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. The next step is to decode the machine instruction by selecting the proper output line to the hardware module. The final step is to execute the instruction using the hardware module's set of gates.

Instructions to perform arithmetic are passed through an arithmetic logic unit (ALU). The ALU has circuits to perform elementary operations to add, shift, and compare integers. By combining and looping the elementary operations through the ALU, the CPU performs its complex arithmetic.
Microcode instructions move data between the CPU and the memory controller. Memory controller 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.
x++ will usually compile to a single instruction.int increment_counter() {
static int counter;
return ++counter;
}
++counter is a prefix increment operator.calloc() function to allocate heap memory. It provides two additional services: 1) It allows the programmer to create an array of arbitrary size. 2) It sets each memory cell to zero.strdup() function. It executes both the allocation function and the copy function.[Software includes] all or part of the programs, procedures, rules, and associated documentation of an information processing system.
An alternative to compiling a source program is to use an interpreter. An interpreter can directly execute a source program[.]
The kernel can load a new program into memory[.]
Informally, a process is a program in execution.
Their intention was to produce a language that was very simple for students to learn[.]
The idea was that students could be merely casual users or go on from Basic to more sophisticated and powerful languages[.]
Babbage decided to make a calculating device driven by two sets of cards, one to direct the operation to be performed, and the other for the variables of the problem.
Turing machines can model all the computations that can be performed on a computing machine.
[A]ll the common mathematical functions, no matter how complicated, are Turing-computable.
In 1972, Vadasz abruptly told me he had hired someone to run Intel's custom chip business ...
Hoff bet it would soon be cheaper to design a standardized logic chip that, coupled with a powerful memory chip [and] programmed with different types of software, could compute many different things.
It [the EDSAC project] opened up an entirely new region of the stored-program computer paradigm, a new class of artifacts the likes of which had never been seen before: computer-programs or software.
His [John von Neumann] basic design, now known as a von Neumann machine, was used in the EDSAC, the first stored program computer, and is still the basis for nearly all digital computers, even now, almost half a century later. ... Each word held either two 20-bit instructions [a stored program] or a 39-bit signed integer.
The first generation of programming languages is machine language, which requires the use of binary symbols (0s and 1s).
Most people can remember that the abbreviations for add, subtract, multiply, and divide are ADD, SUB, MUL, and DIV, but few can remember that the machine instructions (for the PDP-11) are 24576, 57344, 28672, and 29184.
With third-generation and higher-level programming languages, each statement in the language translates into several instructions in machine language.
Just as a structure definition encapsulates a set of related data items, a class definition encapsulates related data items and functions that manipulate them.
Namespaces address the problem of naming conflicts between different pieces of code.
Header files do have a number of problems, though, such as avoiding multiple includes of the same header file and making sure header files are included in the correct order.
If the program did not import that module, it would be unable to perform its only task of printing text.
When there is a function call, all the important information needs to be saved, such as register values (corresponding to variable names) and the return address (which can be obtained from the program counter)[.] ... When the function wants to return, it ... restores all the registers. It then makes the return jump. Clearly, all of this work can be done using a stack, and that is exactly what happens in virtually every programming language that implements recursion.
Simula was based on Algol 60 with one very important addition — the class concept. ... The basic idea was that the data (or data structure) and the operations performed on it belong together[.]
Originally, a large number of experimental languages were designed, many of which combined object-oriented and functional programming.
While it is true that OOD [(object oriented design)] as such is not supported by the majority of popular languages, a large subset of OOD can be used.
The syntax (or grammar) of a programming language describes the correct form in which programs may be written[.]
The main components of an imperative language are declarations, expressions, and statements.
The key to unlocking the potential of any computer system is application software.
[A] third-party software firm, often called a value-added software vendor, may develop or modify a software program to meet the needs of a particular industry or company.
Heading: Proprietary Software; Subheading: Advantages; Quote: You can get exactly what you need in terms of features, reports, and so on.
Heading: Proprietary Software; Subheading: Advantages; Quote: Being involved in the development offers a further level of control over the results.
Heading: Proprietary Software; Subheading: Advantages; Quote: There is more flexibility in making modifications that may be required to counteract a new initiative by one of your competitors or to meet new supplier and/or customer requirements.
malloc calls upon the operating system to obtain more memory as needed.
Thus its [the operating system's] free storage is kept as a list of free blocks.
Once a process has completed execution, the kernel ensures that the resources it uses are freed for subsequent reuse by later programs.