Is defining get/set methods for every field overkill?

Ali Çehreli acehreli at yahoo.com
Sat Nov 19 19:59:20 UTC 2022


On 11/19/22 01:43, [] () {} () wrote:

 > do it your way for the next 10 years, and
 > I bet you will eventually come to a different point of view ;-)

Hm... I am responding without reading the rest of the thread so I don't 
know whether you've mentioned the 10 years more but here it goes: I hope 
11 years will be sufficient to stop following guidelines blindly. 
Especially this specific one where a posted video has shown how wasteful 
it can be.

 > if you're just a hobyist programmer, then you're really free to do as
 > you please.

I am a professional programmer and I do not write public accessors 
blindly. As stated before, they are written only when there is an 
invariant to protect.

 > but if you are a software engineer employed by a company, within a team
 > of other software engineers, then you have to a have framework that you
 > *all* work against.

Agreed.

 > anyone who says otherwise, doesn't know what they're talking about.

Agreed.

 > In my team, 'classes' do not have public member variables. not ever.

I am not working there! :) And what about structs? ;)

 > another team is free to do as it pleases of course ;-)

Thanks. :)

 > but members of that team will have a hard time getting into my team.

Mutual feelings there...

Ali



More information about the Digitalmars-d-learn mailing list