On 2008-12-24 02:52:56 +0100, "Nick Sabalausky" <[email protected]> said:
"Daniel de Kok" <[email protected]> wrote in message
news:[email protected]...
On 2008-12-23 22:10:53 +0100, "Nick Sabalausky" <[email protected]> said:
It's far more than a mere presumption:
class Foo{
public int x;
}
// vs
class Foo{
private int _x;
public int getX() {
return x;
}
public void setX(int x) {
_x = x;
}
}
It would take a Java mentality to find the second to be every bit as good
as
the first. Yes, it's functionally equivilent, but it's a horrid mess
I happen to disagree :^).
provides absolutely no benefit in a language that supports properties.
Note
also, that the second form provides absolutely no more encapsulation
benefits than the first.
It *does* provide more encapsulation, since you could modify the getter or
setter without changes for the called. This was supposed to be one of the
advantages of encapsulation (and it is).
How is that any different from the first form (in a language that supports
properties)?
I am not saying it is different. I was just replying to your statement
considering the example that the second form does not provide more
encapsulation.
-- Daniel