• deranger@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    27
    ·
    7 个月前

    Non programmer but skilled with computers type guy here: what makes Java well suited for this?

    This is probably an incorrect prejudice of mine, but I always thought those old languages are simpler and thus faster. Didn’t people used to rip on Java for being inefficient and too abstracted?

    Last language I had any experience with was C++ in high school programming class in the early 2000s, so I’m very ignorant of anything modern.

    • nfh@lemmy.world
      link
      fedilink
      English
      arrow-up
      12
      ·
      7 个月前

      The way Java is practically written, most of the overhead (read: inefficient slowdown) happens on load time, rather than in the middle of execution. The amount of speedup in hardware since the early 2000s has also definitely made programmers less worried about smaller inefficiencies.

      Languages like Python or JavaScript have a lot more overhead while they’re running, and are less well-suited to running a server that needs to respond quickly, but certainly can do the job well enough, if a bit worse compared to something like Java/C++/Rust. I suspect this is basically what they meant by Java being well-suited.

    • flamingo_pinyata@sopuli.xyz
      link
      fedilink
      English
      arrow-up
      13
      arrow-down
      2
      ·
      7 个月前

      I am a programmer but I’m not sure why people think Java is suited for anything, especially a system so sensitive to bugs. It’s so hard to write high quality readable code in Java. Everything is way more clunky, and verbose than it needs to be.

      Some major improvements were made with versions 17+ but still, it feels like walking through mud.

      It’s a language from the 1990s for the 1990s.

      Btw the performance is actually pretty good in Java, the old reputation for slowness is entirely undeserved today.

      • BrianTheeBiscuiteer@lemmy.world
        link
        fedilink
        English
        arrow-up
        7
        ·
        7 个月前

        It’s a verbose language but I don’t know if there’s any real language that encourages highly readable code beyond low-level syntax. You want to create a God-class in Python with nonsensical variables and 5 levels of nesting? The language won’t stop you.

    • BrianTheeBiscuiteer@lemmy.world
      link
      fedilink
      English
      arrow-up
      3
      ·
      7 个月前

      Other than hardware issues, which someone else mentioned, it has a lot of enterprise-grade functionality that make it more secure and auditable than a lot of other languages. And despite, or maybe because of, its large memory footprint it’s actually faster than most languages.

      I totally get any hate about writing Java though. It is a verbose language. Using Kotlin instead helps with that.