Basically How To Program A Computer


View Content


Forgotten my password


We won, just !
We won, just !

Basically How To Program A Computer

Terry Barnaby


A computer is a machine that manipulates data according to a set of instructions. This is a simple introductory course on how to program a computer. I think it is quite important for people to have a basic understanding of how computers work and how they can be programmed. Much of what is taught today is used of particular computer programs such as word processors etc... A computer is much more than a passive word processor however. It is a sophisticated tool that can be programmed to perform simple or even complex tasks to aid ones work. In order to understand what a computer can really do you need to have a basic understanding as to how it works. This course aims to give that basic understanding and leads onto writing and modifying a simple game written in the Java computer language.


Computers are fundamentally electronic devices. They use the flow of electricity in complex circuits in order to be able to input, compute, store and display information. A basic knowledge of electronics is useful to provide a basis for the understanding of computers.

Binary System

Computers are primarily number processing machines. In order to understand them it is useful to know how they deal with numbers. Due to there electronic heritage and the simplicity of binary numbers their processing is based on the binary number system.

Computer Forms

There are many type of computer in normal use today. These can be classified into a number of groups.

  • Embedded Computers: These normally have a very simple computing unit dedicated to a simple task. Items having embedded computers include: Watches, washing machines, cars, televisions, cameras, games consoles etc... Some of these units have multiple computers communicating with one another.
  • Personal Computers: The ubiteques PC is what most people think of as a computer. This has been designed as a general purpose computer for general computer tasks such as word processing, Internet Web browsing, spreadsheets and general purpose computing.
  • Servers: Servers are computers designed to store and/or manipulate information for many people. They are normally connected to personal andEmbedded Computers through a network interface. Often they have no keyboard and screen attached. Servers are used for things like serving web pages, storing data etc..

General Form of a computer

Computers perform calculations and other operations on numbers. A basic computer has the following components:



  • Memory: This is an area where a computer will store infomation temporarily (while switched on). Memory is addressed using a value termed an address. This is a value from "0" up to the maximum memory size eof the computer in use.

  • Processor: The performs "calculations" on the data from input and memory and puts results into the output and memory.

  • I/O: This is the input and output to the computer. In the Greenpower computer it is implemented as a set of pins on a the computer chip.

Computers perform a set of comands using the input data and memory and write results into the memory and/or output. The set of commands is called a program. The set of program commands can consist of oneof the following types:

  • Input: Inputs data from an outside source.

  • Output: Outputs data to an outside source.

  • Memory access: Reads or writes data to internal memory.

  • Calculation: Performs a mathmatical calculation on data.

  • Decision and jump: Checks the value of data and jumps to a different section of the program. Can also loop around a section of program.


Look inside a Personal Computer

We will now look inside a typical PC and see what the components are.

Computer Programs

Computer Languages

In order to instruct a computer to perform some task we need to give it a list of instructions to be performed. At the basic electronic level this will be a list of number codes called computer opcode's. As these are difficult to understand there have been written a number of human like languages designed to program a computer. These languages have been designed to be precise, non-ambiguous languages unlike conventional human languages in order to clearly define the set of instructions to be performed and deal with the data types involved. The computer is able to translate the text of these languages into the numeric opcode's the computer needs in order to be able to run. There are three basic forms of languages:

  • Machine Code: These languages are directly linked to the machine code for the computer itself. There are many different computer architectures that each have a different set of machine opcode's. Normally programs called assemblers can take a simple language description and convert it directly into the corresponding machine code. It is difficult to program at this level as you need to know the machine inside out. However for small embedded computers it provides a fast and efficient system.
  • Compiled Languages: Programs written in these languages need to be translated by a program called a compiler into machine opcode's prior to running. Some major examples are: "C", "C++", "Fortran".
  • Interpreted Languages: Programs written in these languages are translated on the fly by a program called an interpreter. Some major examples are: "Java", "Basic", "JavaScript", "PHP", "Python"
  • Programming in C

Simple example

This shows how to program a computer using the Java computer language in a simple teaching environment called Greenfoot.

Further Work

This is just a basic introduction. There are many sources for information on computer programming and many areas of knowledge involved.