Why are some programming languages better for certain types of projects than other programming languages, when they can all essentially do the same thing and they all seem to work the same way?

408 views

Why are some programming languages better for certain types of projects than other programming languages, when they can all essentially do the same thing and they all seem to work the same way?

In: 20

19 Answers

Anonymous 0 Comments

I haven’t seen a good ELI5 so i’ll do my best here.

All machines run ‘machine code’ which is binary data which asks the processor *do something*

How those instructions are written out, and converted to machine code, is the job of the programming language.

Languages are geared to be optimal for writing clear instructions, as well as executing their work optimally. But depending on their requirements, they might not do everything great, so there is always a trade-off.

Want to write a game engine, where every microsecond matters? And you want to optimize where the bits go so that the machine prioritizes 60fps instead of realtime AI? Then you want a language that gives you this level of control:

– vector and 3D math

– a variety of frameworks to manage graphics

– a language which is universally supported by many gaming machines

– a system robust enough to handle a configuration that optimizes your machine code for intel processors, Arm processors, AMD processors, 64bit processors, with 32bit backwards compatibility, etc

Do you want something that just lets you injest a spreadsheet and do complex math equations, but doesn’t really care about the rest? You can do this in 10 lines of code in some languages, with a guarantee that it’ll ‘just work’ across all systems.

And to be fair, they all DO do the same thing. But it’s the question of:

– how do you feed it instructions (1 line of code or 100 lines to do the same thing)?

– how does the language compile the instructions into action? (which is the job of the compiler, but I’m bundling it with the language here for simplicity)

So it’s not necessarily WHAT they do, but HOW they do it that makes a language different and perferred over others depending on the job at hand.

“Right tool for the job” is another way to explain this. There are hammers, and mallets, and rubber hammers, and sledgehammers. They’ll all get that peg in the ground, but which is the best to accomplish the task as effectively as possible?

Anonymous 0 Comments

A hammer, an anvil, and a screwdriver can all be used to put a nail in a wall.

One of them will be better at it than the other.

Programming can all do essentially the same thing. But not in the same way. Some things are easier to do in one and some in another.

If you think they all seem to work in the same way, you don’t know enough about them and haven’t used various languages enough. They really don’t.

Anonymous 0 Comments

Why is it better to build boats out of wood or fiber glass and houses out of wood or concrete? Some materials (coding languages) have properties or aspects that make them exceptionally well suits for one type of application (fiberglass for boats, concrete for houses), bad for another (concrete for boats, fiberglass for houses) or maybe reasonable (with pros and cons) for other applications (wood, houses, boats).

Anonymous 0 Comments

Programming languages are tools to allow humans to make a computer do what you want. In theory, any language can be used to create any program but realistically you want the appropriate tool for the job.

Do you want it store tons of data? Do you want it to run on the cheapest chip available? Does it have an user interface? Do you want a web page? Does it need to handle financial transactions? All these thingd affect you choices.

1. If you want the computer to do things quickly using little memory, use C.

2. If want to solve mathematical equations, use Matlab.

3. If you want to store and retrieve data, use SQL.

4. PHP and Javascript are used on web pages.

Anonymous 0 Comments

Think about it like programming languages are on a sliding scale.

On one side are languages that are easy to write and read, can run anywhere, but are relatively slow.

On the other side are languages that are very verbose, more difficult to master, can only run on one OS, but are relatively faster.

In reality, for most things, any programming language is probably fine.

But there are tasks where readability and other concessions are of more value than the little bit of speed increase that come with more complex languages.

Think data science. Most data scientists work in Python because it’s easy to read/write and has a lot of libraries designed to help with data science.

Now think about the 3d animation software that Pixar uses. It’s very complicated to render 3d images. So complicated that one frame can take minutes or hours to render. The difference between using C and Python in this case would be absolutely massive.

While the same simple program written in C and Python would have no distinguishable difference in speed to a user, it becomes an issue of scales of magnitude in time as things become more complex.

Anonymous 0 Comments

To give a more eli5 answer:

Programming languages are like a stack of layers. Every programming language is just an interface, or a library, to the layer below it.

Assembly is like an interface to the processor itself. Then C++ is an interface to Assembly. Then PHP is an interface to C++.

So although some object oriented programming languages seem to do the same thing, they’re really different interfaces to a lower language and will manipulate that lower language in varying ways for whatever it’s needed for as some of the other answers have explained.

Edit: this isn’t a description of the full stack. There are layers of interfaces between these.

Anonymous 0 Comments

ELI 5:

Computer languages, like human ones, can vary in vocabulary, structure, and actual writing style.

The one you want is the one that is most efficient for your task. That usually means they have specific commands (vocab) pre-programmed to do the complex task you want done. And often the way you ask for it, is simple and direct.

So it might be like an asian language with the complex characters. Each complex symbol carries a lot of meaning. But context is important, place it in the wrong spot and you get a different meaning.

Or the language might be easy to learn. Something like german, where new words are just old words stuck together. That makes it a very easy to just smash some things together and be understood…for the most part. But it does end up with some long words and sentences.

Anonymous 0 Comments

One thing to throw a wrench into your assumption that all programming languages do “basically the same thing”, there is a class of programming languages called Hardware Description Languages (HDL, examples include VHDL, Verilog, SystemVerilog) whose primary purpose is not to run on a processor, but intended to create hardware logic that runs concurrently (all at the same time), because HDLs are equipped to allow you to describe when exactly you want certain data where, in a deterministic (same every time, no randomness in delay unlike code run in a modern microprocessor due to process switching, interrupts, memory, etc.) way.

Theoretically, you could use a software language like C++ to describe hardware using High Level Synthesis (HLS), but issues with this is that you have much less control over the logic structures that are generated, so you could only guess at how much time or resources your logic will take before it actually gets synthesized. So for any application that is time critical, HLS is not feasible, so you have to use an HDL. On the other hand, HLS is quicker to make code for. So it’s all pros and cons to why we choose different programming languages.

Anonymous 0 Comments

Compiled languages will near always execute faster outside of unrealistic tests but cannot always be used. These languages are also more difficult to use. Scripting languages are slower and have more overhead but are easier to use.

Scripting languages end up used places they shouldn’t because companies hire for low pay and if you’re not making very much you’re not gonna do as good of a job. This seems fine until basic applications like discord are actually just google chrome and all your memory is gone 🙁