r/AskComputerScience • • Aug 04 '20

Why so many computer programming languages?

Is it possible to do everything with one language like Python or C++?

I am wondering why there is so many different programming languages.

55 Upvotes

33 comments sorted by

View all comments

55

u/Aerandyl_argetlam Aug 04 '20 edited Aug 04 '20

As a recent grad, I only know yay much, but i think a simple answer is that:

Sure, in all likelihood one language could suffice for accomplishing most applications. But doing them all well, as in efficiently, makes the difference. Some languages are better at certain things than others.

I'd hazard to claim that most languages these days have developed because Person McPersons did not find languageA to be sufficient for their needs/wants, so they made their own in a way that suited them "best", and then those langauges evolved from there.

E: see next comment for a better answer than my own alone

46

u/DonaldPShimoda Aug 04 '20

Hmm.

Language design and development tends to be more about expressive capability more than efficiency.

Somebody wrote a quote on the whiteboard in my old lab attributed (without citation) to Larry Wall, which said something like:

Programming languages are distinguished not by what they make possible, but by what they make easy.

On a very fundamental level, you could write every program in the lambda calculus, or with a Turing machine. But these are not very expressive systems. There aren't any types or classes or... anything, really! There's not even support for naming variables on a Turing machine — but you can emulate the functionality with enough layers of complexity.

We develop new languages because they allow us to express these complex ideas more succinctly, and that brevity of expression gives us a certain power over using the concept in question. Haskell allows for expressing things that cannot be expressed as easily in Java or C, and vice versa.

There's a great paper from the '90s, I think, by Matthias Felleisen titled "On the Expressive Power or Programming Languages" (or something very similar to it) that explains how we can formally compare languages in terms of expressivity. Although we don't actually do this in practice, the theoretical foundation of the work supports my assertions here.


The reason I'm drawing this distinction between efficiency and expressiveness in the first place is because performance is not actually a characteristic of a language — not really. Performance is a characteristic of a language implementation. And while some languages only have one major implementation, there is still a separation between the language proper (which is exposed the programmer) and the compiler or interpreter (which determines the performance characteristics observable by the programmer).

5

u/Aerandyl_argetlam Aug 04 '20

Thank you for clarifying :) expressive capability sounds more accurate than what I was trying to convey.

2

u/DonaldPShimoda Aug 04 '20

It seemed like that was what you were getting at, but I wanted to correct the specific use of terminology for the benefit of OP and others seeking to learn about it. Thanks for understanding! Cheers. :)

3

u/thingsinjars Aug 04 '20

Well put. Recently, I wrote a short sci-fi story inspired by the expressive capability of programming languages. Bit of a niche audience but relevant here:

https://thingsinjars.com/lab/kyral/

2

u/HasFiveVowels Aug 04 '20

That quote is an excellent point.

3

u/RazarTuk Aug 04 '20

1

u/XKCD-pro-bot Aug 05 '20

Comic Title Text: Fortunately, the charging one has been solved now that we've all standardized on mini-USB. Or is it micro-USB? Shit.


Made for mobile users, to easily see xkcd comic's title text (source)