Programming - Principles

Today, most people don't need to know how a computer works. Most people can simply turn on a computer or a mobile phone and point at some little graphical object on the display, click a button or swipe a finger or two, and the computer does something. An example would be to get weather information from the net and display it. How to interact with a computer program is all the average person needs to know.

But, since you are going to learn how to write computer programs, you need to know a little bit about how a computer works. Your job will be to instruct the computer to do things.

Basically, writing software (computer programs) involves describing processes, procedures; it involves the authoring of algorithms. Computer programming involves developing lists of instructions - the source code representation of software The stuff that these instructions manipulate are different types of objects, e.g., numbers, words, images, sounds, etc... Creating a computer program can be like composing music, like designing a house, like creating lots of stuff. It has been argued that in its current state it is an art, not engineering.

A fair question you may have is "Why should I learn how to program a computer?" An important reason to consider learning is that the concepts underlying this will be valuable to you, regardless of whether or not you go on to make a career out of it. One thing that you will learn quickly is that a computer is very dumb, but obedient. It does exactly what you tell it to do, which is not necessarily what you wanted. Programming will help you learn the importance of clarity of expression.

Before we see what a computer programming language looks like, let's use the English language to describe how to do something as a series of steps. A common exercise that really gets you thinking about what computer programming can be like is to describe a process you are familiar with.

Describe how to make a jam sandwich.

Programming in a natural language, say the full scope of the English language, seems like a very difficult task.

Programming in a Blocks Environment

A little less than fifteen years ago, Mitchel Resnick and friends at MIT introduced a programming environment called Scratch. It provides a new approach to teaching computer programming through a graphical user interface that eliminates the possibilty of making certain mistakes common in text-based programming.

Programs are constructed by connecting blocks, each representing some functionality available in the system. The image above shows a simple program that asks the person running it for their name and then says hello. Color is used for categories that the blocks belong to. Notice that the ask block and the corresponding answer block are the same shade of blue. The shapes of the blocks determine where they can be placed to form an acceptable program. The rounded green join block fits into a rounded hole in the violet say block.

One of Scratch's strengths is the ease with which students can construct games and animated simulations and stories. Another strength is the Scratch website itself which provides access to many tutorials and a community of users with programs they've written. To learn more about Scratch, visit the Scratch Wiki.

Blocks-based programming is a great way to get started. But, as the size of the programs you want to write grows or you need a feature not available in Scratch, it's time to switch to text-based programming.

Programming languages

Almost all of the computer programming these days is done with high-level programming languages. There are lots of them and some are quite old. COBOL, FORTRAN, and Lisp were devised in the 1950s!!! As you will see, high-level languages make it easier to describe the pieces of the program you are creating. They help by letting you concentrate on what you are trying to do rather than on how you represent it in a specific computer architecture. They abstract away the specifics of the microprocessor in your computer. And, all high-level languages come with large sets of common stuff you need to do, called libraries.


One abstract layer above a computer's native language is assembler language. In assembler language, everything is given human-friendly symbolic names. The programmer works with operations that the microprocessor knows how to do, with each given a symbolic name. Objects in the microprocessor and addresses of stuff in the computer's memory can also be given meaningful names. This is actually a very big step over what a computer understands, but still tedious for writing a large program. Assembler language instructions still have a place for little snipits of software that need to interact directly with the microprocessor and/or those that are executed many, many, many times.

The processors language

So, all a computer has in it is bits. You've seen how they are used to represent stuff, pixels, numbers and characters. I've mentioned that computers perform operations on the bits, like move them around, add pairs of them together, etc... One final obvious question is: how are instructions that a computer performs represented?

Well, if you instructed a computer in its native language (machine language), you would have to write instructions in the form of (yes, once again) binary numbers. This is very, VERY hard to do. Although the pioneers of computer science did this, no one does this these days.


Computer programming is composing/authoring of a process/procedure for doing something, the source code representation of algorithms - in great detail.

Since computers do not understand English and it would be impossible for a human to write a large program as a series of binary numbers that the computer can understand, we need something in between. High-level programming languages currently fit in this category. Given a programming language that you have chosen, you then follow its rules for composing statements (or expressions) that instruct the computer to do what you want.

Because a computer is simply a very fast manipulator of bits (ones and zeros), through the the power of abstraction, computer scientists have layered levels of object representation and functionality, one on top of another. We have now been working on refining and extending these layers for over half of a century.

Some examples of programming languages

The main language we will be focusing on is Python (number 4 in this list) as it is designed with students in mind and is quite close to the English language. Exam boards often write the NEA so that it can be completed in any language, however exeprience has shown (my teaching of programming) that Python is the most accessible.

Find out who the first computer programmer was?