From machine tools to user-interfaces
By Patrick Curran on Feb 08, 2006
Audience: (Groans)... not again!
When I were a lad I coded user-interface routines in 6502 assembly language, writing directly to the video memory and reading from the keyboard queue of a Commodore PET microcomputer with 32K of memory.
Heckler #1: Assembly language? You were lucky. We had to code in binary!
Heckler #2: Binary? Luxury! When I were a lad we didn't have ones, only zeros...
Even then, we tried to make our code reusable. We defined a simple way of encoding the contents of the 80 x 24-character monochrome screen, specifying the row and column at which prompts or data-entry fields should be displayed, the size of these fields, the expected type of input (integers, strings, selection from a list...), what validation should be performed on the input, and so on.
Given a table of such data, a general-purpose assembler routine would display the prompts, locate the cursor, track keyboard input, display characters, move the cursor, validate entries, display error and feedback messages, and eventually return. The whole thing ran in a couple of KB of memory. It worked well, and we built several commercial systems using this technique.
Fast-forward to 2006. Now NetBeans allows you to drag and drop data-aware controls onto a canvas, push a few buttons, and generate an entire UI in minutes. How did we get from there to here in only 25 years?
When I were a lad the only way to create rich user interfaces for microcomputers was to disassemble the BIOS for the system you were targeting and then hand craft your own routines. These routines would only work on the specific system for which they were designed, of course, since every system had a different BIOS.
Today the definitions of the underlying platforms are public (if they're Java-based!), and there are well defined specs for displaying text and graphics and for reading and processing user input. The JavaBeans and (upcoming) JBDT specifications support the creation of pluggable components that enable developers to rapidly construct sophisticated software applications. Since the specs are public, anyone can play.
In the 18th and early 19th centuries machinists were artisans rather than engineers. Machines—and the parts from which they were assembled—were handcrafted. Some of these machines were very sophisticated but each was unique. Each shop might invent its own jigs, allowing some re-use and reproduction within that shop (as we did with our handcrafted assembler routines). However, if your steam engine broke down you couldn't buy replacement parts off the shelf. Rather, replacements had to be handcrafted.
During the first half of the 19th century this began to change, as improvements in machine-tool technology and measuring devices made it possible to create drawings (specifications) from which interchangeable machine parts could be manufactured. "These specifications were, in effect, early standards". In 1841 Joseph Whitworth defined a standardized screw-thread system that finally enabled the production of interchangeable screws, nuts, and bolts. Some years later in the USA, William Sellers defined an alternative system in what has been called the "first successful standardization fight in history."
Interchangeable parts enabled mass production. In 1798 Eli Whitney was awarded a (US) government contract to produce 10,000 muskets in just two years—a feat that seemed impossible given current manufacturing practices. Whitney succeeded (though it took him considerably longer than two years to fulfill the contract), demonstrating for the first time that "machine tools—manned by workers who did not need the highly specialized skills of gunsmiths—could produce standardized parts to exact specifications, and that any part could be used as a component of any musket."
In the software business we still have a long way to go. We call ourselves engineers but too many of us are still artisans, struggling to come to terms with our equivalent of the Industrial Revolution. It's a painful process (as it was for handloom weavers) and there are even some Luddites among us, but the genie is out of the bottle and there's no turning back.
Standards and specifications work!