• Ginny [they/she]@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    2
    ·
    29 days ago

    I also think Java is shit, but if you manage to get a NullPointerException while writing a hello world program, maybe anon is just not cut out for computers?

    • navi@lemmy.tespia.org
      link
      fedilink
      arrow-up
      2
      ·
      28 days ago

      I always loved that Java has a NullPointerException but doesn’t have the concept of pointers in the language (only references).

    • Serinus@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      29 days ago

      C# is nearly the same, but much, much better.

      • It doesn’t (usually) come with the Java culture 8 layers of abstraction. This isn’t in the Java language. This isn’t in OO. Yet nearly every Java programmer makes things way more complicated than it needs to be.
      • It’s a prettier language. Similar syntax with less bullshit.
      • It’s open source
      • It’s still multiplatform. Modern dotnet / C# works on anything.
      • Both Visual Studio and Visual Studio code are great IDEs that blow Eclipse out of the water
      • It’s one of the most common business languages.
      • It’s going to be supported forever.

      If I could restrict the world of programming to two languages, it’d be C# and Rust. C# for most things and Rust for a lower level language.

      • PlusMinus@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        28 days ago

        Nah, C# suffers from a lot of the same shit Java does. Needing everything to be a class is just no longer a good design choice (if it ever was). AOT support is still lacking. I don’t get, why it does not have typdefs. I think the solution / project structure is unnecessary and I could probably think of more stuff I dislike about C#. But imho, it still beats Java.

        Golang is my choice over C# any time. I strongly prefer how interfaces are handled and I actually like the error handling.

      • babybus@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        1
        ·
        28 days ago

        Thank you. If you bothered to read a 5 minutes tutorial instead of posting to 4chan, you could also reach this level of knowledge.

        • Malfeasant@lemm.ee
          link
          fedilink
          arrow-up
          0
          ·
          28 days ago

          Some of us try to understand what we’re doing, rather than just copy/paste. It’s easy to discount how difficult learning the basics of something is when you’re already past it.

    • kitnaht@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      29 days ago

      I’m pretty sure Java doesn’t have pointers, so writing a hello world application isn’t gonna fuck up nearly that hard.

      The one thing he forgot though is that your source file is probably in the folder

      com/companyname/net/classes/factory/factoryfactory/worker/lib/bin/refresh/jdk/model/ui/closebutton/press.java

      And spread out among a bunch of other directories, and the java file is like…3 lines. But there are 10k files spread all around directories like this that are all 3 lines a piece with a class definition.

      • Valmond@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        29 days ago

        They have sort of pointers, like references, that can be null…

        You just “new” stuff to it and let the “garbage” collector deal with freeing stuff up. When it feels like it.

      • perviouslyiner@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        29 days ago

        wait, so when .io gets deregistered, are a load of companies going to have to rename their root directories and rewrite all of their include statements?

        • kitnaht@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          29 days ago

          Thankfully, despite naming them like that, it doesn’t actually seem to have any real purpose. Apparently they just wanted to make sure that different companies making different libraries didn’t accidentally use the same name for their project…

          • Hawke@lemmy.world
            link
            fedilink
            arrow-up
            1
            ·
            29 days ago

            That’s exactly the reason. And also no company is going through the bother to refactor that shit, so everything is named based on some other company 5 mergers and acquisitions ago.

    • Scott@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      2
      ·
      29 days ago

      I’ve worked on a corporate project with multiple Java services, anon isn’t really exaggerating. Java can be a hell scape at times

      • taladar@sh.itjust.works
        link
        fedilink
        arrow-up
        2
        ·
        29 days ago

        They forgot to mention that production Java applications apparently need to log a certain minimum number of completely meaningless stacktraces per hour to work properly. Or at least I assume that is the case from the fact that all of them do that.

        • HackerJoe@sh.itjust.works
          link
          fedilink
          arrow-up
          1
          ·
          29 days ago

          Best with an old and vulnerable log4j on a Windows log server.

          We don’t know what’ll happen if we update. And we don’t know if the dude who coded it will answer our calls. YOLO!

        • Scott@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          1
          ·
          28 days ago

          You would be surprised, errors right out of the box on a freshly initialized project aren’t uncommon

          • babybus@sh.itjust.works
            link
            fedilink
            English
            arrow-up
            1
            ·
            28 days ago

            As I’ve been working with Java professionally for years, you’re right, I would be surprised, because that would be really uncommon.

    • chunkystyles@sopuli.xyz
      link
      fedilink
      English
      arrow-up
      1
      ·
      29 days ago

      I’ve been programming in Java professionally for 11 years. It’s not just embellishment, it’s outright lying.

      Threads giving you race conditions? All concurrent programming will do that if you’re shit at it.

      Java has come a long way. I will admit that UI in Java is terrible. I would never do that.

      • extremeboredom@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        28 days ago

        It’s not accurate to accuse Anon of “lying,” when both their story and yours would point to the race conditions from threads being a symptom of someone who’s just learning the language.

        It’s not that serious though; because it’s a greentext, it is both artificial AND homosexual.

    • schteph@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      29 days ago

      Java is religiously backwards compatible. Modern java projects are not as enterprisey and boilerplatey, but, as jdk21 is backwards compatible with jdk1.3, you can still happily write code as if it’s 2003.

      Additionally, the java space is huge, so just wildly googling will probably not help you that much.

      • Hawke@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        28 days ago

        Is that why every single application will only work with some ancient version of Java?(usually 8, sometimes 1.6 or 11)

        I can’t think of many cases where Java 21 is a drop in replacement, and I don’t think anyone actually used 17.

    • darthelmet@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      29 days ago

      Only have a beginner perspective, but in school I did really well in intro CS class that used Python. 2nd class was in Java and it almost broke me I was so confused.

      • naeap@sopuli.xyz
        link
        fedilink
        arrow-up
        1
        ·
        29 days ago

        Hated Java in school

        But before Java I learned a bit of Pascal and C/C++, and I’m so fucking happy that I’m currently working with C++ in my job and not with fucking Java

        I still hate it with everything I’ve got …

  • Zement@feddit.nl
    link
    fedilink
    arrow-up
    1
    ·
    28 days ago

    I really enjoyed the text.

    From the perspective of a python programmer it all seems valid.

    A Java-Dev would probably write the same about an embedded engineer.

  • yamanii@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    28 days ago

    I still think Java is good for teaching newbies precisely because it will throw an error quickly if they are doing it wrong.

  • kerrigan778@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    28 days ago

    Java is terrible and I hated it but I feel like this stuff is not why, this mostly just seems like stuff that most powerful object oriented languages do.

  • Black History Month@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    28 days ago

    I’ll never get the hate for java and love for python. It’s like learning mandarin because you think it’s easier than Spanish. When you know java you also kinda know javascript, C, Php, and others. When you know python, it’s probably a government sponsored course, or a programming class talked your school district into buying their “intro to programming python course”. Plus you only get to know python. I’ll die on this hill

  • arc@lemm.ee
    link
    fedilink
    arrow-up
    1
    ·
    28 days ago

    Could be worse, could be programming Javascript (or Typescript).

  • AusatKeyboardPremi@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    28 days ago

    I might have agreed a decade or two ago, when I knew no better. But today, I find the tribalism surrounding programming languages comical.

    I don’t particularly like Java, but I use it because it pays the bills. Similarly, I use C++ (which I prefer) when my work requires it.

    • frayedpickles@lemmy.cafe
      link
      fedilink
      English
      arrow-up
      0
      ·
      28 days ago

      Tell us more ancient one, your heroic tale of “giving up against the endless weight of capitalism” is fascinating.

      • lurklurk@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        28 days ago

        “giving up against the endless weight of capitalism”

        We just call it “having a job” nowadays

  • WormFood@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    28 days ago

    object orientated programming is the wrong idiom for almost all problems, and even in the few cases where it makes sense, you have to be very careful or it’ll hurt you

  • lurklurk@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    28 days ago

    Hello World

    30 minutes of boilerplate

    writing imports

    $ cat <<EOF > Hello.java
    public class Hello {
      public static void main(String args[]) {
        System.out.println("Hello world!");
      }
    }
    EOF
    $ java Hello.java
    Hello world!
    

    ok

    • JackbyDev@programming.dev
      link
      fedilink
      English
      arrow-up
      0
      ·
      28 days ago

      This is getting a little better nowadays.

      > cat Hello.java
      void main() {
          System.out.println("Hello, World!");
      }
      > java --enable-preview Hello.java
      Hello, World!
      

      Things to notice:

      1. No compilation step.
      2. No class declaration.
      3. Main method is not public static
      4. No String[] args.

      This still uses preview features though. However, like you demonstrated already, compilation is no longer a required step for simplistic programs like this.

    • sugar_in_your_tea@sh.itjust.works
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      28 days ago

      C# is nicer Java, but I think it’s still fundamentally a poor language.

      Rust master race:

      fn main() {
          println!("Hello world!");
      }
      

      Unfortunately, the time you save typing you’ll spend compiling, so there’s that…