5 ms·
I love the “properties” bit. You can get the same functionality by just defaulting the fields on your classes to public. 99% of the time, the getters and setter
by Olreich 5y ago
I love the “properties” bit. You can get the same functionality by just defaulting the fields on your classes to public. 99% of the time, the getters and setters aren’t doing anything, just proxying the variable.
- skocznymroczny 5y agoYes, 99% they don't do anything, but the 1% of cases in which you want to add something extra, you're glad you're using properties. For example if you want to convert the data to other format/unit before returning, or to log all usages of a variable.
- speed_spread 5y agoAs long as this is your code, refactoring to introduce getters and setters if ever needed would be a cinch.
- vips7L 5y agoI’d rather have functions as they work quite well with method references and streams. Additionally ORMs require methods to do dirty tracking. If your class isn’t a entity pojo just use a record and get the getters for free.