Why are there so many programming languages?

59 views
0

Why are there so many programming languages?

In: 9

There is an element of xkcd 927 at play, but mostly the different languages do different things. There is a concept of levels of abstraction in programming languages: at one end you have assembler which is directly interpreted by the computer but is almost unintelligible to a person, at the other end you have Visual Basic or Perl which are as close to normal human language as possible, but need to be turned into something that the computer hardware actually uses.

Other examples might be Python and Matlab, which look pretty similar. Python is all things to all people and so can be used for a wide variety of tasks but is perhaps not optimised for any of them. Matlab is specifically built around handling large matrices (sort of multi-dimensional tables of data) which makes it great for research and certain sorts of maths. Anything you can do in Matlab you can probably do in Python, but your code might be messier and take longer to run.

Then there is the whole field of web languages like Java[script], these are built to let you do the sorts of things people do on websites. Originally that meant displaying text but of course now there is so much more than that.

Would you use a screwdriver to dig a huge hole in the ground? Well probably you could, but using a shovel would be much easier and faster to achieve the same result.

In the same way, in the time IT has been around, multiple specialized languages were developed to do the same things much easier. You have SQL to query relational data, you have javascript to run applications on browsers, java for enterprise applications, c++ for videogames and many others.

Obviously the same language can be used for multiple purposes, e.g. C# is used both for enterprise applications and games, but the main reason to create a new language is doing the same thing easier.

“Being easier” is also referred to the abstraction level. The C language exists because we needed a language that was easier to learn (compared to assembly) but also able to run blazing fast. Java was originally created with the idea of having a single language that worked the same on all platforms, which is not true for languages like c++.

Computers talk in 1s and 0s, humans don’t. Programming languages are ways to make it easier for human language to get converted into 1s and 0s, and the other way around.

Computers are complicated, and so is language, so programming languages are built to talk to the computer in different ways.

Some languages are designed to give the computer line by line instructions, some are designed to create stand-alone software. Some are really good at math, and some are really good at graphics.

It’s not easy for most people to “think” like a computer, so programming languages try to be as easy to use as possible. This means that they are like tools, none of them can be used for everything, so they make a kit together.

There isn’t one universal programming language because one hasn’t been made that can do everything without being impossible to learn.

* programming languages are generally somewhat specialised for use in certain applications, for example C is great for writing operating systems and hardware drivers, Perl is great for writing short scripts to manage and edit files, Julia is great for doing science, and Javascript is great for making websites – it’s proved very difficult to design a single language that works well for all of these things

* there are many different styles of programming that people prefer over others for various reasons, for example there are “declarative” programming languages in which you code various general facts and rules and state what the desired outcome is, as opposed to the more usual “imperative” languages in which you give the computer direct commands

* programming languages are often tied to specific hardware to some extent – in extreme cases you get things like APL which basically requires a special keyboard layout, but also older programming languages tend to have poor support for newer hardware features such as multi-core processors, while newer programming languages often don’t support old hardware at all

* companies often want to use their own in-house programming language instead of relying on a third-party language that they have no control over, so you often end up with languages that are very similar except for who controls them, such as C# (Microsoft) and Java (Oracle, formerly Sun Microsystems)

* programming languages never really die, because there is always code from older languages that’s still in use, and it’s generally easier to keep maintaining it in a mostly forgotten language than to rewrite the whole thing in a newer language

Because “This language sucks, I’m going to make my own!”. Boom, now we have two languages that suck.

Read up on lex and yacc if you want to go make your own. They’re not THAT crazy complicated. After you grok regex. And parse trees. And get over the 1970’s style manuals.