The past is so strange, its almost hard to imagine.
My co-workers were complaining about
printf() being named poorly, because in these modern times, the function doesn't cause a "printer" to do anything. Sadly I immediately knew what the problem was--perspective, and not because I'm super good at studying history so I can learn from it. I'm just old enough that I remember when things changed.
I was there when you still dialed a phone, because the phone had a "dial" on it. I was there when to send a letter to two people, you had to type the original on to two pieces of paper with a piece of carbon paper in between in order to make a "carbon copy". (Later shortened to just cc.) And I was there when a computer would "print" your program output onto paper as you ran it.
Computers are amazing, and the technology that's gone into them over the last 75 years has progressed at such a pace, that without being there, its almost hard to believe how limited, difficult, and just
different things used to be. Just look at what was considered state of the art in smartphones 10 years ago:
So wind things back a little further, to the beginning of the interactive computer experience, and you'll find a bunch of these:
This was a
Teletype, a machine for encoding typed characters either onto a paper tape (don't worry, they're long gone), or with the dawn of time-share, directly sending characters to a mainframe. The output would come back over the line and print on the giant roll of paper,
thus a key command in many languages (including BASIC, C, PERL and so many others) was
PRINT, or in the
case of C, print with formatting ...
printf().
The core of the teleprinter was a marvel of engineering, but again maybe not what you might expect, it was almost entirely mechanical:
In fact, the teleprinter wasn't even originally designed for computers, instead two of these devices were connected
together between remote locations, and an operator would type a message one one, while the same message would be output onto the second, like telegraph but simpler to operate. But like many other technologies, teletypes were co-opted into computing, and shaped it greatly. Given its slow speed for both sending and receiving characters,
Unix creators choose to keep basic commands as short as possible, and we still remember a host of two digits commands for navigating and operating on our filesystems (
cd,
ls,
rm,
df,
mv,
cp, you get the idea.)
So the next time you go to write a print statement, just remember, once apon a time, that's exactly what those first programmers were doing.
Labels: unix tty teletype print