![]() |
Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
Hi, Im a long time (20+ yrs) professional prog., but a neophite at java and there are various things regarding the JFC that strick me as suboptimal:) Maybe there are some opinions out there that will clarify things for me. 1) Why do we have a xxxx = getXxxx(), and a setXxxx( xxxx ) calls... eg. to clarify class DecimalFormat { Why not class DecimalFormat { Note: That the "set" method also returns the value set. This has the effect of allow one to "chain" method calls. 2) Why dont methods that modify the state of an object also return the modified object (reference)??? So that instead of coding... void paint( Graphics g ) { you could code: void paint( Graphics g ) { Which (to me) clarifies the code and "saves" and intermediate variable. Is there some OO reason for not doing this....I notice that it does happen some places like Color color2 = color.darker(); though in this instance I'd prefer it if the darker() method returned a darker version of the color WITHOUT modifying the original... Or change the method name to darken() to indicate that it is modifying THIS color not just returning a darker one. I end up coding stuff like: ... When I want to derive another shade of a color and retain the original. 3) Why do they (SUN?) not use more method overiding? eg. Class Graphics { Sorry for the rambling, Nigel Sandever. PS. If this system doesn't automatically forward replies to my email, I'd appreciate it if any responders did.... it much easier (for me:) if I dont have to keep coming back and checking...
Replies: |
Sponsored Links
|