• houseofleft@slrpnk.net
    link
    fedilink
    English
    arrow-up
    9
    arrow-down
    1
    ·
    18 hours ago

    I think a lot of it is “ceremony”, so it’s pretty common in java to:

    • create a get method for every object variable
    • create a set method for every object variable

    Then add on top that you have the increased code of type annotations PLUS the increased code of having to check if a value is null all the time because all types are nullable.

    None of that is hugely complicated compared to sone of the concepts in say Rust, but it does lead to a codebase with a lot more lines of code than you’d see in other similar languages.

    • houseofleft@slrpnk.net
      link
      fedilink
      English
      arrow-up
      4
      ·
      18 hours ago

      Before someone says it, I know a lot of this stuff doesn’t need to be done. I’m just giving it as examples for why Java has the rep it does.

      • WhyJiffie@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        3
        ·
        16 hours ago

        i still don’t understand. is it easier in python or JS to make getters and setters? with python my experience has been the opposite, with the decorator based solution in mind.
        or if the problem is that they exist, as an option to be used, why is that a problem? they can be implemented in any other language, and it can be useful.

        then yeah, you should check for nulls. just like for None’s in python, or if you have the correct type at all, because if it’s entirely different but ends up having a function or variable with the same name then who knows what happens.
        then in javascript besides null, you also have undefined and NaN!

      • WhyJiffie@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        2
        ·
        16 hours ago

        i still don’t understand. is it easier in python or JS to make getters and setters? with python my experience has been the opposite, with the decorator based solution in mind.
        or if the problem is that they exist, as an option to be used, why is that a problem? they can be implemented in any other language, and it can be useful.

        then yeah, you should check for nulls. just like for None’s in python, or if you have the correct type at all, because if it’s entirely different but ends up having a function or variable with the same name then who knows what happens.
        then in javascript besides null, you also have undefined and NaN!