Is defining get/set methods for every field overkill?

thebluepandabear therealbluepandabear at protonmail.com
Sat Nov 19 03:24:41 UTC 2022


On Saturday, 19 November 2022 at 03:14:18 UTC, []() {}() wrote:
> On Saturday, 19 November 2022 at 03:08:05 UTC, thebluepandabear 
> wrote:
>>>
>>> It likely already does something, in that- >'it allows for 
>>> change to occur without having to break the clients 
>>> interface'.
>>>
>>> That too is the 'point' missing from that rant.
>>
>> With all due respect, I think your point is mostly invalid due 
>> to the point that Dukc made.
>
> keep programming/maintaining and enhancing production-level 
> code for the next 10 years.
>
> then you too will know the correct answer to your question :-)

I think because of uniform function call syntax, getters/setters 
are not needed even for production level code, in D of course. In 
Java, you do need them so your point holds true in that scenario, 
but in D I don't really see the point after giving it some 
thought, I would say they are code bloat.


More information about the Digitalmars-d-learn mailing list