What is a Computer?

A computer is an electronic device for storing and processing data (data is coded information). A computer is any device that can be programmed and a program is a set of instructions for processing data.

A computer consists of 'hardware' - the parts that you can see and touch - and 'software' - the collection of all its available programs.

Typically, the hardware consists of a 'processor' or CPU (Central Processing Unit) which carries out the instructions in the programs and a 'memory' for storing data.

To be at all useful it also needs a way to get information in and out ('input' and 'output', often shortened to I/O).

Is an iPad a Computer?

Short answer? yes.

Longer answer? It depends how you look at it. An iPad is either a computer or it's got one inside it.

We think of a laptop as being a computer but most modern TVs have a processor and memory in them and we usually think of them as having a computer inside them.

What makes an iPad more like a computer is the fact that you can use it to run programs. You can also use it to write programs, but it isn't a popular choice for computer programmers yet because it doesn't have all the tools that a programmer needs.

What's Inside a Computer

Ports (Input and Output)

A computer is only useful because we can put information into it and get information out of it. The most obvious way we put information into computers is with a mouse and keyboard and the most obvious way we get information out is through the screen (sometimes both of these are done by a touch-screen instead). Other input methods include microphones, joysticks, cameras and the network. The network is also an output method, as are speakers, printers, and disk-drives.

There are many other input and output devices and all of them are either included as part of the computer itself, as in the case of a touch-screen, or they're connected externally (sometimes called peripherals) either via or a port or by a wireless interface such as wi-fi or bluetooth.

Many of the electronic components inside a computer, then, are responsible in one way or another for allowing it to 'talk' to peripherals. For example there will typically be a 'chipset' that is responsible for assembling the data to be sent to a video-output.

Memory

The memory of the computer is an area of circuits designed to store billions and billions of "1's and 0's" - so called "binary digits" or just "bits". All the data in a computer is encoded in bits that are moved around and stored in chunks called words. Words might be "8 bit", "16 bit", "32 bit" or "64 bit" depending on the 'architecture' of a particular computer.

The first generation of cheap home computers such as the ZX Spectrum and the Commodore 64 were 8 bit machines whereas second-generation home computers such as the Commodore Amiga were 16 bit. Typical modern computers are 64 bit, meaning that they can move around 64 bits at a time. An electronic component for moving words around is called "bus".

Eight bits is called a "byte", so it's also correct to say that each word in a ZX Spectrum was 1 byte long and each word in a modern machine is 8 bytes long.

The size of a section of memory is usually given in Kilo-bytes, kB meaning "1024 bytes" or 8192 bits. The total amount of memory in a system may be anywhere from several kB, to many Gigabytes. A Gigabyte is 1024 Megabytes and a Megabyte is 1024 Kilobytes, so a Gigabyte is 1,073,741,824 bytes, or 8,589,934,592. So a Gigabyte of memory is about eight-and-a-half billion "1's and 0's" and they are how the computer encodes all the information it is given, including its own instructions.

Processor

The processor carries out very simple operations on data. It does things like adding two numbers together, moving a single piece of data from one place in memory to another, or taking the next piece of input data from one of the input devices (a keyboard or the network for example).

The processor runs really, really fast, constantly switching from one task to another. For example, it has to send information to the screen (if it has one) to update what is displayed. It has to tell the screen what colour and brightness to make each pixel and it has to do this dozens of times each second.

At the same time as updating the screen, it has to send other outputs (networking, sound etc.), check all the inputs for any new data and run whatever programs it's actually running. Usually the processor will be running many, many programs at once and has to switch between them at the right times.

The Operating System is the most important piece of software a computer runs. It allows all of the different functions of the processor to be coordinated and it is through the operating system that most user-facing programs and applications run.

Programs

Usually, we don't write programs that the processor can run directly, we create them using software and run them through the operating system.

The operating system talks to the hardware and our programs only need to know how to talk to the operating system.

Software Stacks

When we write a javascript program and run it with Node.js, our program 'talks to' Node in a sequence of Javascript expressions, Node talks to the operating system in 'sys calls' and the operating system talks to the hardware.

Abstraction