Eli5 why are there so many computer languages?

1.33K views

Why are there things like c++ and python when computers have to be programmed. Why does there need to be so many languages when one could solve it?

In: 222

64 Answers

Anonymous 0 Comments

Different programming languages are designed to achieve different goals. A couple of examples:

Python’s design goal is to be a versatile language that’s easy to read and can get things up and running with relatively lower time investment from the programmer. There are trade-offs to this approach though. Python trades-off runtime speed and memory efficiency to achieve these goals.

C++’s design goal is to be a versatile language that empowers the developer to focus on the speed and efficiency of their code. It trades off ease-of-use and readability to accomplish this. C++ programs often require much more time investment from the programmer compared to an equivalent program written in Python.

It’s more complex than that in reality, but the point here is that there are trade-offs that have to be made to promote certain design goals (at the expense of others). There are different programming languages because which trade-offs you want to make will vary a lot depending on what you’re trying to accomplish.

Anonymous 0 Comments

Every computer science degree includes how to write a compiler. Every computer science graduate thinks they can invent a better language.

Anonymous 0 Comments

Could be way off base as an engineer not a programmer but my understanding is the computer itself doesn’t care what language you program in. All those programming languages are full of tools and shortcuts to make programmers lives easier. But all that work is run through a compiler that translates it into instructions for the computer.

At the base level you have a chip with billions of transistors. Transistors make gates and basic gates can build more complex gates. Those gates can then be arranged to make all sorts of logic circuits. After years of building up from those basic gates we have where we are now.

Anonymous 0 Comments

You’ve smuggled a conclusion into your question:

You’ve concluded that one language could “solve it” when in fact nobody who is an expert in computer science would agree with you.

Anonymous 0 Comments

I’m going to interpret the question a little differently than most people have. Setting aside the fact that some languages are better at specific tasks than others, why are there so many so-called “general-purpose” languages that supposedly can do anything? The answer is someone said “Hmmm, so I can do this with X, but it has this one thing I think could be better. I’m gonna make my own language and call it Y” and then another person said “Hmmmm, I think Y could be improved upon” and so on and so forth.

Anonymous 0 Comments

Way back in the day, computer programs had to actually be written by punching holes in cards to allow current to pass through or stop – essentially, people actually punched ones and zeroes in actual paper and interfaced with a computer. This process was cumbersome and confusing, so naturally engineers wanted to make things easier for themselves.

A language called FORTRAN was created to allow users to type into a machine and have the code be translated from something a human could understand into machine code. It sold itself on being “human readable,” but in reality it was still very obscure for anyone who wasn’t a computer programmer. FORTRAN gave way to more readable languages like COBOL, BASIC, B, and eventually C, which became the gold standard as far as programming languages are concerned, which is why earlier languages don’t get used anymore.

So that brings us to C, a “human readable” language that can quickly and efficiently be translated into machine code. But look at a snippet of C code and you’ll quickly see that “human readable” is still a massive overstatement. It’s a lot clearer than FORTRAN and COBOL, but it still looks like a mess of symbols and numbers to someone who has never written code before. So engineers tried to make something better.

Languages like Ruby and Python were invented to be as human readable as possible, as close to programming in English as is possible before AI and natural language processing allow us to literally talk to computers. But they came with a massive tradeoff: humans don’t think like computers do. Computers, at their core, only care about ones, zeroes, and minor binary arithmetic operations. This means that decimal calculations and high-level concepts like what we actually want our apps to do will look vastly different at the level of human understanding and computer understanding. It turns out, as far as writing code in the language of computers, C is about as human readable as we’re going to get.

So what does this mean? It means that if we want code to be executed very quickly, and we want complete control over what the circuits are doing in our machine, we have to still write in a fiddly language like C (a “low-level language.”) If time, power usage, and hardware wear are not immediate concerns, we can write the same program in an easier-to-read language such as Python (a “high-level language.”)

Another concern is that not all computer circuits are created equal. Intel and AMD, for example, make competing processors, each of which might behave differently even when given the same C code. This is a problem solved by a language like Java or C#, which while somewhere between C and Python in terms of readability, involve an extra layer of abstraction such that code written in these languages can run on any machine. Once again, the tradeoff is that because of that layer of abstraction, whether it’s an extra translating step or a virtual machine (emulator), requires more time and processing power.

In most cases, particularly if you’re just a hobby programmer, it will not matter what language you’re writing in. But most large scale software programs have their reasons for being written in the language they are. Every language has its own advantages and disadvantages.

Anonymous 0 Comments

I’ll be cutting many corners since this is ELI5

People used to code in not a language but in binary, evidently it was not easy so someone came with assembly which is way better than looking at hex numbers all day. You had the full control and speed but required a solid understanding of the code structure since even the most basic operation can take many lines.

Later, someone decided they can do better by designing a language with common code structures like loops or comparison built-in so you wouldn’t have to write them from scratch every time but kept the control of the hardware if you need it, now you have C.

C was good, C was fast, C was easier to learn by more people than Assembly, but it let you make mistakes and expected you to know better. In C you could borrow some memory and never return it back, like your neighbor who borrowed your dvd player and never returned either.

With C you would have a lost of functions you can call to perform numerous tasks bit you would have to know all of them by heart, and it is like to memorize a phonebook. Someone decided to make it easier to group functions into objects so it would be easier to design more complex applications, hence came the C++.

Someone else said C++ is good, but does not require discipline so let’s make things like memory management easier, also make it run on other devices too. Here comes the Java, familiar to C++ but better!

Story goes on and on forever. Each time someone believed then do better, solve a specific issue and make people’s (developers’) lives easier, and sure they did, otherwise we would have all the technology we have right now.

Anonymous 0 Comments

Could be way off base as an engineer not a programmer but my understanding is the computer itself doesn’t care what language you program in. All those programming languages are full of tools and shortcuts to make programmers lives easier. But all that work is run through a compiler that translates it into instructions for the computer.

At the base level you have a chip with billions of transistors. Transistors make gates and basic gates can build more complex gates. Those gates can then be arranged to make all sorts of logic circuits. After years of building up from those basic gates we have where we are now.

Anonymous 0 Comments

At first there was Assembly. Assembly was hard to use so developers made C out of Assembly. C became the standard. Then C was hard to use, so developers made other languages like C++, Objective-C, Smalltalk, Perl, Java, Ruby and Python. And web browsers were created and needed to be able to run code inside of them, so the Javascript VM was created. The Javascript VM runs Javascript inside of it. But Javascript was too confusing in large codebases and unsafe, so Typescript was created. And Objective-C and C++ were too hard to use so Apple made Swift. And Java was too annoying to use for concurrent / parallel code so JetBrains made Kotlin. And for applications that need high speed that would typically use C or C++, Google wrote a new language that runs inside of C called Go that’s just as fast as C but is less annoying to use. Other languages trying to solve these same problems of C include Rust and Zig, made by other developers than Google. But those languages don’t have garbage collection like Go does. And on and on and on.

The point is that earlier programming languages were extremely inconvenient, verbose or had other glaring flaws. Newer ones make developer’s lives easier and try to fix problems with the older languages.

Anonymous 0 Comments

I’ll be cutting many corners since this is ELI5

People used to code in not a language but in binary, evidently it was not easy so someone came with assembly which is way better than looking at hex numbers all day. You had the full control and speed but required a solid understanding of the code structure since even the most basic operation can take many lines.

Later, someone decided they can do better by designing a language with common code structures like loops or comparison built-in so you wouldn’t have to write them from scratch every time but kept the control of the hardware if you need it, now you have C.

C was good, C was fast, C was easier to learn by more people than Assembly, but it let you make mistakes and expected you to know better. In C you could borrow some memory and never return it back, like your neighbor who borrowed your dvd player and never returned either.

With C you would have a lost of functions you can call to perform numerous tasks bit you would have to know all of them by heart, and it is like to memorize a phonebook. Someone decided to make it easier to group functions into objects so it would be easier to design more complex applications, hence came the C++.

Someone else said C++ is good, but does not require discipline so let’s make things like memory management easier, also make it run on other devices too. Here comes the Java, familiar to C++ but better!

Story goes on and on forever. Each time someone believed then do better, solve a specific issue and make people’s (developers’) lives easier, and sure they did, otherwise we would have all the technology we have right now.