Live data from Hacker News

Java 7 is now available

oracle.com

101–110 of 218 posts

Re: Java 7 is now available

#101
post #90

Earlier quoted context omitted.

> New language features are all fun, but unless they actually result in faster execution, or allow you to do things you could not do before, they're only use is to make some developers happy, which I don't think is particularly important. I think you don't appreciate how some language features can help you reduce the size and complexity of your code. Those are the kind of features that are sorely lacking in Java, and…

> Those are the kind of features that are sorely lacking in Java, and that means huge, bloated code bases. No, it doesn't. If you can't write concise Java, you're doing something wrong. And if you can't read code well, go practice some more. Disclaimer: I'm an outlier. I rarely use 3rd party libs, rarely write with anyone else, etc.

>>No, it doesn't. If you can't write concise Java, you're doing something wrong. And if you can't read code well, go practice some more.

Don't know why you are getting down voted. Even Joel Spolsky says that what really makes the difference is the programmer, not the language. If you suck in Java you will probably suck in other languages.

Re: Java 7 is now available

#102
post #90

Earlier quoted context omitted.

> New language features are all fun, but unless they actually result in faster execution, or allow you to do things you could not do before, they're only use is to make some developers happy, which I don't think is particularly important. I think you don't appreciate how some language features can help you reduce the size and complexity of your code. Those are the kind of features that are sorely lacking in Java, and…

> Those are the kind of features that are sorely lacking in Java, and that means huge, bloated code bases. No, it doesn't. If you can't write concise Java, you're doing something wrong. And if you can't read code well, go practice some more. Disclaimer: I'm an outlier. I rarely use 3rd party libs, rarely write with anyone else, etc.

@felipemnoa: Downvotes are presumably for snarky 'You must suck and reading/writing code then' comments. Isn't a positive contribution to the discussion.

Also, 'making the difference' and 'being totally irrelevant' are two very different things. Programming languages matter. I'd be surprised if Mr. Spolsky disagrees.

Re: Java 7 is now available

#103
post #90

Earlier quoted context omitted.

> New language features are all fun, but unless they actually result in faster execution, or allow you to do things you could not do before, they're only use is to make some developers happy, which I don't think is particularly important. I think you don't appreciate how some language features can help you reduce the size and complexity of your code. Those are the kind of features that are sorely lacking in Java, and…

> Those are the kind of features that are sorely lacking in Java, and that means huge, bloated code bases. No, it doesn't. If you can't write concise Java, you're doing something wrong. And if you can't read code well, go practice some more. Disclaimer: I'm an outlier. I rarely use 3rd party libs, rarely write with anyone else, etc.

> And if you can't read code well, go practice some more.

Actually, let's not. To paraphrase a minor celebrity of programming, life is too long to be good at reading every variation of boilerplate. Java is essentially hostile to small functions and parametrization, as having any semblance of inner or anonymous functions will require you to define a class at least, or an interface somewhere else, scattering your code unnecessarily, and you'll probably just end up repeating the code because it's just not worth the effort to do it. Don't believe me? Why do you always have to .open() and .close() your any port-like thing manually? That's a solved problem, you know?

Re: Java 7 is now available

#104
post #46

Too little to show for 5 years.

yeah but Sun was sold, and other stuff happened. I think it's already great that there is a release with some syntax features that are useful and other nice to have things too. I think Java 8 will come fast there are plenty of new langs now they can't miss the point otherwise companies will continue to migrate to faster evolving languages with faster developing times.

>>faster evolving languages with faster developing times.

Could you provide citations of any studies done please. i.e. How development times differ for small projects and large projects. For small projects I could see other languages being faster, what about large project or really large projects?

Re: Java 7 is now available

#105

Earlier quoted context omitted.

> The community splintered, the language and platform really lost any ability to maintain momentum. This is the mindset I've never understood. Do you stop using a hammer to bang in nails because the hammer "community" has splintered, or the development of hammers has stagnated? No, you still use it to fulfill a job it solves.

There really is not much you can do to a language to make you code faster. I guess people just like the novelty of a new language.

If you mean that time spent actually coding a program is a rounding error of the time spent conceiving it, then that's an interesting point.

That said..

1. OF COURSE you can make languages that are faster or slower to write code in.

2. Trivializing anyone who jumps ship on a language as being enchanted with the 'novelty of a new language' is obnoxious and arrogant.

Re: Java 7 is now available

#106
post #72

There is a good amount of stuff to get excited about in this release. - Try-with-resources-Catch-Block [0] - Fork/Join libraries from Doug Lea (author of Executor framework) [1] - Inferred/Simpler generics in declarations (should have been in Java 5) - NIO2, brand new/robust filesystem APIs [2] - NIO2, treat ZIP/JAR files like directories of files for R/W [3] - SDP support [4] - String-in-switch (NOTE: check on perfo…

No love for JSR 310?

Re: Java 7 is now available

#107
post #72

There is a good amount of stuff to get excited about in this release. - Try-with-resources-Catch-Block [0] - Fork/Join libraries from Doug Lea (author of Executor framework) [1] - Inferred/Simpler generics in declarations (should have been in Java 5) - NIO2, brand new/robust filesystem APIs [2] - NIO2, treat ZIP/JAR files like directories of files for R/W [3] - SDP support [4] - String-in-switch (NOTE: check on perfo…

No love for JSR 310?

Ahh, good point. I'll add that to Java 8 hotness list. Thank you.

UPDATE: Couldn't add it to the original post (edit has expired), here is more info about Joda Time for Java 8[1] for folks that are interested.

[1] http://www.jroller.com/scolebourne/entry/what_about_jsr_310

Re: Java 7 is now available

#108
post #40
post #16

You can now finally use a string in a switch statement, hurray (it's the little things that make me happy)! http://download.oracle.com/javase/7/docs/technotes/guides/la...

IntelliJ IDEA strongly suggests to turn those Strings into constants. And then to turn those constants into an Enum. Oh wait, we could also switch() on Enum values! I'm sure this is useful in some cases though :-)

Wouldn't it be better to configure the switch options in an xml configuration file?

Re: Java 7 is now available

#109
post #72

There is a good amount of stuff to get excited about in this release. - Try-with-resources-Catch-Block [0] - Fork/Join libraries from Doug Lea (author of Executor framework) [1] - Inferred/Simpler generics in declarations (should have been in Java 5) - NIO2, brand new/robust filesystem APIs [2] - NIO2, treat ZIP/JAR files like directories of files for R/W [3] - SDP support [4] - String-in-switch (NOTE: check on perfo…

Syntactic Sugar: Collection literals List people = {"Frank", "Mary", "Satan"}; I find it breathtaking this isn't core yet. I was writing test fixture support code for 1.4 to easily and DRYly generate lists of up to 10 items, which required 10 copy-paste functions each with a different number of arguments. 1.5 came along and made it possible to easily do it with one function thanks to varargs, but it's 6 years later a…

I don't think anyone would disagree with you; we definitely went through a stagnation of Java between 6 and 7 where it seemed Sun was trying to find it's footing with Java, trying to not sink the company, trying to be bought up, trying to figure out where Netbeans fit in the scheme of everything, etc. etc.

It is like the Java world hit the 'pause' button on really ambitious stuff for a few years and the only things that got into releases were the laser-sharp-focused features that the teams needed no variation on. They knew exactly what the feature was, where to take it and when to ship it.

I think it was for the better, because now there is all this pent up energy getting reinjected into the platform and we'll see 8 next year with the rest of all these goodies and hopefully 9/10 2 years after that.

Pretty good recovery IMO. At least it didn't languish and die a horrible death or something.

Re: Java 7 is now available

#110
post #72

There is a good amount of stuff to get excited about in this release. - Try-with-resources-Catch-Block [0] - Fork/Join libraries from Doug Lea (author of Executor framework) [1] - Inferred/Simpler generics in declarations (should have been in Java 5) - NIO2, brand new/robust filesystem APIs [2] - NIO2, treat ZIP/JAR files like directories of files for R/W [3] - SDP support [4] - String-in-switch (NOTE: check on perfo…

> And one that I can't get confirmation on if it's in 7 or got pushed, index-access for List and Maps I just tried it out, it didn't get added to 7. > String-in-switch (NOTE: check on performance implications of this for tight loops) I haven't checked the performance, but I tried decompiling a String switch statement: String test = "asdf"; switch (test) { case "sss": System.out.println("sss"); break; case "asdf": Sys…

Really appreciate you going through the trouble to do that and post the results so we don't need any hand-waving.

This looks the same as the original proposal -- using the hashCode and final verification via equals.

So in a typical case scenario you have the 1-time calculation of the String's hashCode (which is then cached by java.lang.String) and the two method calls.

.equals() is the only thing that could get away from you performance wise, because unless string1 == string2 or are different lengths, you fall into a char-by-char comparison loop.

That could be a shitty surprise if you have a bunch of constants like "SAVE, RMVE, DELT, INST, UPDT" and don't realize what you are causing to happen under the covers.

I'd be curious (now) what actually happens with using Enums in switch statements to see what kind of hidden code is actually getting executed.

## ASIDE: An interesting alternative to switch statements with Enums: http://francisoud.blogspot.com/2008/02/better-way-to-use-jav...

Seems really a-typical though.

## UPDATE: It looks like using Enums ends up getting translated to:

  switch(enum.ordinal())
calls followed up goto statements to the case labels. So enums should be practically just as performant as constant numeric values except for the method call.

If the JVM is smart enough to replace the calls to 'ordinal' with the constant return value, then it should be right on par with using numerical constants which would be sweet and make using the strategy outlined in that link possibly a nice performant alternative to normal Enum use.

Post reply on HN