Just for fun,
Phlip said:
Java:
- write once debug everywhere
I find this to be not at all true. In fact, most of what I do for a
living these days is write code (and manage a development team that
writes code) in Java on Windows, and deploy the code on Linux. In the
last five years of doing so, I have seen exactly ONE bug that was
operating system specific... and it failed on Windows but not Linux,
rather than the other way around. It had to do with another programmer
misinterpreting String.replaceAll and not realizing that the parameters
were regular expressions, and passing the platform-specific file
separator as a parameter. Of course, on Windows that was a backslash
and resulted in an error trying to parse the regular expression.
That's it. No other bugs in five years. Of course other bugs are
possible. There are even areas I'd describe as pitfalls: character
encodings, Runtime.exec, and the like. However, I haven't run into them
in practice. I have enough confidence that I feel pretty good releasing
code tested on Windows directly onto a production system running Linux.
(I imagine there are also issues with the Macintosh and GUI apps, since
I see questions about it. I wouldn't really know.)
- forgets everything on all its CLASSPATHs at
the drop of a hat
I don't understand what you mean by this. As far as I can tell, it's a
completely senseless statement. If you're talking about a CLASSPATH
environment variable, then this is an operating system issue, not at all
related to Java. If you're talking about the classpath (in more general
terms, not the environment variable) used by the system class loader,
then it doesn't change, ever. Perhaps you managed to confuse yourself
at some point with a custom class loader?
- projects must depend on fragile and
programmer-hostile tools, like ANT,
that make easy things hard and hard
things absurd
I also dislike ant. That's why I've never used it -- except for a brief
period of experimentation with XDoclet, which seems to depend on it. So
far as I can tell, I don't suffer any great disadvantages from not using
ant.
- impersonates the worst of C++
multiple String classes
Are you referring to my earlier post where I listed different ways of
representing character sequences? The point of that post was that
different functionality requirements require different types for the
same basic concept, regardless of language... The only dispensable
representation from my list in Java is StringBuffer, and it will go away
over time.
and last but least generics!
I have my complaints about generics in Java. Their existence, though,
is not one of those complaints.
- arrays aren't really arrays. But they really
are. Kinda.
Eh? Arrays are arrays. Perhaps you're too married to some language-
specific concept of what an array is.
- pretends you broke something if your file
name differs from your class name. Figure
it out, stoopid!
Exactly what important information did you expect to express by naming
your source file something different? A decent development environment
might have mitigated the headache you would have caused by doing so...
but it's no justification.
(Technically, this is not a requirement of the Java language. It is
only suggested by the Java Language Specification, and is enforced by
choice in all major Java compilers. The JLS doesn't mention source
files at all in any normative statement.)
- when a smart editor like Eclipse can finish
every line for you, it makes you wonder
what the language is _there_ for!
This is perhaps a useful thing for some to wonder, but only so that they
can get around to knowing the answer. The answer is that we're talking
about two different sets of things:
(1) What can be reasonably guessed, with the assurance that the
programmer will see the guess and correct it if it's wrong?
(2) What is so certain to be the programmers meaning that it can be done
without guessing?
Clearly, there are things that fit into set (1) without also fitting
into set (2). Those things should be implemented with IDE auto-complete
features, and not with the language itself. Whether the boundaries are
drawn correctly is another issue, and there are undoubtedly places where
the boundaries could be drawn better... but criticizing the need for
auto-complete entirely doesn't look reasonable.
- adds keywords, like interface, based on
someone else's preconceived notion of good
design. Not keywords like 'virtual', based
on what the hardware will actually do
So you don't like the lack of multiple inheritance. That's fine.
However, the existence of interfaces as a language feature is perfectly
sensible in a language without multiple inheritance. This is not a
separate gripe.
- provides whole new categories of bugs, based
on zombie objects, non-deterministic
destructors, redundant finally blocks, all
under the excuse we are saving you from all
the C++ memory errors that a good standard
library implementation will save you from
anyway
It's not true that, in practice, good libraries have saved C++
programmers from memory management bugs. Results indicate that long-
running applications in C++ tend to benefit when the new operator is
overloaded with a simple conservative garbage collected implementation,
and delete with a no-op. This is because the accidental memory leaks
from the dumb conservative collector and from these "zombie" objects are
substantially less than the memory leaks from typical memory allocation
bugs. Clearly something is wrong. If you wish to embark upon a massive
education campaign to teach C++ programmers how to avoid these bugs,
that would perhaps be a noble undertaking. In the interim, though, it
would be counterproductive to interfere with efforts to avoid memory
management bugs that do occur in real-life applications. Modern Java
implementations have non-conservative collectors that are even better.
- GUIs require block closures and dynamic
typing. But what language does your boss
tell you to write the GUI in???
Anonymous inner classes actually tend to solve this problem very easily.
Yes, they are more wordy. If you don't like wordy languages, then you
shouldn't use Java. (And shouldn't take jobs where Java is used, or
should just deal with it when the language is decided on; your choice!)
The only significant lost feature is the ability to modify the values of
local variables. That feature would be nice just for consistency, but
it is probably more dangerous than it's worth in practice.
--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation