Eli5 why are there so many computer languages?

1.41K 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

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.

You are viewing 1 out of 64 answers, click here to view all answers.