Friday, April 22, 2016

Software and Sharp Tools


In software, we are often tempted to use the most powerful, most flexible, most adaptable tool available. It might be more expensive, more complex, more error-prone, harder-to-debug, etc. But hey, we think, we're smart and careful and we're not afraid to use sharp tools to get the job done.

In the world of electonics, a soldering iron is the ultimate "sharp tool". It allows you to connect anything to anything.  But, when was the last time you used a soldering iron to connect your computer to a network cable, USB cable, video cable, power cable, speaker cable, etc? When was the last time you soldered a new video card or RAM board into your computer? The answer is "never". Outside of specialized applications (e.g. research & manufacturing), one never solders components together. At the user level (& even systems assembly), it is always better to have well-defined and unambiguous pluggable interfaces. I cannot accidentally mix up my USB cable and my power cord. I need not worry about getting my video card and memory cards mixed up plugging them into the motherboard. I don't have to worry about reversing the power and data cables to my disk drive.

Similar unique and "type-enforcing" interfaces are used in most other areas where humans can combine simpler elements, including light bulbs & sockets, plumbing pipes & fittings, hardware nuts & bolts, car keys & ignition switches, even CD/DVD disks vs LP, cassette, 8-track (the idea of a unique interface type isn't very new).

While nothing involving humans can ever be guarenteed 100% correct, simply preventing the obvious errors (e.g. power cable <-> USB plug) will eliminate 99.9% of the problem.  Shouldn't software take advantage of this simple idea?