this post was submitted on 04 Nov 2023
71 points (85.1% liked)
Programming
17418 readers
24 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities !webdev@programming.dev
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
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)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.
It has Properties (basically syntax sugar...)
And it's so good that Kotlin adopted them too in their journey to fix Java.