Ada Lovelace: What did the first computer program do?

Celebrated on what would be her 197th birthday, Ada Lovelace is widely credited as having written the first computer program. What did Lovelace's program do? 

This full-scale model of Charles Babbage's Difference Engine No. 2, designed, but never actually built, in the late 1840s, weighs 5 tons, is 11 feet long and seven feet high, and has 8,000 parts.

Courtesy of Marcin Wichary/Computer History Museum

December 10, 2012

The British Romantic poet Lord Byron is a hero among Greeks, having volunteered in the country's war of independence against the Ottoman Empire in the 1820s. Two decades later, Byron's daughter would become a hero among geeks, having drafted what is today considered the very first computer program. 

Her feat is all the more impressive considering that, in the 1840s, there weren't actually any computers. Back then, the word 'computer,' which first appears in English in the early 1600s, meant a person whose job it was to perform calculations. 

Instead, Lovelace, who is celebrated on Google's homepage today on what would be her 197th birthday, wrote her program on a hypothetical computer, one that had been developed by the British mathematician and engineer Charles Babbage

Columbia’s president called the police. Students say they don’t know who to trust.

Babbage first came up with his idea in 1812, when looking at tables of logarithms that had been tabulated by human computers. The tables were, Babbage observed, riddled with errors. Taking a cue from methods developed by the French government, in which logarithmic tables were created by roomfuls of workers performing simple addition and subtraction, overseen by mathematicians who had broken down the process into simple steps, Babbage envisioned the work being performed by a fast, reliable machine.

He convinced his own government to bankroll his 'Difference Engine,' as he called it. But after ten years and some £17,000 of public money, Babbage's machine, which was designed to tabulate logarithms and trigonometric functions, remained only half built. So he did what any good visionary would do: He scrapped the plans in favor of something more ambitious. 

The Analytical Engine, which, like the Difference Engine, existed mostly on paper during Babbage's lifetime, was envisioned as a general calculating device. The user would input punched cards into the machine, which would be processed by rotating barrels. The machine would output to a printer, a plotter, or a ringing bell. (Babbage was inspired by the Jacquard loom, which used punched cards to "program" certain weaves, such as a brocade or a damask.)

The design of the Analytical Engine is nothing like that of today's MacBook, but it has all the basic architecture. It distinguished between program memory and data memory. It had a separate input/output unit. It accepted conditional "if/then" expressions.

Of course, the average laptop is millions of times more powerful. According to John Graham-Cumming, a British programmer and writer who is seeking to build a real-life Analytical Engine, the machine would have 675 bytes of memory and a clock speed of 7 Hz.  Graham-Cumming told the BBC that if completed, Babbage's machine would be "about the size of a small steam train."  

Can cities criminalize camping? Here’s what to know about Supreme Court case.

The Analytical Engine was a lifelong passion for Babbage; he tinkered with designs until the end of his life, in 1871. But it took a young mathematician with a storied family history to grasp the full potential of Babbage's machine.

Lord Byron never knew Ada. He abandoned her and her mother, Annabella Milbanke, when his daughter was only a few months old, and he died when she was eight. Annabella, intent on discovering traces of Byron's volatile personality in his offspring, subjected Ada to intensive schooling in science and mathematics from a young age.

Ada showed remarkable talent in math, and by the time she was seventeen she was introduced to Charles Babbage, who called her "The Enchantress of Numbers."

Ada, who in 1838 became the Countess of Lovelace corresponded with Babbage about his Difference and Analytical engines, and, in 1842 and 1843, she translated an essay about the Analytical Engine by the Italian statesman and mathematician Luigi Menabrea.

Lovelace's notes on Menabrea's essay, which attempt to explain what the Analytical Engine is and why it is important, are longer than the actual essay itself. Note G describes, in very detailed steps, how one could use punch cards to make Babbage's engine calculate a sequence of Bernoulli numbers. Historians of science regard Note G as containing the very first computer program, making Lovelace the first programmer. 

But equally important was Lovelace's recognition of what the Analytical Engine really was: not a mere steampunk abacus, but a device that can process data of any kind, and perhaps even reason. She wrote: