Backlog #4 - The First Programming Language

career15 min

byLucas Santos

This page was machine translated. Read original / Suggest a fix

This edition of Backlog is special because it’s the first one (and probably the only one in years) published on Christmas. Consider this email my gift to you, who follows this project that means so much to me. Thank you so much for the support 💙

To start, there would be no devs without something we could write to turn our thoughts into something useful a computer can run. We need a way, a language, to tell the computer what we want to do, and that’s how we got the idea to create programming languages.

But how did these languages come about? What’s the story behind them? And, more importantly, who created the first truly useful programming language?

Before I answer that, we need to explore the context behind how programming languages evolved. This process didn’t happen overnight, it took more than 200 years to get where we are today.

Where it all started#

Before any computer or calculating machine, and more than 100 years before Alan Turing, a French weaver named Joseph Marie Jacquard revolutionized the way looms worked. In 1804, he created and patented the famous Jacquard loom, designed to automatically create complex patterns.You thought I was going to talk about Ada Lovelace, right? Wrong.

The punched-card control mechanism of a Jacquard loom in use in 2009, Varanasi, Uttar Pradesh, India.

Ironically, the cards were sewn together

The Jacquard loom was fully programmable through punched paper cards. Each card represented one row of the pattern, and the machine could be attached to any existing loom. This simplified and cut the cost of producing fabric with more complex patterns, revolutionizing the textile industry of the time.

Manual loom with double width and Jacquard loom, Colegio del Arte Mayor de la Seda of Valencia.

A loom with the Jacquard "plugin"

While the Jacquard loom was a simple application of a DSL (Domain Specific Language, a language designed for a specific purpose), his work inspired the development of more complex languages, capable of being interpreted by different kinds of machines.

Ada Lovelace and Note G#

Thirty six years after Jacquard patented his loom,Finally, she shows up! in 1840, professor Charles Babbage was invited to give a seminar in Turin, Italy, about the progress on his most ambitious project: the analytical engine (a topic for a future Backlog). This seminar was the only public presentation Babbage ever gave about the revolutionary machine he was building.

Charles Babbage

During the talk, an engineer named Luigi Menabrea, who would later become prime minister of Italy, took detailed notes to understand how the complex model worked, a model that would later become known as the world’s first mechanical computer (even though it was never built).

A build of what the analytical engine would have looked like

Babbage had an important friend and mentee: Ada Lovelace. Since 1833, he and Ada, a brilliant mathematician and daughter of the poet Lord Byron, exchanged letters and notes about their research and mathematical progress. After a conversation with Charles Wheatstone, Ada got the suggestion to translate Luigi Menabrea’s notes into English as a way to contribute to the work. Once she finished the translation, Babbage suggested she add her own thoughts as appendices, which Ada simply called “notes”.

Augusta Ada King, Countess of Lovelace, daguerrotype portrait circa 1843

Ada Lovelace in her only "photograph", taken in 1843

Ada wrote seven notes, named A through G, detailing how the analytical engine worked. In the last one, Note G, she described an algorithm to calculate Bernoulli numbers, designed to run exclusively on Babbage’s machine. This algorithm, and this note, is widely recognized as the first computer program ever written, making Ada Lovelace the first programmer in history.

Note G

Ada’s notes were three times longer than Luigi Menabrea’s original article. Besides describing the algorithm (only in the last note, G), Ada detailed the entire workings of the analytical engine, explaining how it differed from the previous machine, the difference engine. In Note C, she introduced revolutionary concepts like loops, control flow (if, else), and functions, the first time these ideas appeared in history.A funny fact is that not even Babbage himself had thought of this for the machine. Ada’s ideas were far bigger than the ambitions of the machine’s own creator.

And she did all this without ever having even seen the machine itself (which was never fully built) or having used any part of it. And today we complain when we can’t use an API without documentation…

Plankalkül, so close…#

The world of computing stayed pretty much the same for about 100 years. But, between 1943 and 1948, a German scientist named Konrad Zuse (pronounced “Zuza”) started noticing a big problem: no existing computing language was Turing complete, which made them unsuitable for his Z1 through Z3 computers.Spoiler: Konrad Zuse is going to get an entire edition of Backlog. He’s widely recognized as the inventor of the world’s first programmable digital computer, the Z3.

Zuse’s computers started as mechanical calculating machines, similar to Babbage’s ideas. But by the time he reached the third version (the Z3), he’d created something revolutionary: a fully digital, programmable computer. Now, all that was missing was a language his computer could understand…

The Zuse Z3, the world's first digital computer

Why not create your own language? That’s exactly what Zuse did. He drew on mathematical concepts, including propositional calculus (a complex field of mathematics), to develop a programming model.

However, since implementing propositional calculus directly on a computer would be extremely hard (and it wasn’t Turing complete), Zuse decided to build his own language, called Plankalkül.

Plankalkül is widely recognized as the first high-level programming language, since it abstracted away most of the computer’s inner workings. With it, engineers didn’t have to deal directly with repetitive tasks, like manually building loops.

Even though it was a fully established language in theory, Plankalkül was never implemented on Zuse’s computers, like the Z3, even though it was developed later. The Z3 itself was programmed using punched tape on movie film, read by electromechanical relays into a 1408 bit memory (64 words of 22 bits each).I’m leaving a video about how the Z3 worked, it’s in German but there are auto-translated YouTube subtitles.

Play

Instead, his main motivation was to offer a more efficient and structured way to program, allowing the development of more sophisticated programs that were “easy to understand”.Zuse thought this was something “easy to understand”, I feel for whoever had to use it.

Primer lenguaje de programación: Plankalkül - Blog de Linube

A Plankalkül program

I’d like to explain how this “simpler” language works, but honestly, I couldn’t understand a thing (Zuse was way smarter than me). So I’ll leave you with the basics:

  • The language has only one primitive type, called S0, which represents a bit, that is, a boolean value. A bit can be 0 or… L (yeah, that’s right, why use 1, right?). So the number 2 (10 in binary) would be written as L0.
  • All other types are composite, made up of arrays or tuples of bits. For example, a sequence of 8 bits would be written as 8 x S0.
  • Variables are always local, there’s no global scope.
  • There’s no support for recursion, goto statements, or references, only direct values.
  • It supports control structures like if, else, for, and while.
  • Composite types are always arrays or tuples, with no more complex variations.
  • Uppercase letters, like V, Z, C, and R, identify variables, outputs, registers, and constants.

I imagine this made complete sense in Zuse’s head (because it sure doesn’t in mine), but unfortunately, the war and the collapse of Nazi Germany interrupted his work.

With the Allied occupation, he was banned from continuing to develop computers, and he focused his efforts on creating languages, but the language never got implemented at the time. The first working implementation of Plankalkül only happened in 1975, when Joachin Hohmann used it in his academic dissertation.

Even though it was never originally implemented, Zuse’s publication had a significant impact on the development of later languages, like ALGOL and APL, which we already covered in edition #2.

Now, the mother of ALL languages#

Up to this point, most languages were created in a somewhat handcrafted way: their creators basically structured everything they knew about computing into a working system. Some of these languages, like the APT used on the M70 that we saw in another edition, were so specific they even required special keyboards, full of exclusive symbols, quite different from what we use today.

But that started to change in 1954 with the arrival of FORTRAN (short for FORmula TRANslation), the first successful commercial programming language. Built by a team led by John Backus at IBM, FORTRAN brought a practical, efficient approach that revolutionized the way people programmed.

Tree of programming languages (https://www.levenez.com/lang/lang.pdf)

Behind these revolutionary languages, there was a huge technical challenge: getting computers to understand them.

Compilers#

Between Zuse’s invention in 1943 and 1954, any code written for a computer had to be translated directly into machine instructions specific to that hardware. It was like writing an exclusive program for each processor, using a language only that processor understood, often made up of mathematical symbols.

In 1950, a revolutionary invention showed up: the compiler. It allowed the creation of a group of languages called Autocode, which at the time were described as “code systems”. The term autocoders referred to a family of compiled languages, where the same set of instructions could be translated into machine code for different computers. In other words, you could write the code once and compile it for several machines, something unheard of until then.

The first of these languages, believe it or not, was also called Autocode. It was created in 1952 by Alick Glennie, along with its own compiler. This language is considered the first compiled language in history, even though it saw little use outside Manchester Mark I computers.

An Autocode program to calculate a cubic function

This evolution brought a radical change: now it was possible to write code using a single system, where only the compiler needed adjusting for each machine. This massively simplified the development of new programming languages and opened the door to even bigger advances in the field.

The story of FORTRAN#

At the end of 1953, John Backus pitched a bold proposal to his bosses at IBM: build a more practical and efficient alternative to Assembly for programming the IBM 704 mainframe. The idea was to make life easier for everyone, letting them focus more on the problem and less on machine instructions.

John Backus in 1977

The main thing the new language needed to solve was simplifying how math equations got into computers, building on 1952 studies that proved it was possible to convert equations directly into code.

FORTRAN had a clear goal: translate math into code. That’s where the name comes from, short for FORmula TRANslator.

The first spec of the language was finished in 1954, under the title “The IBM Mathematical Formula Translating System”. In 1957, the first FORTRAN compiler was built, and it produced machine code fast enough to convince most programmers that a high-level language could be a viable alternative, even with all its early bugs.Funny enough, John Backus created FORTRAN because he hated programming. While writing programs to calculate missile trajectories on the IBM 701, he thought: “There must be an easier way to do this.”

After 1958, FORTRAN got a reliable compiler and quickly became widely used on most IBM mainframes, establishing itself as the leading programming language of the time. It was so successful that by 1963, there were already more than 40 FORTRAN compilers.

FORTRAN was especially popular among scientists who needed to run intensive, precise calculations with long numbers. Because of that, the language kept getting improved, and it’s still recognized today as one of the fastest languages in the world for numeric processing.

The initial version of FORTRAN had 32 keywords (Go, for example, has 25) and supported:

  • Switch
  • Go to
  • Tape or block I/O
  • Arithmetic

When it was created, there were no disks or screens yet, most programs were still made on punched cards, so developers had a “form” they could use to draft, erase, and test code before transferring it to a final card.

A form for coding FORTRAN

And on those punched cards, some specific columns were set aside for control purposes, for example:

  • A C in the first column turned the whole card into a comment
  • Columns 1 through 5 were labels, used to jump back in statements like GO and IF
  • Column 6 said whether the card was a continuation of the previous one
  • Columns 7 to 72 were where you wrote the actual program
  • Columns 73 to 80 were ignored because the IBM 704 only read the first 72 columns, so they were often used for notes or identification, like the card’s sequence number and so on.Each punched card represented only ONE statement, meaning each card was one keyword or one line. The card above could have been an IF.

A FORTRAN card with a statement

Evolutions#

After the initial version, FORTRAN kept evolving, and it’s still evolving. It’s the oldest programming language still in active use, with its most recent version released in 2023. The first major update, FORTRAN II, brought a significant advance: support for procedural programming, allowing the creation of subroutines and making code more modular.

A FORTRAN II program

The initial version of FORTRAN had no functions or routines, all code had to be duplicated and copied, but in version II you could use the keywords SUBROUTINE, FUNCTION, and END to create a routine, along with CALL and RETURN. But the early versions still didn’t support recursion.

Then came FORTRAN III, which introduced the ability to write assembly directly alongside FORTRAN code. However, this version was never released as a commercial product. Instead, IBM released FORTRAN IV in 1961, bringing significant changes. The main one was removing dependencies specific to IBM machines, like the READ INPUT TAPE instruction, allowing FORTRAN to be used on computers other than IBM’s.

But maybe the most important evolution was FORTRAN 66. This version was the first to go through an official standardization process, a lot like what happened later with JavaScript. The spec was put together by the American National Standards Institute (ANSI) and a committee called BEMA. Largely based on FORTRAN IV, it brought several important features:

  • Subroutines and functions
  • New primitive types INTEGER, REAL, DOUBLE PRECISION, COMPLEX, and LOGICAL
  • The DATA keyword to set initial values
  • GO TO, IF, DO, and many others

The same FORTRAN II program in FORTRAN 66

11 years later, FORTRAN 77 is what we consider the starting point of what we use today as a programming language, including changes like:

  • Structured IF with END IF instead of GO TO and CONTINUE
  • The first use of quotes for text, since it was now possible to write on terminals
  • Adding PROGRAM to name programs

The same FORTRAN 66 program in FORTRAN 77

One interesting quirk about FORTRAN is how it handled comments and blank lines. Any line starting with the letter C was treated as a comment. However, the FORTRAN compiler read every line of the program in sequence, including blank lines, which often caused errors. To avoid problems, it was common to use an empty comment to separate one line from another.

FORTRAN kept evolving, but it was only 13 years later that a major revision showed up: FORTRAN 90. This version is one of the most commonly used to this day, since it brought significant changes you probably wouldn’t notice right away, but that made life much easier for programmers:

  • Text no longer had to be indented 6 characters before any statement1
  • Keywords could be lowercase
  • Variable names of up to 31 characters (before it was only 6)
  • Inline comments instead of taking up the whole line
  • Now you could operate on whole arrays at once
  • Recursion
  • Modules to group procedures and data together and make them available for import in other programs, the first concept of a “package”
    • This also included encapsulation, with private functions and parts of a module
  • Overloads
  • SELECT CASE, which is the first version of a switch

By now, FORTRAN programs look a lot like what we write today, here’s a hello world:

program helloworld
print *, "Hello, World!"
end program helloworld

After these versions, we still have FORTRAN 95 through 2023, which implemented many changes over the years, making FORTRAN extremely useful even today.

FORTRAN today#

FORTRAN is still widely used in critical, legacy systems, like aviation, mainframes, and applications that need extremely fast computation. Its relevance shows up especially in scenarios that demand high performance processing huge volumes of data.

The language is a common choice in fields like fluid mechanics simulations, spatial and terrestrial modeling, and calculating ocean temperatures. Thanks to its efficiency at intensive numeric calculations, FORTRAN is still heavily used in fields that rely on scientific simulations and high precision engineering.

Computing ocean speed and temperature using NEMO (written in FORTRAN)

FORTRAN code itself went through several changes until it ended up looking a lot like what we understand as programming code today, for example, below is a program that calculates the average of the numbers you enter:

program average
! Read in some numbers and take the average
! As written, if there are no data points, an average of zero is returned
! While this may not be desired behavior, it keeps this example simple
implicit none
real, allocatable :: points(:)
integer :: number_of_points
real :: average_points, positive_average, negative_average
average_points = 0.
positive_average = 0.
negative_average = 0.
write (*,*) "Input number of points to average:"
read (*,*) number_of_points
allocate (points(number_of_points))
write (*,*) "Enter the points to average:"
read (*,*) points
! Take the average by summing points and dividing by number_of_points
if (number_of_points > 0) average_points = sum(points) / number_of_points
! Now form average over positive and negative points only
if (count(points > 0.) > 0) positive_average = sum(points, points > 0.) / count(points > 0.)
if (count(points < 0.) > 0) negative_average = sum(points, points < 0.) / count(points < 0.)
! Print result to terminal stdout unit 6
write (*,'(a,g12.4)') 'Average = ', average_points
write (*,'(a,g12.4)') 'Average of positive points = ', positive_average
write (*,'(a,g12.4)') 'Average of negative points = ', negative_average
deallocate (points) ! free memory
end program average

There are still repositories today with FORTRAN code, like in games, and the language is still widely used.

Fortran GamingModern and resurrected Fortran games. Includes candidates for conversion to Fortran in other languages. - Fortran Gaminggithub.com

Legacy#

FORTRAN was the first high-level language to be widely distributed, and everything we use today is either identical to or based on some kind of implementation FORTRAN introduced. Foundational languages like COBOL, BASIC, and ALGOL were heavily influenced by FORTRAN and, in turn, influenced other languages like B, C, and everything that came after them.

I recently visited the National Museum of Computing at Bletchley Park (check it out on my Instagram), and there’s a really cool mural there with every programming language that ever existed, in an interactive map. You can check out that map here and, who knows, print it out to decorate your place:

Computer Languages HistoryA Computer Languages diagramÉric Lévénez

That wraps up this edition of Backlog! I hope you enjoyed learning more about what the very first language was and how it worked as much as I did!

Take care, and merry Christmas!

See you in the next edition!

Footnotes#

  1. Remember those 6 columns from the punched cards? Go look at the indentation in the earlier code snippets and compare.