Is defining get/set methods for every field overkill?

Ali Çehreli acehreli at yahoo.com
Sat Nov 19 19:47:09 UTC 2022


On 11/18/22 20:13, [] () {} () wrote:

 > after 10 years of doing all that, you may well come to the conclusion
 > that public member variables are not such a great idea afterall ;-)

It depends. Majority of my structs are pure data. When there is no 
invariant to protect, then there is no reason to write any accessor.

If 10 years is mentioned to prove a point, I currently have 33 years of 
professional programming experience (37 including pure hobby years), so 
I must be right. ;)

Ali



More information about the Digitalmars-d-learn mailing list