eli5 how did Ada Lovelace invent “the first computer code” before computers existed?

869 viewsMathematicsOther

as the title says. many people have told me that Ada Lovelace invented the first computer code. as far as i could find, she only invented some sort of calculation for Bernoulli (sorry for spelling) numbers.

seems to me like saying “i invented the cap to the water bottle, before the water bottle was invented”

did she do something else? am i missing something?

edit: ah! thank you everyone, i understand!!

In: Mathematics

18 Answers

Anonymous 0 Comments

Arguably Babbage himself was the first computer programmer as he also wrote algorithms that could be put onto the analytical engine, but Ada Lovelace is credited with it because she wrote some notes that clearly and explicitly show she understood you could use the analytical engine for “programs” beyond mathematical algorithms:

>[The Analytical Engine] might act upon other things besides *number*, were objects found whose mutual fundamental relations could be expressed by those of the abstract science of operations, and which should be also susceptible of adaptations to the action of the operating notation and mechanism of the engine…Supposing, for instance, that the fundamental relations of pitched sounds in the science of harmony and of musical composition were susceptible of such expression and adaptations, the engine might compose elaborate and scientific pieces of music of any degree of complexity or extent.

As far as we can tell, Babbage did not arrive to this conclusion himself and “only” thought of his computer as a multipurpose calculator.

Imagine someone invented a bucket, then decided a smaller handheld bucket would be more useful and invented a water bottle, but never made one. Then you made a cap for the water bottle and said “this could revolutionize water consumption because you can invert it without spilling, pack and transport for mass production, ensure sterility until opened”, etc. The other guy discovered the water bottle and sort of thought it would be a more useful bucket, but you are the one which realized the applications of the invention.

Anonymous 0 Comments

She didn’t come up with it whole cloth, but building on ideas being used by the mechanical looms of the day to make cloth patterns.

Anonymous 0 Comments

She contributed “code” to solve the Bernoulli equation for an Italian translation of Babbages works on the Analytical Engine.

Simulated versions of the machine required “code” that is different than Babbage gave in his own examples of how he expected it to function, so if she was working with an understanding of the machine based on what Babbage told her, her program probably would not have worked either.

She was a mathematician, and a remarkable person. I think it’s a stretch to call her the first programmer though, writing code for an unbuilt machine, that was never built, and that when simulated doesn’t operate as expected is a little bit of a stretch for me.

Anonymous 0 Comments

This video has some information about her and her role in programming.

Anonymous 0 Comments

I’d explain it to a 5yr old this way: You can picture a small gear driving a large gear. Say the small gear turns 100 times for every 1 full turn of the large gear: thats multiplication, and in reverse its division. You could also picture a gear and levers that kick another gear one tooth at a time: Addition and Subtraction. Believe me when I tell you that you can do boolean logic with Mult/Addition (AND, OR, NAND). Now say you’re Ada Lovelace and you’ve just pictured how to make a machine determine, on its own, how to switch out sets of gears and levers. Its mechanically configuring itself, dynamically, to do boolean-logic – an enormously complicated gear system intricate as clockwork. But, it can run a program! Thats why Ada Lovelace is so fundamental to CompSci.

Anonymous 0 Comments

She translated articles about the Analytical Engine and added notes to them. Here’s how the claim that she wrote the first program goes:

“Lovelace’s notes are important in the early history of computers, especially since the seventh one contained what many consider to be the first computer program—that is, an algorithm designed to be carried out by a machine. Other historians reject this perspective and point out that Babbage’s personal notes from 1837 to 1840 contain the first programs for the engine”

[https://en.wikipedia.org/wiki/Ada_Lovelace](https://en.wikipedia.org/wiki/Ada_Lovelace)

History loves a good story. Einstein’s first wife never got any credit, for example. Everyone wants to hear the story about a “kind, old guy with crazy hair”. Nobody wants to hear about him abandoning his daughter, his first wife working with him on his papers and being a better physicist but never getting credit, etc.

If you want to go deeper on the Lovelace thing, here’s Stephen Wolfam’s detailed history from when he investigated the whole story himself:

[https://writings.stephenwolfram.com/2015/12/untangling-the-tale-of-ada-lovelace/https://writings.stephenwolfram.com/2015/12/untangling-the-tale-of-ada-lovelace/](https://writings.stephenwolfram.com/2015/12/untangling-the-tale-of-ada-lovelace/https://writings.stephenwolfram.com/2015/12/untangling-the-tale-of-ada-lovelace/)

To me, it is pretty clear Babbage himself wrote the first computer programs. Ada wrote one to solve Bernoulli numbers that was very well done. So, you could say she wrote the first really nice computer program but Babbage was the person who wrote the first one.

Anonymous 0 Comments

She had the designs for a computer.

Charles Babbage is, for our purposes, the man who invented the computer. In the 1820s he began working on his Difference Engine, a mechanical computer that could do simple math quickly. That’s really all a computer is, a machine that does math. Babbage didn’t have circuit boards and microprocessors so he used gears and wheels.

The Difference Engine was never finished, but Babbage started working on its successor, the Analytical Engine. This computer would have been Turing Complete. That means it could have done any sort of math problem. Babbage didn’t finish this computer either.

But, while he was working on it he met Ada Lovelace, and told her how his computer was going to work. At which point Lovelace pointed out that a computer can do a lot more than just math.

Lovelace ended up writing some of the first computer programs. Maybe even the first entirely. Babbage explained to her how his computer would work, and she wrote programs, on paper, for that computer. She never got to run them. But had the computer existed her programs would have worked.

Her program for finding Bernoulli Numbers is especially important. It’s the first algorithm written specifically for a Turing Complete computer. You can implement her code in a modern programming language, and run it on your own computer if you wanted.

Because modern computers work the way Babbage’s Analytics Engine would have. And modern programs work the way Lovelace’s programs for the AE did.

Anonymous 0 Comments

So it’s worth remembering that programmable hardware already existed from Lovelace’s childhood. Looms were used for textile manufacture, and they could be configured via increasingly complex series of knobs, levers and dials to create different patterns, thus being — in a strict, limited sense — programmable machines.

Additionally people had been making calculating machines for aeons to make sums easier. The Romans started with the abacus, but things got increasingly inventive with slide-rules and later clockwork devices.

There was a pressure to make these calculating machines do ever more calculations. This naturally led to the idea of a general-purpose calculating machine that could be configured like a loom to do different kinds of calculations. i.e. a programmable calculating machine.

(It’s worth nothing at this point in time people were employed to do maths. They were called “computers”, so such a machine would be a programmable mechanical computer)

Charles Babbage was particularly interested in this, and so made a bunch of machines that did computations. He also sketched out designs for even more complex computational machines, but never quite figured out how certain aspects of their internals might work in his lifetime.

Lovelace wrote programs for machines he’d built, and machines he’d proposed but not fully implemented, based on the specification of what he said each knob or dial would do. The fact Babbage hadn’t quite figured out how he’d make it work didn’t detract from the fact that he’d designed an interface to a programmable computer

One such programme is [Note G](https://en.wikipedia.org/wiki/Note_G) which was written by Lovelace to calculate Bernoulli numbers (tediously essential in statistics). You can see [a translation of it to C here](https://gist.github.com/sinclairtarget/ad18ac65d277e453da5f479d6ccfc20e)

Lovelace frequently tried to help Babbage get funding to complete his inventions: and her programs were part of that.

Babbage himself was a rather odd man, so he was a poor proponent of his own work.