Re:Coding Skill and the Decline of Stagnation
by esrauch on Friday January 13, 2012 @06:00PM
(#3462785)
C# allows it but but Java doesn't have this. Hence why it's standard operating procedure to just use setters from the beginning, because it might be nontrivial to update all references.
Then you can convert your public vars into properties at a later date.
This means that you will not have to (necessarily) rewrite your code as the language knows that
a = myobj.myvar
now should call getmyvar() in the containing class and:
myob.myvar = a
should call setmyvar(a) , I know that C# certainly allows this.