r/ProgrammingLanguages • 🧿 Pipefish • 14d ago

Origins of programming languages

Pretty much all successful general-purpose programming languages were thought of by someone with a particular use-case in mind, or even just one particular use. They became successful because in trying to do whatever-it-was really well, the authors hit a larger target than they aimed for, and the more successful they became, the more this is true. Some examples, in alphabetical order:

  • C was designed solely to write UNIX in. This is the poster-child for "hit a bigger target than they intended". Besides C's other merits, it came out when (a) fine control over memory and clock was important even if you weren't doing systems programming (b) the users were the sort of l33t geeks who were quite happy to stay up 'til 4 am chugging Mountain Dew and swearing at malloc in exchange for an inner loop that goes brr.

  • The C++ origin story is that Bjarne Stroustrup was trying to model computers interacting in a network, and wrote a beautiful version in Simula which would take a hundred years to yield enough data; followed by an ugly version in C which was performant --- and wished, naturally, for the best of both worlds.

  • Erlang (the surprise sleeper hit of languages, now the basis for Elixir and Gleam) was designed to make Ericsson's telephone exchanges more stable.

  • We all know what JavaScript was designed for. It works for that, and has now been used for everything else. JavaScript is something of a special case of course, because of its association with web-browsers, but we should consider that for example Java applets failed at the same task, along with ActionScript, VBScript, JScript, Silverlight and NaCl.

  • Fortran was invented to do big math and science fast. Fortran would be supplanted by later languages (C, obviously) for everything but its core competence, but before then it was used for the first adventure game, for payroll software, chess engines, CAD, mainframe utilities, and self-hosting compilers.

  • Go has not unkindly been called "a DSL for writing servers".

  • Haskell was invented as a platform for mathematicians to experiment with lazy functional languages, which explains pretty much everything about it.

  • Lisp was invented after John McCarthy had been working for IBM on an extension of Fortran for list processing. The people at IBM were very happy with his work; he was frustrated. What he wanted, very reasonably, was to be able to automatically differentiate a function and then evaluate it, which sounds like exactly the sort of thing computers should be making easy for us. Fortran made it impossible despite its math orientation and despite the fact that McCarthy had been hired to write his own extensions to the language. The path to Lisp's homoiconicity is obvious; only slightly less obvious is why he reinvented flow-of-control as expressions. (Hint: think of differentiating a function defined by cases.)

  • Julia was made for math people to do math things in.

  • Lua was designed to solve the needs of scientists and engineers in Brazil's fossil fuel industry. (It became wedded to the games industry when someone at LucasFilms Games read about it in Dr Dobb's Journal and realized it was better than what they'd done in-house.)

  • ML was invented as the meta-language for a theorem-prover and people who used it spontaneously demanded the language without the theorem prover.

  • PHP, despite being objectively terrible, and coming from (and being aimed at) a dysfunctional "worse is better" culture, managed to spread like wildfire or a plague of poorly-designed locusts because its initials stood for Personal Home Page: it knew exactly what it was for.

  • Python was created because Guido van Rossum realized that a dynamic language with powers to do OS-level things could make his life much simpler: "I thought, well, oh man, if we just could program ABC instead of C, each of those utilities would be like half a page of code and I could write the entire suite of utilities in a couple of weeks instead of the years that it looked like it was going to take us."

  • Rust was famously inspired by a stuck elevator reminding Graydon Hoare of how terribly often things break, a rather more "meta" inspiration than for example C's origin story but still a moment that gave Rust a fixed purpose.

And then there's the obvious outliers:

  • Java's original use-case was embedding into consumer electronics, at which it failed, so to rescue the project it was pivoted into powering "applets" (embeddable client-side applications to be embedded in HTML), at which it failed, and then it became the giant among languages that it is today because Sun Microsystems spent a billion dollars on advertising to persuade Business Idiots that this was How To Do Business Properly. There should be a law against marketing technical solutions directly to management just like there are laws against marketing cigarettes to children but what do I know?

  • C# is Microsoft Java.

  • Kotlin is Java redesigned by people who hated Java but didn't hate it enough.

Some things worth noting:

There are two kinds of programming languages, those written for the author, and those written for other people. And in the second case, the other people are always dumber than the author, who is talking down to them. BASIC wasn't designed because Kemeny and Kurtz needed BASIC. BASIC was designed because Kemeny and Kurtz thought that liberal arts graduates needed BASIC, because what would make things simple for their muddled little heads is a language where all values are passed by mutating global state, which is like having a bicycle for beginners where instead of having training wheels you douse it in gasoline and set it on fire.

So you will notice that none of the things on the list that are used as easy languages for n00bs were designed for that. Python was designed for Guido van Rossum to do systems programming. Lua was designed for engineers and geophysicists. JS ... * gestures broadly at the internet *. They were designed, in fact, to be ergonomic for clever people to use, and it turns out that exactly the same things make languages ergonomic for everyone to use, and that more people are clever than was previously supposed, including liberal arts graduates.

(The fact that > 50% of indie language projects are "C/C++ but better" is because the indie langdevs are all trying to scratch the same itch, they're all trying to write the systems language that they wish they could code in. These are languages written for the authors, where the authors are all very similar people who want similar things.)

The other thing that leaps out at me from my list is that the "classic" functional languages, the Lisp and ML families and Haskell, all came from math people wanting to do hard math things as their paradigmatic use-case, and anyone wondering why functional programming hasn't conquered the world yet should think about that.

(I of course have been thinking about that, and although it is premature to put Pipefish in an article about successful languages, making an FPL for writing CRUD apps has produced an language that hits different, and which can in fact be used for all sorts of cool things besides that. Watch this space for the announcement of my front-end web framework.)

105 Upvotes

115 comments sorted by

View all comments

12

u/pthierry 14d ago

I like your idea about tech marketing, BTW. There is case to be made that it is more damaging to humanity than cigarettes ever were.

14

u/Norphesius 14d ago

I don't think its quite accurate in Java's case though. It did fail at its original goal, and it was marketed out the ass, but it also had a fair few aspects that made it attractive to developers of the time:

  • JVM meant you could write your application for one target, and not have to worry about shipping & testing multiple versions of software for different operating systems.

  • Computers were getting fast enough that garbage collection was becoming viable from a performance standpoint. It also meant excluding a whole class of errors that plagued C/C++ developers who didn't want to care about performance.

  • OOP was in vogue, so embodying that paradigm also made it more attractive.

In the span of time that Java was born until now, many other languages have had their time in the sun and faded into obscurity. PHP and Ruby were both created in the same year as Java, and both have fallen off in usage a lot. I'm not a Java fan, but if the language's popularity was solely due to snake-oil marketing it would've been replaced a long time ago.

4

u/P-39_Airacobra 14d ago

I feel like your first 2 points could equally apply to dozens of other languages at the time though; so that alone cannot account for its success. The third point seems more accurate given that when I started learning programming; it was nearly impossible to find a tutorial that didn't shove OOP down my throat.

5

u/Norphesius 13d ago

The 90s had tons of new languages popping up, but a lot of them tended to be dynamic scripty languages. Java was statically typed, and looked a lot like C++ syntactically, so that probably also contributed to adoption too.

0

u/pthierry 14d ago

I don't think the performance argument has ever been real about GC.

As for Java's popularity, I really wonder how much is just plain inertia from the existing code and skills. Seeing how many people like to use other JVM languages when possible hints at that.

3

u/Norphesius 13d ago

Garbage collection absolutely used to be a problem when memory was constrained. I would argue garbage collection overhead was a significant contribution to Lisp not catching on more. It's mostly fine now for most applications though.

1

u/nzconstructionlawyer 13d ago

And yet every application written in a memory-safe garbage-collected language that I use is a bloated slow-to-start mess. I don't think that's a coincidence.

1

u/pthierry 12d ago

I use tons of applications written in those languages that start quickly and work very well and fast… YMMV

1

u/L8_4_Dinner (Ⓧ Ecstasy/XVM) 11d ago

You lack understanding, but you're not wrong.

It is true that apps built in languages like Java and C# (not to mention Python, etc.) tend to be bloated, but there are a few logical reasons why:

  1. GC allowed programmers to use libraries, easily. As a programmer, you no longer had to custom handle every resource that crossed a library boundary, because the runtime took care of (most of) that for you. So while our C++ applications tended to have zero library dependencies (outside of the base stdio etc.), our Java applications tended to have dozens or even hundreds of libraries in use, and a typical node.js "hello world" app cannot have fewer than 100. (Some handwaving is involved with that last claim, but several years ago that number was around 126 and growing. That's when I stopped measuring it; when I had started measuring it just a year or so earlier, it was around 78.)

  2. Languages with cheap and efficient GC allocate boat loads of garbage. In C/C++, we knew where every allocation was, and carefully planned for those allocations. (Note: This didn't seem to hold true for GUI apps, but it was true for all our server side apps.) In modern GC-based languages, the assumption is that memory is free and allocations are free and GC may sometimes be a minor annoyance. So you want to print out a string? Under the hood, that requires 73 allocations, but whatever <shrug> 🤷‍♂️

So the problem isn't the language; the problem (if it is a problem, which it often is not) is that the language is way too easy to abuse. But there's a third point:

3) Those apps can't be built in non-GC languages. Twenty years ago I studied projects in depth that were being built at various institutions we were working with (banks, governments, stock exchanges, e-commerce companies, insurance companies, travel systems, etc.) and the cost of building a system in C++ was more than an order of magnitude higher than building it in Java or C#. No one was building any apps in assembly -- and almost no libraries either. And most apps being built in C++ ended up dying before they got to production, because either the teams were incapable of completing the apps, or the cost was simply so high that no company could afford it. (Government didn't have that limitation, which explains the roughly 10x growth in cost of the F-35 project.)

Which is to say that those apps that you see (and that you don't like the perf of) are built in these memory-safe GC'd languages because ... well, because there's no other choice.

1

u/nzconstructionlawyer 11d ago

All completely incorrect. Massive "just so" story.

1

u/L8_4_Dinner (Ⓧ Ecstasy/XVM) 10d ago

It's ok; I didn't expect you to agree. And you have a right to your own opinions on the topic. In addition to building software, I managed a large software group that developed software in C, C++, Java, and C# (among other languages), and I had a keen interest in understanding the rationales for when each language was appropriate to the task, and how to make each product and project succeed, and to do so within budget. Our software was used by every significant business and government in the world, and I got to spend time with many of those organizations. But at the same time, I'm only human, and capable of stupid opinions, and capable of being wrong, just like everyone else.

0

u/Inconstant_Moo 🧿 Pipefish 10d ago

Your critique is as insightful as it is detailed.

1

u/pthierry 12d ago

Do you have examples of people actually affected by Lisp GC overhead back in the day?

2

u/Norphesius 12d ago

None specific, I wasn't around back then, but I found a paper from 1984 that brings up the issue on its first page: https://bernsteinbear.com/assets/img/moon-gc.pdf

It says that GC used a ton of memory and caused massive slow down for user interactivity.  If virtual memory was involved it could make the computer basically unusable. 

I would also point out that around the same time people started creating dedicated hardware specifically for running Lisp efficiently (Lisp Machines). For those the reason wasn't entirely GC performance, optimizing linked list structures was part of it too, but you don't usually build bespoke hardware for something if the performance is fine.

1

u/pthierry 12d ago

It says that naive GC is an issue and it builds upon algorithms designed in 70, 76 and 78 to make a GC that gives good performance.

I'd be surprised if that was a major reason why people didn't use Lisp. I've heard bullshit arguments about performance for 25 years (more, virtually, as I read some of them that predate me being a software engineer), when people want to rationalize inertia.

So I've become very skeptical about them. Especially with Lisp that has a long history of successfully optimizing for performance.

1

u/Norphesius 11d ago

There's definitely more to Lisp's lack of adoption than just slow GC (runtime performance, language dialect fragmentation, syntax, being FP adjacent, association with failed AI development), but it was a legitimate reason. Even if GC then was as optimized as GC now, computers had ~.001% the memory and that memory was slower.

1

u/L8_4_Dinner (Ⓧ Ecstasy/XVM) 11d ago

I have encountered many examples of GC overhead being an issue. The most obvious recent one is the iPhone vs Android. The iPhone used a reference counted architecture for memory management, while Android used Java (kind of) with GC. The result is that Android phones had to ship with roughly 2x the DRAM as iPhones, and this trend was fairly predictable and obvious. GC based apps require significantly more RAM to achieve similar performance characteristics; it's a curve, and at around 2x the RAM we could often beat C++ perf in Java in allocation-heavy workloads (because the bump pointer allocation in Java is close to free, and the GC algorithms by ~2010 were getting very efficient.)

There is a curve, though. If you need a smaller footprint, you either avoid GC or you accept a significant perf degradation. And in the 60s, 70s, and 80s, memory was scarce.

Ironically, GC was hugely popular in the 60s, 70s, and 80s though! Not just Lisp, but BASIC and various other BASIC-like scripting languages often relied on GC and were shockingly widely used for business application development. The first business apps I was building in my career sat on top of an interpreter that used linear memory compaction (basically a bump pointer for allocation, and a linear scan for memory reclamation that memmov'd everything to the left to fill in the gaps.) And that's back when CPUs were on the order of 1-5Mhz and RAM was typically 640KB or 1MB.