Link to the thread: https://programming.dev/post/8969747

Hello everyone, I’ve followed this thread yesterday and noticed a few very negative reactions towards the choice of Java. I follow Java evolution from far away, but it seemed like it was evolving in a good direction since the last few years, and that performance-wise it would make sense for the back-end of a Lemmy-like platform.

Is it indeed the case? I was just curious to see that much negativity towards one of the most popular languages.

  • vcmj@programming.dev
    link
    fedilink
    arrow-up
    23
    ·
    10 months ago

    “There are only two kinds of languages: the ones people complain about and the ones nobody uses” - Bjarne Stroustrup

  • RonSijm@programming.dev
    link
    fedilink
    arrow-up
    19
    arrow-down
    1
    ·
    10 months ago

    Well Lemmy is Rust - Plus Lemmy is already an alternative for Reddit, so all the “normies” are still on Reddit - So Lemmy itself is already a bit of a niche sample size.

    Rust developers are already known (/memed) to be elitist about Rust - and “Java is Bad” is also just the general consensus among developers, especially ones using more niche languages

    • AlmightySnoo 🐢🇮🇱🇺🇦@lemmy.world
      link
      fedilink
      arrow-up
      12
      arrow-down
      10
      ·
      edit-2
      10 months ago

      Rust developers are already known (/memed) to be elitist about Rust

      They’re also extremely toxic. An example from 4 months ago when they vandalized cppreference.com :

      The meme is that most Rust devs merely shout slogans like “memory-safety” without knowing what they mean, precisely because many of them come from web dev backgrounds (this video by Prime Time proves why that’s problematic: https://www.youtube.com/watch?v=Wz0H8HFkI9U , the guy has no clue what std::unique_ptr is) and have never touched a pointer in their lives. Easy and “appealing to hobbyists” languages are always an issue as the community usually ends up becoming toxic and full of wrong practices being normalized, and a prime example of that is PHP.

      Another example is how Lemmy initially struggled to handle 10k~20k users during the Reddit exodus despite the backend being written in the “ultra-fast memory-safe totally-will-replace-C++” Rust. Why? See this: https://github.com/LemmyNet/lemmy/issues/2877 and they were doing stuff like joining huge-ass tables before the filtering. If phiresky didn’t save them with his SQL prowess Lemmy would have literally died and its backend being written in Rust would not have changed a single thing.

      Rust gives hobbyists the illusion that their projects will suddenly become fast and bug-free if they write them in Rust, and they don’t even hide that mentality as you can see that on almost every single project that’s written in Rust they list “written in Rust” as the main selling argument. This is probably the only language I’ve seen where this happens.

      Now as for the “Java bad”, I’m kind of guilty of it too. I very much dislike how academia is obsessed with UML diagrams and the “Java way” of seeing OOP and interfaces everywhere. CPUs and GPUs do not think in OOP. They do not see “objects”. They see data, registers, caches, branches but certainly not your “beautiful abstract class”. When you think you did a good job of crafting a “clean” UML diagram with lots of “nice interfaces” which you then implement using virtual polymorphism in C++ and abuse dynamic_cast, you’re torturing the CPU with indirections, cache misses and branch mispredictions. Dynamic polymorphism and virtual inheritance in particular should not be the standard way to solve problems, yet that’s exactly what academia teaches and most of those who push those ideas coincidentally also happen to be from Java backgrounds and that’s why the “Java bad” meme is still alive.

      That said, beyond academia, I think it’s obviously stupid to religiously shit on Java. Lot’s of advanced features are coming out, Android is a thing thanks to Java and lots of web services are working with high reliability thanks to it. Also obviously, one has a much better chance at landing a high-paid software engineering job if one knows Java than if one knew only Rust.

      • RonSijm@programming.dev
        link
        fedilink
        arrow-up
        9
        ·
        10 months ago

        Now as for the “Java bad”, I’m kind of guilty of it too. I very much dislike how academia is obsessed with UML diagrams.

        I’m kind of guilty of that too - in mindset - I just don’t go around and shitpost about Java.

        My dislike for Java also came from academia, since I had to use it in school. Though my main problem was just the general tool chain of Java. Like we had to use Eclipse or NetBeans. And then we had to write stuff in “JavaBeans” When instead of a normal “Person” class, you’d have to have a “PersonBean” and everything was so weird. And all the packages and references would constantly break or be missing, both in the project and even in the IDE itself…

        After moving to C# and using Visual Studio, NetBeans just feels like you’re trying to build a house with a rock instead of hammer, on an already crooked foundation.

        Though that was a long time ago. I assume things have improved. But I never really had any reason to go back to Java

        • asyncrosaurus@programming.dev
          link
          fedilink
          arrow-up
          5
          arrow-down
          1
          ·
          10 months ago

          C# will definitely spoil Java for you. Even modern Java, there’s just no going back from the .Net ecosystem without feeling like you’re timetraveling 10 years.

      • porgamrer@programming.dev
        link
        fedilink
        arrow-up
        11
        arrow-down
        4
        ·
        10 months ago

        They’re also extremely toxic. An example from 4 months ago when they vandalized cppreference.com

        What does this even mean? One dopey teenager defaces a website, so now everyone associated with Rust is toxic?

        This whole argument is just young edgelords bickering with old edgelords, in an eternal and pointless cycle.

      • BatmanAoD@programming.dev
        link
        fedilink
        arrow-up
        2
        ·
        10 months ago

        Re: “the guy has no clue what std::unique_ptr is”, are you saying that because of his assertion that unique_ptr has a non-zero cost, whereas Rust’s Box does not?

        He’s actually correct about that, although the difference is fairly minimal, and I believe the difference is outweighed by the unwinding (i.e. panic/exception handling) code that needs to be generated in both cases. But with unwinding disabled, you can see clearly that Rust generates exactly the same code for a Box as for a raw pointer, whereas C++ does not:

        The reason I looked into this is because of a Chandler Carruth talk primarily about unique_ptr called “There Are No Zero-Cost Abstractions”, which explains in detail why C++ fundamentally can’t optimize unique_ptr to generate the same code as a raw pointer.

        • AlmightySnoo 🐢🇮🇱🇺🇦@lemmy.world
          link
          fedilink
          arrow-up
          3
          arrow-down
          1
          ·
          edit-2
          10 months ago

          That’s a bad apples-to-oranges comparison, unique_ptr frees memory upon destruction, which with the raw pointer version you don’t do. The least you could do is use rvalue references. The class layout of unique_ptr is also hard to optimize away (unless via LTO) because consume isn’t in the same translation unit and the compiler has to let your binary be ABI compatible with the rest of your binaries. (Also, you’re using Clang 9 by the way, we are at version 17 now)

          This is much fairer: https://godbolt.org/z/v4PYcd8hf

          Then, if you additionally make the functions’ bodies accessible to the compiler and add a free to the raw pointer version (for fairness if you insist to have consume or foo destroy the resource), you should get an almost identical assembly code (with still an extra indirection that you’ll see in an extra mov due to the fact that the C++ compiler still doesn’t see how you use them, but IMO that should still be a textbook case for LTO), and the non-zero difference should disappear altogether once you actually use those functions and if it doesn’t you absolutely should file a bug report.

          Carruth, while an excellent presenter, has been on a “C++ standard committee bad, why don’t we do more ABI-breaking changes, y’all suck, Abseil and Carbon rule” rant spree, with that basically materialized by Google stopping active participation in Clang (haven’t followed the drama since then so not sure if Google backtracked on that decision), and it’s hard to consider him to be objective about this since he also has the Carbon project and his recent Carbon talks are painful to watch as it’s hard to ignore how he’s going from a “C++ optimization chad” that he used to be to a Google marketing/sales person.

  • TheOneCurly@lemmy.theonecurly.page
    link
    fedilink
    English
    arrow-up
    15
    ·
    10 months ago

    “Java bad” is a pretty long standing meme. I would guess that most peoples’ only experiences with java are in school and in monstrous, ancient corporate codebases.

    • Blaze@discuss.onlineOP
      link
      fedilink
      arrow-up
      3
      ·
      10 months ago

      I guess. I learned a few things though, so it seems that new version of Java are optimized so that their footprint is similar to Go? That seems a nice improvement from a few years back

    • SatouKazuma@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      10 months ago

      Speaking anecdotally, I’ve yet to see a modern Java codebase. But again, that’s just anecdotally, and I’m (truly) sure they exist. Just that I’ve not had the fortune of being around it. Is that a bad thing?

      • andnekon@programming.dev
        link
        fedilink
        arrow-up
        1
        arrow-down
        6
        ·
        10 months ago

        Java is a boilerplate-driven language designed for writing verbose, object oriented, instant-legacy code

  • muhanga@programming.dev
    link
    fedilink
    arrow-up
    14
    ·
    10 months ago

    People hate Java when they are forced to use it. Or when they switch from other language to the Java and expect same semantics and behaviour. Historically Java was quite bad in character/sense ratio this coupled with Enterprise patterns and people who have no idea how to write programs on java resulted in atrocious code bases with nightmare episodes. Currently I am writing non-stop Java for about 15 years. And I am able to tolerate Java quirks, because I know how to side step them. I don’t like Java, but given the choice I would pick it as a language that I am willing to code for money out of many others. Java have amazing ecosystem, ci/cd culture and instruments. Dunking on “bad” language is okay especially in the joke context.

    In the end there is no ideal language, they are just more or less fitting for a task or role.

  • bradboimler@kbin.social
    link
    fedilink
    arrow-up
    14
    arrow-down
    1
    ·
    10 months ago

    Modern Java is exciting. I choose it willingly for personal projects. And it remains my preference for professional ones.

    • Ashyr@sh.itjust.works
      link
      fedilink
      arrow-up
      3
      ·
      10 months ago

      I’m not a programmer, but I’m interested in your opinion. Could you explain why modern java is exciting in relatively layman terminology?

      • bradboimler@kbin.social
        link
        fedilink
        arrow-up
        6
        ·
        edit-2
        10 months ago

        I guess Java saw the writing on the wall and shifted into high gear. The rate of language development has shot up. Check out all these changes to the language.

        I get the sense that the people who think these out are smart and deliberate. I like deliberate.

        And there’s more coming. Value classes (custom, compound primitives is my understanding) is only one example. The fact that that document even exists is exciting to me. I like reading the instruction manuals for my tools!

        The standardized documentation, the culture, the tools, the libraries. After stumbling around C++ all of that was a breath of fresh air. Java is a joy for me. I’ve been doing it since the 1.1, 1.2 days.

        And so y’all know, right now I’m being paid to write Kotlin. I fully intend to integrate its styles and idioms. I get why people like it. Every now and then I do go, “Huh. That’s neat.” I’d still pick Java over it if I were given a choice. But I gotta pay the bills.

        • Ashyr@sh.itjust.works
          link
          fedilink
          arrow-up
          2
          ·
          10 months ago

          Boimler’s great, but right now you sound like Rutherford. I mean that in the best possible way.

          As I started before, I don’t really get programming, but your enthusiasm for java is evident, and I find that delightful.

          • bradboimler@kbin.social
            link
            fedilink
            arrow-up
            5
            ·
            10 months ago

            I’ll take the compliment, thank you!

            When I do it on my terms, yes, I do enjoy Java in particular and programming in general. A lot. At a certain level it’s not complicated or mystical at all. All you’re really doing is simple math (adding, subtracting, etc) on numbers, bunching them into representations that make sense for your problem (how a point is an x coordinate and a y coordinate, for example), moving little arrows that point to said representations, etc. You combine these very simple primitives into a predictable system that solves whatever you’re working on. Yeah, you do have to be able to abstract this in your brain. Pictures on paper helps sometimes; I do that myself.

            I come in with a maintainability mindset. I enjoy writing simple, to the point, straightforward code that most importantly, I can read and understand in 10 years. Java’s “verboseness” is a feature in that respect. Have you tried maintaining someone else’s Kotlin? Forgetaboutit.

  • Scoopta@programming.dev
    link
    fedilink
    arrow-up
    7
    arrow-down
    1
    ·
    10 months ago

    Personally java is still my favorite language. I program in others as well but when I’m free to pick a language java is still my go-to and I love a lot of the new features that have been added. This project is definitely really cool and I might even give it a drive.

  • aluminium@lemmy.world
    link
    fedilink
    arrow-up
    4
    arrow-down
    2
    ·
    10 months ago

    I think Java is fine and I still believe its the best beginner language, but once annotations and reflections took over, especially with stuff like Spring, Mapstruct, … . Everything turned into an unpredictable, memoryhogging, undebugable mess.

    Its not really a fault of the language, just how many people (ab)use it! Having to help out in these projects from time to time I get why people hate it!

  • stevecrox@kbin.run
    link
    fedilink
    arrow-up
    1
    ·
    9 months ago

    Java’s niche is middleware and ‘big data’, so choosing it for a Lemmy drop in replacement an excellent choice.

    Programming goes through various fads where a particular language is everyones favourite for a while (see the plethora of this is X tool … rewritten in Rust!).

    You’ve had Scala, Node.JS, Go, Python and now Rust try to supplant Java in its middleware role. Each one has tried to highlight reasons why Java is bad to justify the switch.

  • DrWypeout@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    9 months ago

    Java is not a bad object oriented language, and add lots of folks have pointed out here there are plenty of cool new things coming to the language. Lots of folks get a bad taste in school, and there’s a lot of bad Java code out there, but modern Java is a fine language. It’s powerful, can be surprisingly efficient and it’s widely supported. That said, even good Java has some downsides. The best practices are pretty boiler plate heavy. The oop structure the language is built on is going out of fashion in many domains for good reasons. Personally I find it always feels dated. While modern Java has added features that bring it up to par with other languages, it doesn’t feel as cohesive or well structured in as newer languages that either made better choices initially, or make breaking changes to correct issues with correctness, ergonomics, and maintenance.

  • zygo_histo_morpheus@programming.dev
    link
    fedilink
    arrow-up
    2
    arrow-down
    2
    ·
    10 months ago

    Honestly I do think java is kinda bad, but that doesn’t really matter that much if you’re not developing in it. Haven’t looked through the thread but it sounds like people are just being armchair elitists. I would prefer not to code in java but when I’m just using software there are a lot of things that are more important than what language is written in.