The explanation for this terminology, which most of you no doubt know already, is altogether spatial.

When books (and everything else) were typeset by hand, the compositor would pick each piece of type, in order, and put them into a composing stick.  The individual pieces of metal type would all be cast before composition started and would be stored into a pair of boxes with about 150 compartments in all.  The compartments were of different sizes, the largest being for lower case “e”, the commonest letter in the English language.  No doubt French or German type cases had a different layout.  These type cases were placed one above the other: the one with Capital letters, because they were less frequently required, was placed above and behind the one with the much more common minuscules.  The lower case was easier to reach.  Thus “upper case” and “lower case”.

Some might be tempted to think that upper case had something to do with the fact that on a computer keyboard the Shift key shows an up arrow.  This is however just a happy coincidence.  The layout of the computer keyboard is based on the layout of the typewriter keyboard.  The QWERTY arrangement of the keys was developed in order to slow the typist down, because in early typewriters the letters were carried on long spindly metal arms.  If you typed too fast there was a risk of the arms getting tangled up.  The Linotype typesetting keyboard has ETAOIN SHRDLU all together as the first two columns at the left hand side of the keyboard.  These are the most common letters in the English language.  The Linotype keyboard was designed for speed: the QWERTY keyboard for slowness.

The phrase “mind your ps and qs” may possibly derive from the print shop.  One suggestion as to its origin is that when type was being distributed (broken down after printing and returned to the appropriate section in the type case) close attention had to be paid to the distinction between the lower case version of these two letters.  As the type was of course in reverse, these two could easily be confused.  So perhaps the phase might have been “mind your bs and ds”?

A composing frame from Oxford