Is defining get/set methods for every field overkill?

Ali Çehreli acehreli at yahoo.com
Mon Nov 21 11:56:59 UTC 2022


On 11/20/22 14:37, [] () {} () wrote:

 > so, as I understand it, your're against the use of private, against the
 > use of class, and against the use of encapsulation.

I never implied any of that.

 > .. good luck with your career as a software engineer (but please, for
 > all our sakes, don't work on any safety-related systems, and especially
 > not the ones running in my car).

I haven't written any code that runs on the car yet but I did and still 
do work in autonomous vehicle projects:

 
https://techcrunch.com/2017/04/04/daimler-and-bosch-fully-autonomous-cars-within-5-years/

(That partnership is no more at this time.)

And coincidentally, to reply to your post that included Autosar, MISRA, 
etc. I am very well aware of those standards because I did contribute to 
the team that wrote our coding standards by going through every single 
one of their rules.

As one would expect, there was no argument on whether to use getters and 
setters or direct public access for that project: We decided no public 
access to members.

This discussion came to this point because you and I understood the 
question differently: I took the OP's question literally: "Is defining 
get/set methods for every field overkill?"

You took the question as whether to define them for class hierarchies, 
safety-critical systems, etc.

Ali



More information about the Digitalmars-d-learn mailing list