I don't understand the nature of Java Beans that well. Well, at least how I see them used in some code-bases that pass through our shop.
I found this question:
http://stackoverflow.com/questions/315142/java-beans-what-am-i-missing
The accepted answer there makes it look like programmers tend to abuse Java Bean (which I really don't doubt), but I see it happen so often and so deliberately, I think I'm still missing something.
I see code that looks like:
public class FooBean {
private int a;
private int b;
private int c;
public int getA() { return a; }
public int setA(int x) { a = x; }
// etc...
}
No further structure or control than getters and setters. Is there some sort of super awesome compiler trick going on that involves reflection, getters and setters, and the need for some very awkward (but compiler optimized) static associative arrays?
Or maybe I'm completely missing the point. :\
Cheers!
Edit:
Definitely not promoting the idea of public fields, here.