• Scoopta
    link
    fedilink
    arrow-up
    22
    ·
    2 months ago

    Honestly modern Java has a lot of really nice features and I think it gets a lot of unfair hate

    • TootSweet@lemmy.world
      link
      fedilink
      English
      arrow-up
      22
      arrow-down
      1
      ·
      edit-2
      2 months ago

      I write Java for a paycheck, but I really hate it.

      It feels like everything is layers and layers of overengineered cruft, each added to the precarious tower for something extremely minor. But every subsequent card in the house of cards makes it more precarious. “But look, I don’t have to write accessors.” “But look, I eliminated the need for the web.xml file.” “But look, I don’t have to understand SQL now.” But look, the codebase depends on a shit-ton of completely opaque Automagic™ that you have no hope of understanding the moment something goes wrong – which it will if you even think of changing your Java version. And since it’s practically impossible to understand what’s going on under-the-hood of whichever dependency is fubar’d this week, you have to resort to a mixture of trial-and-error and copy-pasting shit (that you also don’t understand) from StackOverflow and praying to Cthulhu something works – which is also trial-and-error because Java questions in particular have tons of just straight up wrong answers.

      To be fair, I’m the guy on my team who people come to when they run into those sorts of “I bumped up one subminor version of Mockito to fix a bug that was preventing my unit test from working but now literally half of our unit tests won’t build” or “I added the war plugin to the build.gradle and now SwaggerUI is broken.” So maybe I see more than my fair share of “well shit, I guess I’ll just spend the next three hours hunting down which magical combination of Jar version numbers will fix things” kind of problems. But damn. This shit didn’t ever happen back when I was doing Python for a paycheck.

      I don’t use Java if I don’t have to. If I have to use Java, I prefer to just use Servlets (mostly I do web development) and absolutely as few dependencies as I can possibly get away with. Fewer moving parts mean less that can break.

      • Scoopta
        link
        fedilink
        arrow-up
        6
        ·
        2 months ago

        You’re talking about Java(Jakarta) EE, my comment is primarily targeted at Java SE. I find that the Java standard library on its own and core language is pretty nice if you use modern versions like Java 21. If I had to complain it’d be about checked exceptions, they annoy me but otherwise the language is fine. I’ve never worked with the full enterprise web stack, I use servelts for web and do a large amount of Java SE desktop development, not with swing, fuck swing. Primarily LWJGL and JavaFX. I love that language, more than most. At work I use a lot of C# and I hate it, I miss Java when I have to write C#. I just don’t love it, mostly due to all the little annoyances and missing things(no labeled breaks, no diamond operator for generics, etc). I try to use Java for projects where I can but it’s not always an option.

    • Feyr@lemmy.world
      link
      fedilink
      arrow-up
      7
      arrow-down
      1
      ·
      edit-2
      2 months ago

      Yeah they almost fixed the need to compile and run with the exact same jdk version.

      The rest still applies

        • Feyr@lemmy.world
          link
          fedilink
          arrow-up
          5
          ·
          2 months ago

          Not now, not most of the time anyway. I did say mostly fixed

          That was not the case back with Java 6 ish. Even massive breakage between minor releases was common. you had to tell everybody exactly which jre to use and possibly ship it with your software