axer said:
If the compiler converted the following function into four separate
methods, how would that cause a problem?
It wouldn't, by itself, cause a problem. Very few such features, in and
of themselves, cause any problem. If you create a language with a bunch
of them, though, then you get C++. Java was designed to *not* be
something like C++ for a number of reasons:
1. Sun believed that serious software could be developed using a
language with a simpler and easier to understand language definition,
and that the result could lead to higher quality of software.
2. Sun wanted to encourage fast adoption of Java by a very large group
of developers, and was not willing to bet on anyone spending the time
needed to become familiar with another C++.
3. Java needed to be safely portable across implementations of compilers
and virtual machines, and adding more complexities to the language makes
that harder to achieve, and to test that it has been achieved.
4. Java achieved an aesthetic sense of being a small and simple
language, and adding more features would interfere with that goal.
The issue is not whether the feature could save a few lines of code.
People who believe that an extra language feature is justified because
it saves them five lines of code do *not* program in Java. The issue is
also not whether the feature is easy to implement; obviously, it is.
The issue is what effect the feature has on the central concepts and
design of the Java programming language. Clearly, it is opposed to the
concepts behind Java 1.0, and it's inclusion would have been
discongruous at best.
It is far less clear that default parameters would be at all out of
place in Java 1.5, which has backed off of Java 1.0's direction to a
large extent (e.g., variable argument lists, enums, autoboxing, static
import, and so on); and it remains to be seen whether default parameters
will eventually be added as well.
Since it seems that no one really knows the official reason for this
feature not being included in the language, I guess I'll venture down
the debate road.
The problem is deeper than that no one knows. There is no "official"
reason. Sun doesn't publish opinions a la U.S. Supreme Court justices.
They make and release products, and the reasons of various team members
may have different reasons for making the same decision. You could look
for comments by James Gosling, who led the team and probably wrote much
of the code, but that's still not an "official" reason.
--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation