Eli5 why are there so many computer languages?

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

Programming languages are used to help programmers build software that perform certain tasks. There’s not been one language invented yet that performs the best at all tasks. It’s usually because the set of interesting tasks to solve have conflicting sets of desirable attributes.

For example, Python is great at ad-hoc programming without an overarching upfront design of how one might solve a task. It achieves this by being flexible and dynamic. By being flexible and dynamic, it gives up strictness and staticness, which are desirable attributes if your task requires more safety or performance. On the flip side, c++ is stricter and requires the programmer to handle more low-level planning, but this also allows c++ programs to have lower overhead and achieve better performance in many cases.

In an analogy, Python approach to telling someone how to drive to a restaurant is like “go north on I95, exit 56, then roughly a mile until you see the green awnings”. The C++ approach would be more like “drive 15MPH onto on-ramp, look left before merging into I95, accelerating to 60MPH over 3 seconds, drive 20 miles, then look up every ten seconds until you see exit 56, slow down to exit over the course of 10 seconds, take a right turn off exit ramp, drive 0.8 miles, start looking for 345 East Bubbly Road, signal to turn onto parking lot, etc”.

You can see how Python is generally less verbose and higher level, but C++ gives you (forces you to take) more control over exact plan. Python may get you to the wrong place, or may get you there more slowly. C++ requires more work to get right, but once you get it right there’s less chance of failure.

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