Programming

WhitelilyBiscuits


A program is a set of instructions for a computer, just like a recipe for southern biscuits for your kitchen. Usually they are written so they can be passed to anyone who can perform them, one or more times as desired.

Just as a cooking recipe can only use the resources of your particular kitchen, a computer program is written for a specific computer. 


IN THE BEGINNING - ASSEMBLERS:

Each computer had a limited set of instructions it  could perform and a limited set of resources it could use.
Early computers did not even have buttons like your calculator.
If you wanted to add, for example, you connected wires from the number register to the arithmetic unit using a plugboard.
These early computers only 
had a few registers which could hold numbers to perform arithmetic, like the display on your calculator. And they only had a small memory, locations where we could store numbers. 

And could do only a few simple operations, such as:
         load registers from memory, store registers into memory, add to register, subtract from register, etc.

As you can see, this was so clumsy that one of the first early programs replaced the wires and switches with words.
This was called assembly language. Each computer had its own assemblly language codes. And writing these programs  was called coding.

A simple program might be the same as you pressing buttons on your calculator like this:

         Program for A + B = C

INSTRUCTION      COMPUTER       CALCULATOR

enter number 1    load loc A     type first number
STORE                            type “+”
enter number 2    load loc B     type second number
ADD               ADD            type “=”

STORE             STORE loc C    type memory store


A BETTER WAY TO DO THIS - COMPILERS:

Assembly language coding was still so clumsy and error prone that people wanted to write their programs at a higher level. So next computers got so big and fast that we could write programs which looked more like the arithmetic that we could read and the computer would convert these expressions into the internal computer program for you. These programs were called compilers. Here is a simple example in the popular programming language python;

# convert kilometers to miles

factor = 0.621371

kilometers = 5.5

miles = kilometers * factor

print(kilometers, " equals ", miles, " miles")


OUTPUT:

5.500 kilometers equals 3.418 miles


==============

… more coming ...

© Gareth Harris 2018        -         Contact email: GarethHarris@mac.com         -         see also: SentimentalStargazer.com