What do you think about getters and setters? I'm not talking about traditional getters/setters methods (getXxx() and setXxx()). I'm talking about the language construction. For example:
class MyClass {
String _str;
String get str => _str;
void set str(String value) {
_str = value;
}
}
I think they are "evil". The reason is why they are hiding valuable information to the user. Specifically: information related to performance. That is, let's consider the following innocuous code:
It actually calls secretly the following method:
myVar._setMyDriveHardAndMyCpuHot(100);
Obviously, you don't want to call the previous method frequently. It may compromise the system.
What do you think about this transcendental question? I'm not sure if using accessor methods are good idea.
Thanks and sorry my awful English.