Conversation

Replying to and
It also keeps open the possibility of adding logic in the future without a backwards incompatible change to the API. For example, it may become desirable to have setting a field regenerate a cache or to change the way it's stored. It's very relevant if it's a public library API.
1
3
It's rare to have a way to allow direct access but not direct assignment without making the field read-only. Some languages support overriding getting/setting fields with methods so it can be freely switched between direct access or methods without changing the API externally.
1
1