• philm@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    I’m totally aware of the benefits of encapsulation, but the way java does it seems so unnecessarily boilerplatey (C# is better, functional programming makes encapsulation even simpler, but that’s a different paradigm…)

    I like how Rust approaches this via the module system and crates (you have pub for the public interface, pub(crate) for crate/lib wide access and no modifier for being only allowed to access in the current module and submodules of that module)

    • Dunstabzugshaubitze@feddit.de
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      Not to aware of how c# works, or interested in defending java, especially ancient java versions, but what does it do better in that regard?

      Only records for more or less pure data objects come to mind, but those are also in modern Java.