3
9 Comments

why are there so many programming languages when they all do the same thing?

You want to code for android? You need to know java or kotlin
you want to code for ios? you need to know swift or objective c
you want to code for the web? you need to know php or js or ...

In order to code for multiple platforms, you need to learn so many languages when they all do similar things.

For example: 'print()' prints text to the console in java, swift and php. It does the same thing everywhere. But its interpreted by different compilers.

Don't you think it would be great if we could cross compile our code to different platforms? Thanks

on August 19, 2020
  1. 2

    It's not really as simple as that. All these languages have trade offs based on how they are designed. Such as static compiled, dynamic compiled, intepreted, OOP types, FP langs.

    I think we as programmers have a great deal of choice and can decide on what is right for the problem we are solving. So no, I would rather not have one language.

  2. 1

    Why are there so many cars, if they all do the same thing?
    Why are there so many clothes, if..
    Why are there so many [ enter almost anything here], if...

    Hehehe!

    I guess so many factors need to be taken into account, like competition, money, improvements, security, market share, ease of use, etc etc.

  3. 1

    This is extremely oversimplified. Cross compilation is a thing that does indeed happen all over the place already. That's more or less how things like the JVM work. Scala, Kotlin, Java, and others ultimately compile down to the same bytecode, which the JVM can interpret. Typescript, Coffeescript, Dart, and others can "compile" to Javascript. A whole hell of a lot of things compile down to C.

    The question you're asking ignores the very reason why all these languages exist in the first place. They're different ways to express logic that better fits a particular paradigm. Javascript was designed from the ground-up to handle client/server interactions in a browser. Meanwhile, you have OOP languages like C++ and Java using an entirely different mindset than function languages like Haskell, very purposefully.

    On the backend, you can get very far with a single language (almost any major one, at that). Frontend is a different story, but you'll generally be fine with HTML/CSS (which aren't languages anyway) and JS... but thankfully Web Assembly is hoping to change that requirement. If WASM takes off, you could conceivably build almost anything with a single language that would, you guessed it, cross compile to a bytecode that's interpreted by any device that supports it.

    Most of the general logic will translate between most languages, so once you understand how to code, it's usually pretty simple to learn new languages. Kinda like how a chef trained in French cuisine is going to have a much easier time pulling off an Italian dish than, well, I would. That said, learning new stuff isn't a bad thing, and if you're opposed to learning new languages/frameworks as an ongoing part of your career, you're going to have a bad time.

    1. 1

      I agree with Worf. I like the comparison with cuisine. You could even go further and say that different coding languages are like actual languages to learn : it can be hard, but so rewarding when you master a new one! Learning is exciting and fun! And when you have learnt say Italian, the step to French or Spanish is much smaller than when you start from scratch. Comparison put aside, the reality is that there are lots of coding languages out there and that you need to master a few to become a good developer. And if this is your career, you will need to learn new ones along the way.
      I do observe, though, that, there is a trend towards versatile languages that allow you to do a larger scope than before. For instance, JavaScript, which used to be for front end only, is now used as well in the backend with the node.js ecosystem and in mobile apps development with React.native. Dart and Flutter allow you to develop apps for iOS and Android and soon for frontend web (I’m learning that right now, and I’m loving it). I’m sure there are other examples.

      1. 1

        Dart/Flutter is on my bucketlist for exactly the reasons you listed. I was holding off until the web stuff is working/supported, but I should probably get a headstart.

        1. 1

          There is a big promotion on Udemy until end August (90% off). You can get lots of interesting courses for cheap including “Flutter & Firebase: build a complete app for iOS & android”

  4. 2

    This comment was deleted 6 years ago