|
Re: Bad Policy - Think again
|
Posted: Dec 8, 2004 9:42 AM
|
|
Todd said, Example:
int anInt = 5; long aLong = 5;
This happens because Java (and many languages) distinguish between short, int, long, BigInteger, etc.
OO is supposed to be closer to the problem domain than other previous paradigms such as Structured programming, etc.
How often have you thought like this: I want to find the factorial of (int) 100? Or, I'd like to have a salary of (int) 1,000,000 per year.
Yet this is how many programmers write their code! Why can't the JVM decide at runtime whether it is an int, long or BigInteger?
The very fact that int, long and BigInteger (and their decimal counterparts) exist suggest that there is room for improvement in C based languages (C, C++, C# and Java).
When Java touted OS independence at the very beginning, one of the key selling points was that an int would always be the same 16 bits (or 32 bits, or whatever) in every machine it ran on.
A side effect of these decisions, along with the decision to differentiate between primitives and Objects, is that code becomes extremely bloated. And you get unexpected results.
|
|