in reply to Re: use fields, underscores and subclasses
in thread use fields, underscores and subclasses

> it's never a good idea to access attributes from other classes (or objects) directly. So the user doesn't need to be told that it's a bad idea for a specific class - it's always a bad idea.

So, are you saying the whole convention of underscoring "private" variables is pointless?

  • Comment on Re^2: use fields, underscores and subclasses

Replies are listed 'Best First'.
Re^3: use fields, underscores and subclasses
by JavaFan (Canon) on Nov 23, 2008 at 02:29 UTC
    So, are you saying the whole convention of underscoring "private" variables is pointless?
    IMO, yes. I've never written code where setting an attribute in another object or class was part of the API. I'd prefer if the language didn't even allow access to attributes that aren't both of the same class and the same object.