fourth in a course of Computer Science for Smart People

Q: What does it do?
A: It gets stuff into the computer

... and this would be enough for most reasonable people, but since computer scientists are rather obsessive about details, let us analyze further.

keyboard, chord keyboard, mouse, joystick, track pad, track ball, light pen, paddle, spaceball, graphics tablet, digitizer, scanner, digicam, digital camera ... all of them get some information into the system. What is the difference between "input" in this sense and the stuff that enters the computer from, say, an external Zip drive?
Technologically, not much. There may be a useful difference in classification because generally we speak of "input" when the data that enters is, as it were, pushed into the computer by a human for human purposes, as opposed to data pulled off some external periphal.
Anyway, all these classifications are flabby and not so meaningful. The important element is that you understand the technologies and their application. We are going to look both at the device and at the interface between the host system (fancy-wording for "the computer sitting on your desk") and the device. This interface is normally dictated by reasons of bandwidth, cost, availability on the host and coolness (as is the case in USB speakers and keyboards).


The most traditional method for data entry into a computer system is the keyboard (there is a rather extensive writeup about that). At this point, it is interesting to observe that the current computer keyboard derives from the teletype design and it contains many interesting fossile elements both in the layout (compare QWERTY and Dvorak) and in the presence of certain arcane keys, like SysRq and Esc. All these elements made perfect sense at a point and just remained there; designers find new and amusing uses for them, confusing the users to no end.
In fact, though, the fastest device for text is the chord keyboard, used in court to produce shorthand. There are chord keyboards designed for connection to computers, but they remain confined in the niche market of the wearable computer.
The pen! We should not forget the pen. In the early '90s there was a time of extreme excitement over pen-centric computing, which died out when people realized that:

  1. tapping text with a stylus on an on-screen keyboard is really slow
  2. reliable cursive handwriting recognition just did not exist
  3. not all users are willing to learn Graffiti (or similar stuff), and anyway a keyboard is always faster
Another important element here is the enormous existing user base for the computer keyboard. It is very difficult to move against that kind of inertia, particularly if the keyboard is "good enough". Thus the success of the pen only on very peculiar systems like PDAs where the form factor is king; or in context where a keyboard will be yet another failure point, like some rugged industrial data-collection pads.

Last in the list, is the great failed promise of voice recognition. A horrible and complex computational problem, it is now possible under constrained conditions, in other words:

  1. systems that can recognize a very large vocabulary, and that must learn and adapt to the pronounciation of one specific speaker
  2. systems that can recognize a very limited set of words ("yes", "no", the numbers, the names of the days...) from almost any speaker.

This is the technological limit. Additionally, there are practical implementation issues; imagine the typical open space office with 50 people all dictating with v e r y _ c l e a r _ e n u n c i a t i o n into their little microphones. Imagine what happens with ambient noise. Imagine what happens when your coworker shouts "Format C, Yes, Yes!".
I am sure you get the picture.


WIMP interfaces made pointing an absolute necessity. But even before pointing was useful, for example for moving quickly the cursor between fields in an input mask, or for navigating a section of text.
The first pointing devise were the cursor keys. Humbly sitting on your keyboard, they are nonetheless the fastest method for certain editing tasks - this is in part because of their enormous positional advantage; they are already there.
Always be suspicious of systems without cursor keys; they betray a fascist attitude.
As an historical note, some iron-age computer terminals did not have them. The user would end up simulating them with some peculiar remapping of alphabetic keys, like I J K L (notice that vi still understands that).

One pointing technology that has lost popularity is paddles (also known as pots). They are basically wheels that you can spin. Something usually moves on screen as the result of your movement. While you could design a WIMP interface using a couple of paddles (and thus would be born the Etch-a-Sketch computer), paddles were not typicall used for that; they feature in the earlies computer games (like Pong). There are also some rather cool paddles that can spin without any limit - Sony is cleverly remarketing them as jog wheels.
A paddle is, of course, one dimensional.

The king of two-dimensional pointing devices used to be the joystick (son of the airplane cloche), chiefly because they are cheap to make and they work well for games.
Basically it is a handle with some type of sensor at the base, to detect movement. Do not confuse them with the j-mouse. There are two types of joystick, one uses potentiometers (it was used in the Apple II home computer line), and the other uses switches (used by almost everybody else, it can make a clicky noise when used).
The potentiometer joystick is interesting because it gives you a position as output, while the other type gives only a direction.

Another device that gives you a position is the graphics tablet; normally used with a stylus, it never managed to become really mainstream but it is very much in use among graphic artists.
A related device that should have become king but did not was the light pen, which succumbed to the gorilla arm effect (you cannot keep your arm extended in front of you for a long time; try sometime), and to market resistance against VDUs embedded into tables. Something that works on a very similar principle but looks strikingly different is the type of pistols that you can connect to game consoles. A clever hack.

Invented by Doug Engelbart at Xerox, the computer mouse came into its own with WIMP interfaces, and it was massively popularized by the Macintosh computer line - although there were mouse-based interfaces for other machines as well, like JANE for the Apple II.
But the Macintosh was really based on the mouse, a very bold bet by Apple, particularly after the commercial failure of the Lisa.
Mice can be mechanical, or optical; some of the latter require special mousing surfaces, others do not. The optical mouse is clearly superior.
Mice have one, two or three buttons (Mac mice have one, Windows uses only two buttons, X is really happy with three). Mouse makers, in the desperate attempt to make their product look cooler and somewhat different-but-better from the others have taken to adding all sorts of insane little buttons to mice. Some day someone will make a mouse with a chord keyboard on top, Doug Engelbart will become Emperor of the World and the End of the World will be on use.

By turning a mechanical mouse upside down you obtain a trackball. They range in size from miniature marble-like things meant for use in laptop computers to grapefruit sized wonders for some arcade machines. Preference when it comes to pointing devices becomes a matter for holy wars, but I will boldly declare that I hate all trackballs, probably because of a childhood trauma.
Rather like a miniature graphics tablet, the trackpad is an alternative to trackballs; computer makers love them because they can be really thin and they have no moving parts. Which means cheaper and less prone to failure.

Some people hate it, some people love it. Anyway, the nipple mouse (known to IBM as the J mouse) is an isometric pointing device small enough to be installed between two computer keys. Probably its chief virtue is that it is cheap to build.

Another really cool device that did not make it was the spaceball; picture an orange-sized ball that you could push, pull and twist in any direction. Just perfect for 3D work.


Sound input devices take the form of a digitizer connected to an audio input of some sort. Outside of some adjustment to different signal levels (a guitar pickup is not like a microphone is not like the headphones socket on your stereo system), this is all they do.
We will get back to digitizing later on.


Once upon a time, to get a picture into a computer (supposing that the computer was able to display it), you would have to digitize some sort of video source. This involved sampling the video signal, which was normally done with specialized and expensive hardware.
Now, though, we have direct digital input of pictures. These devices, both still (digital camera, webcam, scanners) and video (DV video cameras) form the image on some CCD or CMOS sensors and do the digitizing on board. What is fed to your computer, subsequently, is information already in digital format. This is why it is so easy to make a digital camera (or a memory stick) look like a removable hard disk; because it is digital data.

The issue, then, becomes one of quality, fidelity and, more relevantly to our outlook, bandwidth. In other words, how fast do I get the data from the device to the computer? The industry answer is interfaces: USB, FireWire, SCSI, RS232 all have been used. FireWire (pioneered by Apple) aka IEEE 1394 is probably the fastest.

How much data do these beasts put out? Quite a bit, it turns out. Consider a 2000 x 1500 color image, at 24 bits per pixel. This would mean about 2000 x 1500 x 3 bytes = 9 Megabytes = 72 Megabits. A serial interface runs at 115 Kilobits per second, tops. This means that your picture takes at the very least around ten minutes to transfer. Not so good. Bluetooth runs at around one megabit per second. Not so good either.
Before you start diving into comparisons, consider that the interface speed is the maximum speed that the interface can do. It is an upper limit. The actual speed depends on how well the interface is implemented, on the speed of your host system and on other unpredictable factors, like environmental interferences, cable quality and the phase of the moon.

Physical phenomena

It turns out that you can feed into a computer data about physical phenomena. This is one of the first things that mad scientists wanted to do with their computers, and it is also a surprisingly difficult thing to do well; you run into all sorts of difficulties with calibration and real time processing.
But generally speaking, let us say that we have interfaces that can turn a voltage (an analog phenomenon) into digital information with varying speed (measured in the number of samples per second), resolution (measure in bits) and accuracy (measured in many ways).

Analog, digital, binary, decimal, A/D ... duh?

This is the moment in the lesson where the real information comes; what was before was just a product catalog. Please read the definition of analog and digital, and do a little reading on ASCII. Still with me? OK.

We normally say that the real world is analog, and that the world inside the computer is digital. This is a bit of an oversimplification, because there are some things in the real world (like electric charge) that are quantized, that's to say, they come in discrete packets; they cannot be divided indefinitely.
These parts of reality are truly digital! But they are so on such a fine level that, for most of our everyday experience, they feel analog (or, if you prefer, continuous).
Anyway, we like to use computer to represent quantities from the real world: the number of computers in a storeroom, the amount of water in a reservoir, the average number of hair follicles on man's head. Numbers. But so far we have only shown a mapping from configurations of 8 bits to characters, and we have called it ASCII; we have never said how we represent the number 812 inside a computer.
In principle, we could represent it in an analog fashion; we could say "this capacitor, when fully charged, means; it being charged only to 81.2% means 812". This has, in fact, been done, and it is analog computing.
But since we are the digital boys, we have to do it differently.

The means that we use is the binary representation of numbers. For now we will concern ourselves with integer numbers; but there is a non-trivial method for representing a good approximation of real numbers.

Nitpicking: Of course, there is no way of representing real real numbers in a finite computer. If you need a proof, think of fractions that have an infinite decimal expansion, like 10/3 or irrational numbers like pi or e or the square root of 2; can you find a finite sum of powers of (say) 2 that represents them? You cannot.

Let us refresh the concept of a base, in the context of numbers:

in a numerical representation, the base is equal to the number of individual symbols in the system. The symbols are called cyphers.

In the everyday base 10, also called decimal, we have 10 symbols: 0 1 2 3 4 5 6 7 8 9.
In base 8, called octal, we have 8 symbols: 0 1 2 3 4 5 6 7.
In base 2, called binary, we have only 2 symbols: 0 1.
In base 16, called hexadecimal, we have 16 symbols (all the symbols of base 10 and then some): 0 1 2 3 4 5 6 7 8 9 A B C D E F
Hexadecimal is very convenient because it is more easily understood than binary, but it is very easy to convert to binary. Also, any integer number you can represent in a byte is represented with two hex figures (FF 12 A0 looks neater than 255 18 160).

The Mandatory Concept:The n-th cypher of a number in a given baseis worth the value of symbol placed there multiplied by the n-th power of the base. The total value of the number is the sum of the value of its symbols.
If you fail to understand the above paragraph, you are doomed. Please, try not to be doomed.
Notice that whenever there is ambiguity about which base one is using, the base can be indicated like this: 31410 is three one four in base ten. I reccomend reading numbers in the conventional way ("three hundreds and fourteen") only when it is base 10.
Of course, 31410 is different from 3147. And of course, 3144 makes no sense whatsoever.


31410 = 3 * 102 + 1 * 101 + 4 * 100. Remember that n0 is defined as equal to 1 (for n different from zero).
And 31256 = 3*63+1*62+2*6+5 = 3 * 216 + 36 + 12 + 5 = 70110

You will notice that this notation is positional, that's to say the value of a given cypher depends on its position within the number, that's to say, the 3 at the beginning of "3178" is worth 3000; while the 3 in "1931" is worth 30, and the 3 in "2183" is worth only 3.

Useful bases for what we do with computers are: base 2 (binary), base 8 (octal) and base 16 (hexadecimal). There are writeups about converting binary to decimal, decimal to binary, binary to hexadecimal and binary to octal (both rather trivial).

Class sequence

  • The material covered in this page
  • Revision of the checkerboard assignment
  • In Design by Numbers, comparison of procedure and function
  • New assignment: Visualize the relationship between decimal numbers and base two numbers. This can be done in many ways: drawing a table with numbers or some graphical representation of numbers, or some other -more inventive- manner.

Bits and Pieces <--- O --> Writing a program