Brad Roberts escribió:
Walter Bright wrote:
Tim M wrote:
I think you're thinking of Java. Those guys are shit scared of public
properties. Get & Set for everything.
I never really understood the fear of that, either.
Getters/Setters makes up for lack of 'const'. Can't change it if
there's no setters. Also, setters are important for all of java's
reflection systems, especially the IoC systems such as spring.
They also allow you to later change their implementation without the
client having to recompile their classes. But doing it everywhere is too
much. If I provide an interface to my system and don't allow client code
to use "internal" classes that I don't expose, in those classes I allow
myself to use public fields.
Later,
Brad