Re: What Are Your Java Pain Points, Really?
Posted: Feb 15, 2007 4:22 AM
> No, it's not the ability to name the class 1; it's the
> ability to name the file 1 (or, more generally, whatever I
> want to name it; which may or may not be a class name).
> http://gcc.gnu.org/onlinedocs/libstdc++/test.html for
> instance sets out the naming policy for libstdc++. That
> policy is not allowed in Java. but nobody can tell me a
> technical reason for the restriction because there isn't
Well, if you want a technical reason, it is due to the way the JVM locates classes. When you ask the JVM to load a particular class, say using
Class.forName(clsName), it will search for the class by its file name. Having a difference between the class name and file name would have made this process unncessarily complicated.
In addition, the issue of quickly being able to locate a class (especially in team environments) has already been mentioned. I think both of these reasons are good enough to impose this restriction.
> Is it a serious pain point? Not by itself. Unless, you
> know, you want to name your files according to any
> convention that hasn't been personally blessed by
I'm not so sure about the soundness of this argument. Ad-hominem attacks against Gosling seem uncalled for. Any language you use requires that you stick to the design rules imposed by the language. Gosling made a concious decision to simplify things in Java, even at the risk of incapacitating it, after observing that what much of the industry needed was a simple language to solve certain classes of problems. There are some things that you just can't do in Java. I believe such decisions are made with the best of intentions, not because the designer wanted to take a vainglorious ego trip.
Similarly, Bjarne Stroustrup made several concious decisions for C++ (i.e. Preserving backward compatibility with C and thereby needlessly complicating the syntax/semantics of the language). In hindsight, many people may criticize that decision, but it was doubtless made with the best of intentions and has its own merits.
Should you design a language, you will doubtless face similar criticism for certain decisions. Therefore, unless there's clear evidence of pig-headedness, go easy ;)
> May He Live Forever. And not if you rely on computers to
> do all your refactoring for you, so they can "cvs remove"
> any files that are no longer needed because the class they
> represent is also no longer needed (and cvs remove/cvs add
> whenever you rename a file).
This is something that ought to be fixed in CVS, not Java. Try SVN instead - where it's not ridiculously complicated to rename a file.
> But you couple that with a few other Gosling Knows Best
> issues, and well, I stop thinking of it as C++'s
> replacement and start thinking of it as Visual Basic's
There are certain things that just can't be done in Java. Sun's marketing hype should not to be taken too seriously ;)