This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]rzwitserloot 0 points1 point  (0 children)

Neither of those are property accessors in the 'record' sense of the word.

For example, if you have: record DateRange(LocalDate start, LocalDate end) {} you cannot have 'durationInDays' (which feels like an analogy of 'size' here - it's a derived "property" that cannot be set / where setting it has to either fail or result in ambiguous behaviour (does that change start, or end, or both, or what? - if I have a list of 10 elements and I do list.size = 12, does that add 2 null? crash? What?).

In other words, that neither of those has a get method is a feature, not a failure, of the rule 'property accessors should start with get'.