Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think this idea is that you can use "properties" rather than public class variables.

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.



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.


Play! framework allows you to use getters and setters with public members as you would in C#.

Not sure how this is implemented.


Spring Roo does the same through the use of aspect programming (code generation, essentially - it generates the boilerplate behind the scenes).




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: