History of programming¶
In this lesson, you will see the origins and early development of computing devices. You will learn some of the basic theoretical ideas of computation and programming, as well as the essentials of machine code and assembly languages. You will see how more sophisticated languages were developed, and how different languages are equivalent in their essential power but differ in terms of style and usability.
Learning outcomes
After completing this lesson you should be able to:
-
recognise that modern computers developed from a variety of much older devices
-
recognise that the essential characteristic of a computer is that it can be programmed to perform different tasks
-
identify some basic aspects of the nature of programming languages.
How code has advanced¶
The Sinclair Spectrum ZX is an 8-bit personal computer released in the United Kingdom in 1981. The Spectrum was designed to be a low-cost introduction to home computing. Video output was to a TV rather than a monitor, and software was loaded and saved to compact audio cassettes. One example of the software developed for the Spectrum is Man-Eating Budgies. Man-Eating Budgies is a video game developed by Artic computing Ltd for the Sinclair Spectrum ZX81 1K. The code for the game is only nineteen lines long.
An example of a more modern video game is GuildWars. GuildWars is an online role-playing game developed by ArenaNet in 2005. Players interact with a 3D world through an avatar. The avatar is able to perform a variety of actions including walking and running, fighting, as well as being able to interact objects and other players. GuildWars takes around 500MB of disk space. Although a lot of this is taken up by graphics, it includes millions of lines of actual program code. These two examples show how code has advanced in complexity and size over the years.
Early computational machines and programmable machines¶
There are many earlier precursors of modern computers. These include mathematical computing devices, such as the Abacus and Slide Rule. Complex devices were constructed, such as the ancient Greek Antikythera mechanism, an astronomical calculator, and robotic automata such as Vaucanson’s Digesting Duck.
Many machines carry out clever and complex tasks. However, most of these machines are not comparable to computers because they can only perform a fixed series of operations.
Computers by contrast can be configured to perform a wide range of functions – they are programmable. However, certain ‘embedded systems’ are generally considered to be a kind of computer even though they only run a single fixed program.
Hero’s ancient ropebot¶
One of the most remarkable ancient machines is an automaton built by Hero (aka Heron) of Alexandra around 70 AD. It is a moving, wheeled robot designed for use in theatrical entertainment. It is powered by a heavy weight that slowly descends pulling a string that is attached to its axles. The movement of the robot is truly programmable by an ingenious system whereby the string is wound round the axles. You can see a recreation of this ancient machine on this New Scientist YouTube video.
The Jacquard programmable loom¶
Another programmable machine is the Jacquard Programmable Loom. Based on simpler machines produced by earlier French weavers, Joseph Marie Jacquard in 1801 constructed a loom which could be programmed to produce different patterns of woven cloth. The loom was programmed using boards into which holes were punched to specify the pattern and configure the machine to produce it.
Early computers and theories of computation¶
Charles Babbage was the first (1837) to design a fully programmable mechanical computer, which he called The Analytical Engine. Due to limited finance and continual revisions to the design, Babbage never actually built a working computer. Ada Lovelace is credited with writing the first computer program, which was a specification of how to compute Bernoulli numbers using the Analytical Engine.
Exercise
Conduct your own research to find out more details of the work of Babbage and Lovelace.
- What other details can you find out about the development of the Analytical Engine and the program Lovelace wrote?
When you have finished your research, share any interesting facts you have discovered using the discussion thread in Minerva. Access the thread for this topic by selecting the 'Discussion' tab in the side navigation in Minerva and selecting the 'History of programming' thread for this lesson.
Theories of computation¶
The theory of computation and computability was a subject of intense interest during the 1930s, 40s and 50s. Several mathematicians, such as Turing, Church, Kleene and Post, proposed different mathematical models of the process of automated computation. The best known of these is called the Turing Machine. The Turing machine is a hypothetical machine that can simulate any computer algorithm. Subsequently all these models were shown to be essentially equivalent.
The Church-Turing Thesis proposed in 1936 is the conjecture that all computational mechanisms are in fact either more limited than or equivalent in their computing capabilities to a Turing machine.
Exercise
Conduct you own research to find out more details of early computing machines and of Alan Turing’s life and work.
-
What other examples of early computing machines can you find?
-
What other achievements is Alan Turing famous for?
When you have finished your research, share any interesting facts you have discovered using the discussion thread in Minerva. Access the thread for this topic by selecting the 'Discussion' tab in the side navigation in Minerva and selecting the 'History of programming' thread for this lesson.
Machine code¶
Machine code is a form of digital (binary) information that is processed by and determines the actions performed by a computer’s Central Processing Unit (CPU). This code is normally stored as a sequence of bytes in memory, and the fundamental functionality of a CPU is to execute this code as a sequence of instructions. The actions resulting from these instructions include:
- logical and arithmetic manipulation of digital data
- transfer of data from one memory location to another (or to/from some peripheral device)
- making the sequence of execution jump to a new memory location.
Z80 machine code¶
An example of what machine code is and how it works, is the code used on the old Z80 chip. The Z80 chip was used in the Sinclair ZX80 which was one of the first home computers. The Z80 CPU has 8 main registers designated A, B, C, D, E, F, H, L (as well as some other special registers). Each of these can store a Byte (8 binary digits).
The CPU performs the following kinds of operations:
- load a byte into a register
- copy bytes from one register to another
- copy bytes from a register to a memory location or vice versa
- and perform arithmetic operations on register contents.
Example Z80 instructions¶
Each machine instruction executed by the chip is also encoded in one byte. So there are 256 different operation codes. Here are some of the more straightforward operations:
Hex Code Mnemonic Operation
3E LD A, 6 load A with number 6
78 LD A, B copy contents of B into A
67 LD H, A copy contents of A into H
77 LD (HL) A copy contents of A to mem loc HL
7E LD A (HL) load A with the contents of mem loc HL
3C INC A add 1 to contents of A
80 ADD A, B add A to B and put result in A
The registers H and L store the high and low bytes of a two-byte memory address. So the chip can address 64K of memory.
Machine code execution¶
In running a machine code programme the CPU processes a sequence of bytes stored in memory, interpreting each byte as an instruction according the operation coding. Some bytes in machine code will be interpreted as numerical data rather than instructions. For example, in executing the code sequence 3E, 06, the 06 is the number to be loaded into the A register.
The effect of running the program arises from its reading and modification of memory locations. Some locations may hold values resulting from keyboard input or may be used to determine the monitor screen display.
Languages on top of languages¶
Machine code is a language which directly controls the operation of a computer’s CPU. Such a language is called a low-level language.
One of the main drivers behind the evolution of programming languages is to expand beyond detailing machine operations. This has led to the development of high-level languages. High-level languages were developed in a form that is more similar to human language. They are also more portable and can be used on different machines, as they do not relate to the architecture or hardware of a specific computer. These languages are geared towards the conceptualisation of problems and allow the programmer to focus on how they should be solved. Examples of high-level languages include C++, Java, Pascal, Python and Visual Basic.
High level languages are run through a translator program such as a compiler or interpreter. This then translates the program from a high-level language into a low-level language such as machine code. This reduces the program to the execution of simple machine code instructions which can be processed by the CPU.
Machines within machines¶
A program is like a machine operating within another machine. So programming is like building a machine, and a programming language provides the toolkit to build it. The machine (program) is constructed from basic components which can be combined in specific ways (according to the syntax of a programming language). The program itself is just a specification of how the machine works. The program is only implemented when the compiler or interpreter translates the program into a form that is executable by the CPU.
The nature of programming¶
According to the Church-Turing Thesis, all programming languages capable of certain fundamental processing capabilities are equivalent to Turing Machines, and so have essentially the same computing power (they can perform the same calculations). However, languages differ greatly in the way computations are specified and executed. So the difference between programming languages is one of style, not of content. Or the difference is in how things can be done, not in what can be done.
Lesson complete¶
You have looked at the history of computing, from early programmable machines to programming languages. You have seen how low-level programming languages such as machine code provide a foundation upon which more sophisticated high-level programming languages can be built. You have also seen how different languages are equivalent in their essential power but vary greatly in style and usability.
In the next lesson you will be introduced to the Python programming language.
Select the next button to continue to the next lesson.