I agreed with you upto that last sentence, My viewpoint: The whole point of the java.util.Math class is that the functions are so "standardized" and so "final" (on top of that mostly "native") that they shouldn't really ever be "overridable", they are "utility" functions that one can "rely" to be of a specific mathematical/numeric behavior. They are static as well to be easily accessible.
Attaching methods to number objects makes them easily accessible too.
IMHO, Static functions are the closest Java ever comes to allowing developers to define their own "operators". They are as analogous to the concept of mathematical functions as you can get. Did you ever write -1.cos() in Calculus? no, you wrote cos(-1) , and in java Math.cos(-1).
This isn't calculus, this is OOP. I'm of the opinion that in OOP you should always be passing messages to objects and static methods violate that principal. If I want to find the cosine of some number variable x it's more natural OOP to say x.cos(). cos(x) is a very procedural (read C) way of thinking and unnecesarily limits your implementation possibilities.
True, but algorithms are easier to understand/debug when they are in a familiar syntax. I tend to think that "OOP you should always be passing messages to objects" is also something that can "limit" implementation possibilities as well. And philosophize a little, its always in the "cracks" where the interesting things grow. Is it in the conflict between procedural and OOD that elegant designs arise?
There was a time I actually wrote my own primitive wrapper library. But, now I do feel a little differently about it now, in a procedurally implemented OO language like Java there as to be some point where the procedural and the OO aspects meet. I really hope for myself, to look deeper into Aspect Oriented Design to see if that is something that can fill that conceptual gap.
Always do feel free to "enthusiastically" join in when the subject interests you. :-)
Anyways, this discussion is purely academic because we're constrained by what Java actually allows. I'll let you math wizards get back to work ;-).
David
-- Mark Diggory Software Developer Harvard MIT Data Center http://www.hmdc.harvard.edu
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
