Seems like an interesting effort. A developer is building an alternative Java-based backend to Lemmy’s Rust-based one, with the goal of building in a handful of different features. The dev is looking at using this compatibility to migrate their instance over to the new platform, while allowing the community to use their apps of choice.

  • Margot Robbie@lemmy.world
    link
    fedilink
    English
    arrow-up
    11
    arrow-down
    6
    ·
    10 months ago

    I’m pretty sure Nutomic was a Java dev before starting work on Lemmy and learning Rust from scratch. That by itself should already speak volumes.

    One-Up projects like this rarely ever turn out well, that’s from my own experiences. Even though this isn’t a popular view, I still think I’m right on this one, we can circle back in say, 6 months, to see if my predictions are right.

    • nutomic@lemmy.ml
      link
      fedilink
      English
      arrow-up
      13
      arrow-down
      6
      ·
      10 months ago

      I’m pretty sure Nutomic was a Java dev before starting work on Lemmy and learning Rust from scratch.

      That is true, I used to be an Android developer and then learned Rust by writing code for Lemmy. Are you by any chance my new stalker?

      And if we’re comparing the languages, the fact alone that there are no Nullpointerexceptions makes Rust infinitely better than Java for me. I also agree that this sort of copycat project will soon be forgotten. For example have you ever heard of Rustodon?

      • Margot Robbie@lemmy.world
        link
        fedilink
        English
        arrow-up
        15
        ·
        10 months ago

        Are you by any chance my new stalker?

        No, it was on that AMA you guys did months ago, and I remember things about people.

        • nutomic@lemmy.ml
          link
          fedilink
          English
          arrow-up
          11
          arrow-down
          2
          ·
          10 months ago

          Very impressive! The only thing I can remember well are places.

      • spiderman@ani.social
        link
        fedilink
        English
        arrow-up
        1
        ·
        9 months ago

        there are no Nullpointerexceptions makes Rust infinitely better than Java for me.

        what’s wrong with having null pointer exception?

        • Tom@programming.dev
          link
          fedilink
          English
          arrow-up
          2
          ·
          edit-2
          9 months ago

          Null is terrible.

          A lot of languages have it available as a valid return value for most things, implicitly. This also means you have to do extra checking or something like this will blow up with an exception:

          // java example
          // can throw exception
          String address = person.getAddress().toUpperCase();
          
          // safe
          String address = "";
          if (person.getAddress() != null) {
              person.getAddress().toUpperCase();
          }
          

          There are a ton of solutions out there. Many languages have added null-coalescing and null-conditional operators – which are a shorthand for things like the above solutions. Some languages have removed the implicit nulls (like Kotlin), requiring them to be explicitly marked in their type. Some languages have a wrapper around nullable values, an Option type. Some languages remove null entirely from the language (I believe Rust falls into this, using an option type in place of).

          Not having null isn’t particularly common yet, and isn’t something languages can just change due to breaking backwards compatibility. However, languages have been adding features over time to make nulls less painful, and most have some subset of the above as options to help.

          I do think Option types are fantastic solutions, making you deal with the issue that a none/empty type can exist in a particular place. Java has had them for basically 10 years now (since Java 8).

          // optional example
          
          Class Person {
              private String address;
              
              //prefer this if a null could ever be returned
              public Optional getAddress() {
                  return Optional.ofNullable(address);
              }
              
              // not this
              public String getAddress() {
                  return address;
              }
          

          When consuming, it makes you have to handle the null case, which you can do a variety of ways.

          // set a default
          String address = person.getAddress().orElse("default value");
          
          // explicitly throw an exception instead of an implicit NullPointerException as before
          String address = person.getAddress().orElseThrow(SomeException::new);
          
          // use in a closure only if it exists
          person.getAddress().ifPresent(addr -> logger.debug("Address {}", addr));
          
          // first example, map to modify, and returning default if no value
          String address = person.getAddress().map(String::toUpperCase).orElse("");
          
    • Dessalines@lemmy.ml
      link
      fedilink
      English
      arrow-up
      10
      arrow-down
      4
      ·
      edit-2
      10 months ago

      I also was a professional java dev, and also had to use spring boot in most corporate environments.

      I don’t wanna knock anyone’s re-write, because I know how difficult it is to dissuade someone when they’re excited about a project. But to me, starting a new project or doing a rewrite, is the best opportunity to learn a newer, better language. We taught ourself Rust by coding lemmy, and I recently learned Kotlin / jetpack compose because I wanted to learn android development. Learning new languages is not an issue for most programmers; we have to learn new frameworks and languages every year or so if we want to keep up.

      This is potentially hundreds of hours of wasted time that could be spent on other things. Even if someone absolutely hates Rust and doesn’t want to contribute to the massive amount of open issues on Lemmy, there are still a lot of front-ends that could use more contributors.

    • originalucifer@moist.catsweat.com
      link
      fedilink
      arrow-up
      1
      arrow-down
      1
      ·
      10 months ago

      it it common to announce a ‘major rewrite’ without having it complete?

      i mean, at the moment, theres little to discern it from lemmy at the moment… why make a big public proclamation about it before you even touch the front end?