• Ginny [they/she]@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    3
    ·
    1 month 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
      ·
      1 month ago

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

    • kitnaht@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      1 month 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
        ·
        1 month 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
        ·
        1 month 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
          1 month 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
            ·
            1 month 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
      ·
      1 month 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

        • Scott@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 month 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
            ·
            1 month ago

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

      • taladar@sh.itjust.works
        link
        fedilink
        arrow-up
        2
        arrow-down
        1
        ·
        1 month 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
          ·
          1 month 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!

    • schteph@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      1 month 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
        1 month 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.

    • chunkystyles@sopuli.xyz
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 month 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
        1 month 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.

    • darthelmet@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      1 month 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
        ·
        1 month 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 …

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

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

    • Serinus@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      1 month 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
        ·
        1 month 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.

  • Black History Month@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    1 month 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
    ·
    1 month ago

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

  • kerrigan778@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    1 month 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.

  • Zement@feddit.nl
    link
    fedilink
    arrow-up
    1
    ·
    1 month 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.

    • sugar_in_your_tea@sh.itjust.works
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      1 month 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…

  • lurklurk@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    1 month 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
      ·
      1 month 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.