3 ms·
Public writeable fields are threading and encapsulation smells but public read-only fields just say, this data is part of my interface.
by JulianMorrison 6y ago
Public writeable fields are threading and encapsulation smells but public read-only fields just say, this data is part of my interface.
- deleted 6y ago[deleted]
- xxs 6y agowell, yes however fields cannot be part of an 'interface' in java. (they can but they'd be static) I do use package private fields liberally, though. Just not non-static public fields.
- JulianMorrison 6y agoInterface as used here means the broader concept of a "a class's interface is its public advertised operations" and not the specific Java thing called an interface.