> Java3D API is full of get* and set* methods and the most of them only copy
> the param value to its private atribute. The performance is lowered down
> with a lot of function calls in the stack. Most people says that
> making the inner state of an object public is not OO,
I think you are completely right. In former days, when I was young, I also
thought its cool and grown-up only to change objects state with setter calls
and query it with getters. And in C++, it does not cost any performance (as
long as you don't make them virtual :).
Nowadays, I think less is more. Making variable public illustrates that it
is public and no further logic is going on internally. By setting such a
value, I (as a programmer) really KNOW whats going on. If I (later) want to
hide some logic behing variable access, I remove the public declaration and
create getter/setter.
Of course then, I have to change the surrounding code and I think thats
good, bc. by introducing the new methods, somehow the meaning of the
variable changed! Its NOT the same any more. So why not also change syntax?
Today, I declare variables for public access as public variables. If I want
to illustrate e.g. that they only can be read, not written, it goes private
and getXXXX() appears on the scene. But I never do a
private int x;
public int getx() { return x; }
public void setx(int newx) { x = newx; }
This really improves NOTHING and is completely meaningless. public int x; -
has a meaning!
Thats good for academic consideration on OO systems, but it sucks for
pragmatic development issues. I really don't want my object to tell me I'm
an idiot and cannot handle it. Not even manage a variable.
Here I am today.
- J
Joerg 'Herkules' Plewe
HARDCODE Development
http://www.hardcode.de
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".