Have a Nice Steaming Cup of Java 5 859
wap writes "The language/VM/religion that everyone loves to hate is now serving another cup: Java 1.5 is ready for download. The new features of 1.5 have been discussed here before. I, for one, welcome our new virtual machine overlord. I have been using the release candidate, and startup times are noticeably faster, as is overall performance, and the new features like typesafe collections and static imports are great to have. Let the Java flames begin!"
Java is to C as ... (Score:4, Interesting)
Microsoft was right to be afraid, developing in Java is a delight.
Sam
How long will the MacOS X release take? (Score:5, Interesting)
J2EE --> 1.3.1 still (Score:5, Interesting)
I look longingly at typed collections to save yet another ClassCastException on anonymous iterators. *sigh* oh well, maybe 6 years from now...
Fuel for th e flame war (Score:2, Interesting)
Still no operators... (Score:1, Interesting)
I guess this will finally come but when ?
Stability/memory leaks (Score:2, Interesting)
I have been using Sun's JVM. I realise that the memory leaks are very likely the fault of the apps themselves, but it seems that the whole JMV is kinda flakey too.
Hopefully this new release works better.
Nice language... bad interface (Score:1, Interesting)
What bugs me about Java is the virtual machine. Native code please! The "compile once, run anywhere" idea is good enough, but Perl is definately a much better candidate for such things, wheras it is open source and therefore portable to _anywhere_ without the folks at Sun having to give their approval.
useful or bloat? (Score:5, Interesting)
JVM 1.4.2 (at least some sub-versions) were riddled with bugs, which, for instance, become apparent when people use systems that rely on it in a special way, as with Freenet. It comes as no surprise, that there were numerous reports of some errors on OSX and BSD, as well as on linux, when running JVM 1.4.2. For some time, we had to say "If you experience any difficulties, please try/revert to JVM 1.4.1 or 1.5.x and see if that solves the problem."
It is crazy to recommend reverting, but the main devls of java were unwilling to remedy the bugs in 1.4.2, claiming it was a Freenet-problem, while our devls said it was a JVM problem. Though it must be said some within freenet claim their is little to no problem with it (probably windows-users, or maybe some sub-versions that worked on specific linux-distributions). Anyway, my advice has always been, and will be (certainly in the light of the stable 1.5 release), to NOT use the 1.4.2, especially when using OSX or another 'nix based OS.
And also; be sure to get the JRE, and not the full SDK, unless you plan to develop Java software.
Re:J2EE -- 1.3.1 still (Score:4, Interesting)
I wonder if IBM will have a 1.5 JDK? For a company that is putting a lot of juice behind Java, it seems odd that they don't make the JDK available to others...
Re:How long will the MacOS X release take? (Score:4, Interesting)
Re:Stability/memory leaks (Score:5, Interesting)
But it also could be that your program simply needs a tad more ram.
Following, check out the -Xmx and -Xms parameters of your application startup file and add more ram (java fetches 32MB in without any params and fills it up before it starts the GC for the first time) That might help.
But never count memory leaks out, they are very rare, but can happen if somebody has tangling references, pretty much the only case where the Garbage Collector can do basically nothing.
The VM itself is not flakey, I have a few servers running here, with an uptime of a year already.
hmm. but how does this compare with Mono (Score:3, Interesting)
Re:How long will the MacOS X release take? (Score:1, Interesting)
Re:Write once, run anywhere (Score:3, Interesting)
Rather than mod you troll, here's a simple answer.
>> Does anyone think it will ever take?
What makes you think it hasn't? A single example: What percentage of Apache Foundation products are written in and/or for Java. Note that Apache Foundation products are used extensively in Enterprise software development, deployment and systems.
~cederic
Is it C# yet? (Score:2, Interesting)
In Java you will not see any performance improvement; the reason is well explained by Anders Hejlsberg (lead C# architect) in http://www.artima.com/intv/generics2.html [artima.com] :
"For example, with Java generics, you don't actually get any of the execution efficiency that I talked about, because when you compile a generic class in Java, the compiler takes away the type parameter and substitutes Object everywhere. So the compiled image for List<T> is like a List where you use the type Object everywhere. Of course, if you now try to make a List<int>, you get boxing of all the ints. So there's a bunch of overhead there. Furthermore, to keep the VM happy, the compiler actually has to insert all of the type casts you didn't write. If it's a List of Object and you're trying to treat those Objects as Customers, at some point the Objects must be cast to Customers to keep the verifier happy. And really all they're doing in their implementation is automatically inserting those type casts for you. So you get the syntactic sugar, or some of it at least, but you don't get any of the execution efficiency. So that's issue number one I have with Java's solution."
You can argue with Anders, but then, you would be wrong.
Metadata is the coolest new feature in 5.0 (Score:5, Interesting)
Re:RMS ALMOST KILLED IN ASSASSINATION ATTEMPT (Score:0, Interesting)
Re:Passe... (Score:4, Interesting)
- Generic Types (AKA templates)
- Enumerated Types
- Static Import (usage of this looks quite similar to the #define method)
- Formatted Output / Input (printf/scanf style)
- Varargs
I like this trend. These, among other changes in version 5, are all steps towards reducing the awkwardness in the Java syntax that many people complain about. Java is a young, evolving language that still has a lot of potential.
It is a bit funny, though, that this evolution takes the form of borrowing stuff from an ancient language. Maybe C just got things right in the first place, huh?
/me puts on a flameproof suit
Re:Passe... (Score:1, Interesting)
Anyway, adding features like this from C doesn't necessarily make a language better. It just makes it more like C. But given that the aim of a language is to by widely used, and you can't swing a USB cable without hitting a C programmer, thats not necessarily a bad thing either.
Okay, I'll Bite (a.k.a. "A Java Flame") (Score:5, Interesting)
I work on a minor, highly targetted Linux distribution. I'd love to include Java, and I actually get a lot of requests for it. But, here's an excerpt from the license agreement you'll find if you look to download the software:
(Yes, it really does just end abruptly without finishing the sentence. That trailing "and" there doesn't lead into the next section; it's just not done. Obviously I'm the only one who bothers to read these things -- *including* the people at Sun. Anyway....)
My wish to give the software to my users fails almost every test....
And frankly, that's why I wish people would stop writing things in Java. It's a pain to deal with. I want to make everything as slick, integrated, and as easy as possible for my end users. Sun makes that impossible for Java applications. If you want your code to be easily integrated and made available to users like mine -- and really, that's users of any Linux distro targetted more broadly than the super-geek sector -- please don't use Java. If you must, at least design it to work with gcj instead of Sun's virtual machine.
Unless Sun changes the license terms, their Java can never fill the "write once, run anywhere" goal -- but cleanly written source in an open language can.
Speed and resources (Score:0, Interesting)
I will say however, that it is far more reliable now, than it was say 2 years ago. For this I am thankful, as the callout phone rings less frequently.
Re:Write once, run anywhere (Score:2, Interesting)
Rapid learning (Score:5, Interesting)
As much as I might hate Java, I repeatedly have to throw this one thing into the fray: I had exactly zero former experience with network programming, and still, I was able to produce a basic telnet-like application in under 30 minutes, using only the Java API doc and some logical thinking. And I only had a very brief introduction into the language. Transferring this to C (although the basic structure is exactly the same with BSD and Java sockets) took me about a week, with all those damn low-level error conditions.
Changes from Release Candidate? (Score:1, Interesting)
Re:The new for loop and type safe collections rock (Score:4, Interesting)
Face it. Syntax matters.
Re:Eclipse 3.1 betas (Score:4, Interesting)
Currently you probably could build Eclipse using 1.5, but the Eclipse release engineering folks are still building using 1.4 (or at least, they were as of a month or so ago, and I haven't seen any mailing list traffic to the contrary). There won't be any official builds of Eclipse done with 1.5 for a while yet I think.
Mechanik
Re:How long will the MacOS X release take? (Score:1, Interesting)
It doesn't work on Linux?
Re:Swing on OpenGL (Score:2, Interesting)
Just tested -- doesn't work on the release version of 1.5 either.
Re:Passe... (Score:5, Interesting)
I was actually looking forward to templates in Java but was disappointed once I saw the implementation of generics.
Every cast operation in Java is expensive because the VM invokes security code to verify that the cast is legal. Java generics don't allow you to avoid the implicit cast so you still get the performance hit. Generics only make the code look cleaner.
Template meta-programming is also a very important part of the modern C++ libraries and is also something that generics cannot do.
The new loop: guaranteeing slowness (Score:1, Interesting)
The problem here is that iterators are slow. Very slow. Because they require two un-inlinable method calls per element in the iteration. Iterating over an ArrayList is EIGHT TIMES SLOWER than scanning over an Object array and casting to the right class, and SIXTEEN TIMES SLOWER than scanning over a properly typed array.
Iterators can't be inlined because the compiler doesn't have the concrete class -- it just knows it's an iterator. If you cast the iterator into its concrete class and set it to a concrete-class-typed variable, you could get java to inline the methods, and Iterators would be at least somewhat fast.
Unfortunately, the new loop construct makes this impossible. Thus, it is *guaranteeed* to be sixteen times slower than how you could do it elsewhere.
Crap, that's bad.
Re:I love the hate (Score:3, Interesting)
Untrue, there is no need to wait to hate Java, I tried Java in 98-99 and hated it, its libraries were full of bugs (Swing, the GC was leaky on 1.1.8) and you spent your time working around the bugs.
Re:Stability/memory leaks (Score:5, Interesting)
I was surprised to find that the ObjectOutputStream has a static HandleTable inside it that creates an entry for each HashMap that I put through, and it keeps a reference to each HashMap. I searched around, and this is a common problem [utwente.nl] that is not mentioned at all in the javadocs. You're supposed to reset [sun.com] the ObjectOutputStream periodically to free up the HandleTable. I had assumed that reset was like InputStream's reset [sun.com] and never would have guessed that it had to do with Object caching in the stream.
Re:Bytecode Compatibility (Score:3, Interesting)
Re:Okay, I'll Bite (a.k.a. "A Java Flame") (Score:1, Interesting)
Re:Java is to C as ... (Score:5, Interesting)
OOP advantage is best seen in large projects. Particullary collaborations. I've worked on large codebase non-OO projects before and know the headaches.
Also, what about compile times and the fact that Java actually doesn't work on all interfaces?
Dunno. What interfaces are you talking about?
Compile times? Java's pretty speedy compiling. Than again, I dont have a 286. Will say this though: Make is a hell of a lot quicker than Ant. Ofcourse you could always use Make for building java though.
(And as a side note, I don't like the fact that you have to type four lines of code to do what C++ could do with a simple cin >> var;
in Java would be:
System.in.read(var);
Re:They fucked up Java (Score:3, Interesting)
>> Java generics don't provide any performance benefit
On the contrary, they provide the ability to write code faster, to understand code faster and to maintain code more easily, leading to fewer bugs, and thus less testing, and thus faster deployment.
That's a hell of a cost saving - more than enough to buy a slightly faster CPU, if you're really concerned about runtime performance.
>> Autoboxing: this feature removes clarity from the language.
I must have misunderstood this one. I thought it was simple auto-translation from primitives to their object equivalents (e.g. Integer to int and vice versa). Personally I have no clarity issues with
List listOfNumbers = new List();
listOfNumbers.add(5);
System.out.printl
Sure, that's a shite example, but it's late at night. There's autoboxing going on in that add(5) call; I don't think it's hurt clarity at all.
>> Enums
That's certainly a potential issue when dealing with object references using an Enum pattern; I haven't tried that scenario in 1.5 so not whether that'll be a problem. Of course, if you rely on
>> Annotations: I really don't see the point of this.
It's an exceedingly powerful addition to the language, albeit one I'm far from certain I'm happy about.
See the Apache Beehive project for an indication of what can be achieved with these things. (e.g. a one line annotation to turn a class into a web service - that's a lot of code you didn't have to write).
Personally I think they add a lot of complexity to the language, and that does (as your post's main thrust seems to suggest) make the language weaker - not because it's less capable, but because it's harder to understand and to write. Note that I'm not lazy, I'm not looking for a language that does everything for me and doesn't make me think; I'm looking for a language that lets me think about the logic I'm writing, rather than the language mechanics being used to express that logic.
>> New for: This simply makes the code harder to read.
I'm going to challenge that. Yes, maybe harder for read the first time(s) you come across it, but after that, every bit as simple as the current 'for'. If anything, potentially simpler..
>> Static imports and variable length parameter lists: I think these are well done.
At risk of sounding argumentative, I'm even going to disagree with your only positive comment on the changes.
Static imports add no value that I can perceive. They are there purely to entice users of other languages. I like having use of statically declared values qualified by a classname, it makes the code more readable and adds a little context.
So some of the changes I welcome, others I am more uncertain about, and a couple I'll dissuade people from using (to prevent misuse and aid code readability - where I am, maintainable code counts for a lot). I wouldn't however agree that "They fucked up Java".
~Cederic
Re:Java is to C as ... (Score:3, Interesting)
Re:I love the hate (Score:3, Interesting)
Well, I left you a message to tell you I quoted it, so hopefully it's not a surprise.
5-6 seconds of startup for a few boxes of interactive input is not really acceptable.
Thus, using Java for a few boxes of interactive input is also unacceptable.
The startup times are slow. That's one of the real problems I was talking about - one, in fact, lamented from within Sun. For VMs that have this problem, this limits their usefulness a bit.
Hasn't stopped the language's implacable advance, though. Let's see, do you know why? "Because 90% of the time, nobody gives a shit."
I did not miss your attempt at humor. I am saying saying it was a bad attempt - misleading, not really illustrative.
one-size-fits-all applied to extremes allways results in the effects I described.
Did you read what I wrote? I will repeat it, with emphasis:
"...things that make any really big language a target: 1) people start using it for everything, including things its not suited for..."
Do you really need to continue to manufacture the straw man that someone thinks Java is the right language for everything, in order to have a point?
if you go nuts and have hundreds of objetcs, events and containers all over the place, you are bound to end up with huge overhead.
Congratulations, sir. You are a computer science genius.
Java from what my (cursory I admit) glance at the language/libraries takes this to just such extremes.
You have just saved me the trouble of pointing out that you are apparently ignorant about the system. The balance of abstraction and efficiency in the java architecture is actually surprisingly good, and I would say better than most other comprable systems.
But of course, you seem to like writing Gameboy games, or device drivers, or something. Yes, keep jamming the square peg in the round hole. Damn that naughty peg. It never fits. It's the peg's fault.
The "Just Too Late" was just a pun on the hype JIT is endowed with. The memory requirement (if you had read the thread where the original post was made) was confirmed by just about anybody including those who advocate Java.
You segue from JIT to memory too quickly for someone really familiar with VM or OS internals. Something tells me you're not the kind of guy who looks at how big the resident set is when he checks memory usage.
The JIT works very well. The garbage collector works very well. For overall memory usage, Java has room to improve.
Yet strangely, the language is so popular. Why? "Because 90% of the time, nobody gives a shit." We've already GOT RAM. what we needed was a clean, well-organized high-level language, and the trade was just what the market wanted.
Better yet, this is not necessarily a problem with Java as much as with VM implementation, as the wide usage of Java in consumer and embedded devices conveniently underscores, it is not necessary to have high memory overhead; this is the result of the major VM vendors trading memory for speed in products aimed at the workstation/server market. As time goes by the RAM overhead can be improved (by Sun or by the market picking up the slack), if the market wants it.
a 10-15 meg per JRE + 10-50 (memory managment seems to suck badly for the apps we use) per instance of an application
So, how many simulatneous VM instances do you typically run at once, comrade?
I dont care who broke whose toys.
When selecting a platform, language, or implementation strategy, I can see how you would consequently run into some trouble.
If I am forced to let people download and install JRE's du-jeur for each e-commerce craplet out there, this is far worse then any other "client side" app.
Golly,
Re:STUPID MODS (Score:3, Interesting)
Re:Passe... (Score:3, Interesting)
For systems like mine, that store 100 million objects in memory, a 4X memory increase is hugely unacceptable, and the access penalty is also unacceptable. My situation is not uncommon, and it is the reason why libraries like fastutil [unimi.it] exist and are so popular.
I think .NET is mostly a rip-off of the JVM with very little innovation, but they seem to have a much better approach to primitives, with JIT type-specialization [microsoft.com]
Re:I love the hate (Score:3, Interesting)
Quite true although it is not humanly possible to have more hype, hot air and hubris in any other language other then Java, C# being second close contender. Why if one were to listen to what we are being told, one cant possibly write bad code in Java for the language is divine and one's hand is guided with certainty by the fairies of object-oriented-pointerless-bliss.
Re:I love the hate (Score:4, Interesting)
I will keep repeating ad nauseum that those are the only applications that count to me and many businesses that use them. That is a 100% of a sample of a Java apps that are shitty. Either all of those were written by poeple have no clue what they are doing (unlike all of those wonderful mythical apps always deployed somewhere else and written by enlightened geniuses) or the Java snake oil is just that.
and I am starting to wonder how much experience you have in general, because what I'm conspicuously not hearing is X and Y and Z systems are way better for A and B and C. Just vague generalities about HTML forms and (I think?) coding in C? Or do you perhaps favor VBScript?
Since you are getting more incredibly fanatical and blind by the minute, let me spell it out for you as clear as I can:
For e-commerce, OS/browser agnostic plain HTML on the browser is the only sane way to do anything because it does not rely on any client capablities other then ability to render HTML. No deployment issues, no maintanance costs. Java (and ActiveX and C# and similarly retarded ideas) is a way to create deployment issues and thus support costs and thus employment for countless Java tweaker monkeys. Something dear to your heart no doubt.
For applications that must run on thick-clients (I sure hope due to CPU usage because any other reason in a corporation is plain retarded) one can use native code just fine because: vast majority if C or C++ or any other language programs need only to support very few platforms in their entire life span and the effort to optimize that program for these platforms is well paid for by removal of integration and thus support issues. But such need is extremely rare because vast majority never leave a single platform. A Windows Java app will never run as well as a native Windows app neither will unix Java app run as well as a native unix app. This is not even up for discussion. The most convoluted of JITs and what nots are still overhead over native code and I will not even entertain any moronic discussion on that topic no more that I will entertain discussions of how you can make 2 and 2 equal 7.
I regret to inform you that you are full of shit.
I regret to inform you that you are just a priest of yet another silly language who has no clue who pays his bills. VB apps are everywhere in business, far more so then Java ones. These numbers are representing current jobs, corresponding to a peak in a cycle of a fad, VB waning hard (previous fad), Java peaking (current fad) and C# just coming up. I am fully expecting to have this very same retarded conversation with a C# priest, in, oh about 4 years time.
You sound confused. Are you saying it's easier or cheaper to write native applications? That natives are more secure? Are you happy with all your current native applications?
No it is you who is utterly confused, something about a theory whereby the Earth is flat and supported by Java beans. To spell it out for you again (I will resist an urge to use large letters): Native apps are easier to write (many decades of experience and tools), run better (many decades of OS design and integration of apps with the OS), cheaper to write and support because they use proven framework and tools, they integrate well with the user environment, have better performance (even the not so well written ones) and the so called "write once, deploy everywhere" is not only unnecessary but is more accurately described as "write once, debug and crash everywhere". Are they more secure? Depends what kind. The "no client side, java-less, HTML only e-commerce"? Most certainly. The locally deployed, locally networking native apps? They are not any more vulnerable then the OS itself. Are we clear now, Your Beanness?
nobody sees the world ending but you, all those students and professors, all those magazines and newswpapers and Fortune 500 compan
Re:They fucked up Java (Score:3, Interesting)
Dismissing something as syntactic sugar is just silly. Java generics may be not perfect, but they make code shorter, therefore clearer.
it is not that they are not perfect. They are completely broken. I am not against adding generics to Java. But, I prefer Java without generics than with the crappy implementation they came up with.
If they had implemented generics properly I would not be complaining. I would be very happy instead.
First of all, they should have supported primitives in generics. This could have eliminated the need for autoboxing.
They instead went for a crappy implementation of generics and then another crappy workaround (autoboxing) for not having made a good generics implementation.
And you are wrong saying that language constructs that are shorter are automatically clearer.
By that logic, Perl would be one of the clearest languages of all.
Maybe you enjoy having to manually cast each time you use a container like ArrayList, or to manually write your own class ListOfT each time you want to use a list of elements of T type. I dont. Generics make my life easier, Im glad they included them.
You belive they make your life easier.
When you have to deal with the errors of the implementation you are going to see how easier it is.
I fail to see how autoboxing can make your code any significally harder to read. Its like saying method overloading should be banned because it makes code harder to read as it makes it impossible to determine what a method does only by its name.
I am not a big fan of method overloading, but I certainly would have prefered method overloading instead of the pile of broken crap they came up with.
As to how clear Autoboxing is, please explain the clarity of this: I fail to see how that is clear. Why is it clear that == should not be used for comparing objects, but >= and
In general, no one is forcing you to use any of this new features. If you find people using them, it is probably because they are USEFUL.
If I find people using them it will be because:
a) they are ignorant and don't understand how broken Java generics and autoboxing is.
b) They have no choice because they have invested a lot in Java and now the standard library is rewritten using templates as will several other tools too (probably for one of the two reasons).
I hate the fact that some people refuse to accept something can makes code clear if it doesnt stick to their own dogmas on programming styles.
I hate the fact that some ignorant people just fail to see how broken something is and criticize knowledgable people (and I am not talking about me, but many experts whose opinion I share) because they point out the flaws of something they believe is good.
Re:Stability/memory leaks (Score:3, Interesting)
Re:Java is to C as ... (Score:3, Interesting)
http://jnode.sourceforge.net/portal/ [sourceforge.net]
"The goal is to get an simple to use and install Java operating system..."