Ada Lovelace - The World's First Computer Programmer?

Ada Lovelace was an English aristocrat, best known for her pioneering work on the first mechanical computers with Charles Babbage. She is widely regarded as a brilliant amateur mathematician, as the world's first computer programmer and to have envisaged the development of computing 150 years before it happened.

Unlike most of the stuff we enjoy writing about, this is something about which we are fairly expert. She is one of our heroes. We really want her to deserve her reputation, not least because she is just about the only Victorian woman that is famous for something other than being an author, actor, nurse, courtier or royalty.

Ada had an unconventional childhood. She was the only legitimate child of the poet and notorious rake Lord Byron. Her mother was Annabella Milbanke, soon to become Baroness Wentworth. Annabella was the daughter of two wealthy aristocrats. Byron married her for money, hoping to pay off his debts. He cared little for his wife, continuing to pursue a chain of affairs, mainly with actresses and men but also with his half-sister. Annabella's marriage lasted just over a year, after which she took Ada to her family home. Byron left for Italy, never to return. He died eight years later. Ada never met him.

Annabella decided that Byron had gone mad due to his poetic genius. In order to prevent Ada suffering the same fate, she resolved to prevent Ada learning anything about her father or poetry. She was a a keen amateur mathematician herself. She arranged for Ada to get a mainly scientific and mathematical education from private tutors. Ada also learned languages, literature and sewing, the essential skills for her pre-ordained future life as the wife of an aristocrat.

Ada was clearly talented, but Victorian women were excluded from universities and most men thought them too feeble and frail to do useful work. She was therefore presented at court when 17 and married off to impoverished aristocrat William King-Noel at 19. He soon became Earl of Lovelace and Viscount Ockham. She referred to herself as Ada, Countess of Lovelace, in a slightly odd mixture of her titles. He used her money to make some wise investments that eventually led him to become one of the biggest landowners in England.

The Lovelaces quickly had three children. Ada seems to have disliked them. Her preference was for more masculine pursuits, like smoking, gambling, drinking, partying, having affairs and solving mathematical puzzles. She had always been sickly, most notably when she was incapacitated for three years by a bout of measles. Her health deteriorated again in her early 30s. It started with nothing serious, but spiralled out of control through increasing doses of opiate drugs and blood letting prescribed by her doctors. She died of uterine or cervical cancer aged just 36.

Ada Lovelace's momentousness

Our interest here is in Ada's momentousness, by which we mean her lasting impact. This stems from her association with English mathematician and inventor Charles Babbage, to whom she was introduced when 17 by her favourite tutor Mary Sommerville. Their first meeting was at one of Babbage's regular and extravagant balls.

Babbage was particularly impressed that Ada asked to see the design plans for his 'Difference Engine', an advanced mechanical adding machine that was designed to calculate polynomials. He invited her back for a demonstration of his working prototype. Ada was inspired to learn more and dedicated herself to learning advanced mathematics.

Babbage and Ada got on well. Quite apart from their mutual interest in mathematics and the Difference Engine, she was looking for a father figure, having had no relationship with her own father. Babbage treated her as something of a surrogate daughter, his own daughter, who would have been roughly the same age, having died in childhood. Their skills complimented each other too. Babbage was brilliant, inventive and meticulous, but famously spikey and a poor manager of people, projects and money. Ada was imaginative, commercial, well-connected and charming.

Ada is often said to have been a brilliant mathematician. Babbage certainly respected her mathematic abilities, referring to her as 'the enchantress of numbers', and he was top mathematician in his Cambridge college. She only started learning advanced mathematics at 17. She boasted: "The more I study, the more insatiable do I feel my genius for it to be" and "That brain of mine is something more than merely mortal". Her maths tutor Professor Augustus De Morgan suggested she could become "an original mathematical investigator, perhaps of first-rate eminence". Michael Faraday wrote that she was an: "enchantress who has thrown her magic spell around the most abstract of sciences and has grasped it with a force which few masculine intellects (in our own country at least) could have exerted over it".

No one disputes that Ada was really smart and a seriously talented mathematician. But she was no Euler or Leibniz. She started too late, died too young, and had too many distractions to have really developed her mathematical skills. As far as we know, she made no original mathematical discoveries. Even so, she was almost certainly the most accomplished female mathematician of the 19th century, not least because her rivals were few and held back by male chauvinism.

In 1833, Babbage fell out with his chief engineer Joseph Clement, who promptly absconded with the only design plans for his Difference Engine. In those days design plans and tools belonged to the engineer rather than the designer or patron, so there was nothing that Babbage could do to get them back. He started thinking about designing a new machine. He realised that it could be significantly improved by making it more flexible. He came up with a design (above) for what he referred to as his 'Analytical Engine'.

Babbage's Analytical Engine was staggeringly brilliant; so advanced over the Difference Engine that it would be like Trevithick going straight from the Puffing Devil to a design for a Pacific A4. It was what IT people describe as 'Turing-complete', with the same basic architecture as a modern microprocessor. Its memory was 1000 numbers each of 40 decimal digits (i.e. roughly 16k of modern bytes; the same as the entry level Apple II). Its arithmetic unit was capable of addition, subtraction, multiplication, division and comparison. Its programs and data were stored on punch cards. Those programs could loop and conditionally branch. Its output was to a printer, punch cards or plotter. It took over 100 years before anyone came up with anything equivalent, and that was pretty much an electronic binary version of the same architecture.

Babbage lobbied the UK government to provide funding to build his Analytical Engine. Robert Peel, then Prime Minister, fended him off on the basis that Babbage had failed to deliver his Difference Engine, for which the UK Government had granted him £17,000 (enough to build a warship).

Frustrated, Babbage tried to get funding from the Italian government instead. In 1840, he gave a series of lectures on his Analytical Engine in Turin. Notes were taken by the Italian mathematician Luigi Menabrea, who went on to become Italy's Prime Minister. Two years later these notes were published in French in the Swiss journal 'Bibliothèque universelle de Genève'. Sir Charles Wheatstone, the famous English inventor and a friend of both Babbage and Lovelace, asked Ada to translate Menabrea's paper into English.

It had been a long time since we last read Ada's translation of Menabrea's paper and her Notes on it. The feature that stands out to us now is Menabrea's grasp of it. Unless he had some sort of prior inside information, it is utterly astonishing. After a few hours of lectures, with no frame of reference, he clearly understood the Analytical Engine's purpose, capabilities and operation. He must have been incredibly smart.

Babbage, having read Ada's translation, pointed out that Menabrea's paper contained some errors and omissions. He therefore suggested to Ada that she should add some notes with corrections and clarifications. These Notes ended up being twice as long as the translation and form the evidence upon which Ada's reputation is based. You can check out Fourmilab's HTML rendition of her Translation and Notes here.

Ada's Notes contain two program listings, one of which is the process to calculate Bernoulli numbers (extract above). At face value it does not look like a computer program. But it is clear us - and to other programmers that have looked at it - that this is a computer program. It has 'variables' which represent physical memory locations, input data, ALU fetch operations, ALU calculations, ALU store operations, loops, conditional branches and data output. We coded it up (in the ADA programming language, although we could have used virtually any programming language) and it works, apart from a bug in line 4 that is probably a printing error.

Menabrea's paper contains three algebraic process listings which were presumably copied from Babbage's lecture. We would refer to Menabrea/Babbage's listings as 'pseudocode'; a guide for programmers, whereas Ada's Notes listings are machine code programs. Two questions then. One, are pseudocode listings the same as programs? Who wrote the machine code listings in Ada's Notes?

Some IT experts categorise pseudocode as programming, but we do not. In our experience, pseudocode is analysis, written by analysts. Pseudocode gets converted into programs by programmers. If we are right, Menabrea's paper did not contain any programs and he did not publish the world's first programs. This means, exactly as Wikipedia claims, that Ada Lovelace did indeed publish the first algorithm intended to be carried out by a computer.

But did she write the programs? Allan G Bromley and others are sceptical. Babbage talks about it in his memoirs. "We discussed together the various illustrations that might be introduced: I suggested several, but the selection was entirely her own. So also was the algebraic working out of the different problems, except, indeed, that relating to the numbers of Bernoulli, which I had offered to do to save Lady Lovelace the trouble. This she sent back to me for an amendment, having detected a grave mistake which I had made in the process." It sounds like Babbage wrote the Bernoulli numbers program, in which there was a bug spotted by Ada then corrected by Babbage. If so, Babbage wrote the program.

But Babbage and Lady Lovelace were 100 years ahead of their time. The concept of analysis and programs had not been invented in the 19th century. The question is whether Babbage's 'algebraic working out' referred to the algebra behind the Bernoulli numbers program or to the machine code program or both.

Ada wrote to Babbage while working on the Notes: "My Dear Babbage. I am in much dismay at having got into so amazing a quagmire & botheration with these Numbers, that I cannot possibly get the thing done today." We could have written this ourselves. Every experienced low-level programmer will know the feeling of being trapped in a 'quagmire & botheration' about some very complicated part of a program. It is clear to us that she was debugging the Bernoulli numbers program. We interpret this to mean that Babbage supplied Ada with the pseudocode - the algebraic working out - for the Bernoulli Numbers program, which she coded up into a machine code listing. There is no other obvious explanation for why she would return it to Babbage, yet be doing her own debugging.

Of course, Babbage must have written the first computer programs, at least in his head, in order to design the Analytical Engine. But he was not a programmer. He looked on his engine from an engineering architect's perspective. His interest was in its operation and functionality, rather than how best to make it work. Doubtless Stradivari could play notes on his violins, but that does not make him a musician. It is clear to us that Ada looked on programmes like a modern programmer. We have no doubt that Ada Lovelace is the world's first computer programmer, even though Babbage wrote the world's first computer programs.

The other important aspect of Ada Lovelace's Notes is where she talks about the Analytical Engine's potential. She says: "We may consider the engine as the material and mechanical representative of analysis". Then: "... and that our actual working powers in this department of human study will be enabled more effectually than heretofore to keep pace with our theoretical knowledge of its principles and laws, through the complete control which the engine gives us over the executive manipulation of algebraical and numerical symbols."

Ada is saying that the engine can be programmed to perform any calculation, if it can be analysed into a sequence of algebraic steps. Then she is saying that the engine can help us model complicated mathematical algorithms by converting those problems into what we would now refer to as a computer program. This is exactly what we do today with problems that are too big and complicated for our brains to process, like the weather, the economy, genomics and star formation. It is an incredibly prescient statement from 150 years before such programs were even possible.

She says that during the analysis: “the nature of many subjects in that science are necessarily thrown into new lights, and more profoundly investigated". And: "in devising for mathematical truths a new form in which to record and throw themselves out for actual use, views are likely to be induced, which should again react on the more theoretical phase of the subject".

Ada is saying that breaking work down into its most fundamental steps not only provides a better understanding of the process, but it creates opportunities for improvements to that process, it creates ideas for new or replacement processes, and it suggests how all or part of the process can be applied to other applications. Only a computer programmer/analyst could realize the value and pertinence of these statements.

Ada also foresaw that the Analytical Engine could be used to process any data that could be represented by numbers. She used the example of music: "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." This is exactly what modern computers do with audio, photographs, video, Bayesian distributions and other types of non-numeric and abstract data.

These are extraordinary insights for the time. She was far more versatile and visionary than Babbage. He might have been one of the most brilliant inventors that has ever lived but, typical of a man, he looked on his machines as an engineering and mathematical challenge. His interest was in getting the machine to work. Ada used her female eyes to look at the Analytical Engine's purpose; how it could be applied to everyday and commerical needs. And she must have had a fabulous imagination. We have no doubt, exactly as her supporters claim, that Lady Ada Lovelace did indeed foresee the future of computers 150 years before it happened.

In August 1843, Ada offered to take responsibility for the commercialisation of the Analytical Engine, so that Babbage could concentrate on its design and construction. As spikey as ever, he immediately rejected her proposal. In our opinion, if Babbage had accepted Ada's proposal, we would have had mechanical business computers in the 1850s. He had the technical and engineering skills to design and build the Analytical Engine. He just lacked funding. If Ada's health had held up long enough - and one reason it did not was that Babbage rejected this proposal - we are convinced that she had the commercial acumen, the contacts and the selling power to have raised the money and to have sold the machines. Long after her death, Babbage said how much he regretted not reading her notes properly at the time. We think that he eventually realized the missed opportunity.

Disappointingly, we think that Ada's vision for computing was a monumental achievement rather than a momentous one. Babbage's Analytical Engine was never built. Notes about it were forgotten for more than 100 years. They were resurrected by Alan Turing when he was thinking about designing the world's first programmable electronic computers. But the results of Turing's work were code-breaking computers, details of which were withheld under the British Official Secrets Act until the 1970s. Modern computers derived from the ENIAC computer, designed and built at the University of Pennsylvania towards the end of WWII. Its designers had never heard of Babbage or Lovelace. They had no influence on ENIAC or the modern computers that descend from it.

Ada Lovelace's lasting legacies are her reputation as an extraordinary computer visionary, as the world's first computer programmer and as the best female mathematician of the 19th century. The respect in which she is held is reflected in the Ada programming language and Ada Lovelace Day, both of which were named in her honour. None of this counts towards our idea of momentousness, by which we mean lasting benefit. We can therefore only give her two momentousness medals, rather than the five medals we would have given if modern computers had derived in any way from her work.

Ada Lovelace tour

Ada Lovelace was born in her father's home at 13 Piccadilly Terrace, now 139 Piccadilly. It still exists as a private residence, without a plaque to Ada or her father. Five weeks later, no longer willing to accept her husband's serial infidelities, especially that with his half-sister Augusta, Annabella took Ada and left him.

Annabella and Ada first moved to Branch Hill, Hampstead, then to the Milbanke family home at Mallory Hall, Kirkby Mallory, Leicestershire. It has been demolished. Mallory Park race track was built on the grounds. To celebrate the 200th anniversary of her birth, they unveiled a blue plaque explaining that she lived here as a child.

Annabella was not a close or attentive mother. Ada was often dumped with relatives or governesses in a string of rented properties while her mother tried quack cures for a long list of real and imagined ailments. The exception was 1826 when Annabella and Ada spent a year travelling in Europe. When they returned Ada contracted measles which left her bedridden for three years. The properties they lived in during this time have been forgotten.

Ada recovered from her illnesses in time to be presented to the king aged 17. She attended many of the season's balls, then married William, Baron King in 1835. They honeymooned at his country estate Ashley Combe in Yearnor Wood near Porlock. This must have been a favourite place because they returned most summers. The house has been demolished, though a lovely gate house (above) from the late 19th century survives as the toll house for Worthy Toll Road. Ada invited Babbage to visit. The eastern end of the public footpath between Worthy and Culbone, where it passes through several tunnels (paid for with Ada's dowery), was known by the family as 'Philosopher's Walk', because it is reputed to be where Ada and Babbage discussed the Analytical Engine.

On their return from honeymoon, Ada and her husband lived at 12 (then 10) St James’s Square (above). It has a blue plaque under the ground floor window to commemorate her stay.

Charles Babbage lived and worked in his home at 1 Dorset Street, Marylebone throughout his acquaintance with Ada Lovelace and for most of the rest of his life. Ada visited him regularly at this location. The building has been demolished, but its replacement has a green plaque explaining that he lived and worked on the site.

After having children, Ada and her family moved to Ockham Park, in Ockham, Surrey. It burned down long ago. In 1846 they moved again to Horsley Park, in East Horsley, Surrey. It has been demolished. In 1850, the family moved to 6 Great Cumberland Place, where Ada died two years later. It too has been demolished. She appointed Babbage as her executor, with specific instructions, contrary to her mother's wishes, to be interred beside her father in the Byron family crypt inside St Mary Magdalene Church, Hucknall.

For Ada Lovelace fans this is all rather dispiriting. The only places that she is known to have spent more than a few days and that survive are 139 Piccadilly and 12 St James Square, the first of which she only occupied for a few weeks as a baby. Things are not much better with her work. A lot of her work survives, but most of it is inaccessible.

In 2002, the Science Museum in London created a complete working Difference Engine from Babbage's designs. It is usually on display, along with Babbage's own prototype Difference Engine, part of a prototype for his Analytical Engine and a later partial reconstruction of the Difference Engine made by Babbage's son. Ada's contribution to this machine was negligible. According to their letters, Ada made a significant contribution to some details of the Analytical Engine's design, but her specific input was not recorded and the machine was never built. Her reputation rests entirely on her notes to the Menabrea translation and her letters.

Ada's correspondence with Michael Faraday is held at the IET (sadly it seems from these letters that she never managed to get him into bed, despite deploying all her feminine wiles in the attempt). Her correspondence with De Morgan is held by ClayMath in America. Most of her other letters are held at the Bodleian Library in Oxford, on behalf of her family. Most of the remainder are held at the British Library. Some are held by the New York Public Library. Only those in America are on regular display. Those held in Britain tend to be shown only on Ada Lovelace anniversaries.

Again, it is all rather dispiriting for Ada fans that want to physically share her life and experiences, although her Menabrea Notes and many of her letters can be seen on the Internet.

Finally, if you ever wondered where Stella McCartney got the idea for Kate Winslet's optical illusion slimming dress, just look at Ada Lovelace's ball-gown. Lord Byron's friend John Hobhouse described her as being "a large, coarse-skinned young woman". She doesn't look it in her portrait.