This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Well Grounded Java Developer content question

 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, I'll bite:

what's in java 7 to make me upgrade?
what's in the book to warrant a purchase?

disclaimer: desktop applications is my 'java' only interest.
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Michael,

Well for me if it's a straight out of the box thing, I'd upgrade to Java 7 for:

* try-with-resources which will stop you from making mistakes when you close off Network, File and JDBC based resources (they got this wring 65% of the time in the JDK itself!)
* Speed - In various benchmarks we see anything from a 5-15% performance improvement out of the box
* MethodHandles and MethodTypes - Reflection done in a faster and safer way

In terms of the book, we're aiming it at the Java developer who wants their passion re-ignited and who's looking to the future. There are some industry trends (multi-core processors, the need to rapidly develop web based apps etc) which means that topics like concurrency, build and CI and polyglot programming are of vital importance. But you can see this for yourself in our Table of Contents :-)
 
chris webster
Bartender
Pie
Posts: 2367
31
Linux Oracle Postgres Database Python Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Martijn Verburg wrote:* MethodHandles and MethodTypes - Reflection done in a faster and safer way

To what extent are the dynamic JVM languages that use reflection (e.g. Groovy) able to take advantage of this right now?
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll let Ben reply with more detail (as he's deeper into the tech around that space) but in short, the latest versions of those dynamic languages can take advantage of them now (as well as the new invokedynamic byte code instruction). IIRC Groovy 2.0.x does so already (although it has to gracefully degrade if it's running on a Java 6 or below runtime).
 
Ben Evans
author
Greenhorn
Posts: 20
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:OK, I'll bite:

what's in java 7 to make me upgrade?
what's in the book to warrant a purchase?

disclaimer: desktop applications is my 'java' only interest.


For desktop applications, you should definitely upgrade for any greenfield projects.

Swing is officially deprecated, and will not receive any further updates (except possibly critical security patches). JavaFX (which is now bundled with the core Java download) is the way to go.
 
Michael Swierczek
Ranch Hand
Posts: 125
1
Clojure Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the discussion, I had not realized Swing was deprecated and replaced by JavaFX in Java 7.
 
Ben Evans
author
Greenhorn
Posts: 20
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
chris webster wrote:
Martijn Verburg wrote:* MethodHandles and MethodTypes - Reflection done in a faster and safer way

To what extent are the dynamic JVM languages that use reflection (e.g. Groovy) able to take advantage of this right now?


There are two parts to this - first off by replacing uses of Reflection with Method Handles (possibly via the Lookup.unreflect() mechanism). Then there's dynamic dispatch of methods, which can be repatched to use actual invokedynamic bytecodes.

The two most advanced mainstream languages are JRuby and Groovy 2.0 - backporting is obviously a concern as these APIs just don't exist in Java 6.

Other languages, like Mark Roos's version of Smalltalk are Java 7-only and use invokedynamic extensively.
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually for Swing, from Java 7, Nimbus becomes the default look & feel.
 
Ben Evans
author
Greenhorn
Posts: 20
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ranganathan Kaliyur Mannar wrote:Actually for Swing, from Java 7, Nimbus becomes the default look & feel.


"Is JavaFX replacing Swing as the new client UI library for Java SE?
Yes. However, Swing will remain part of the Java SE specification for the foreseeable future, and is included in the JRE. On one hand, Swing is widely used in existing Java desktop applications, but relies on an old architecture, which requires a certain level of expertise and specialization." - From the official JavaFX FAQ.

From speaking to folks at Oracle, they are not developing the Swing platform any further - the resources for development of a client Java platform are being devoted to JavaFX instead.
 
chris webster
Bartender
Pie
Posts: 2367
31
Linux Oracle Postgres Database Python Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Swierczek wrote:Thanks for the discussion, I had not realized Swing was deprecated and replaced by JavaFX in Java 7.

If you're thinking of going polyglot, you might be interested in the GroovyFX project.
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ben Evans wrote:From speaking to folks at Oracle, they are not developing the Swing platform any further


That is very true.

Nimbus was bundled only from Java 6 Update 10, so, it did not become the default for 6. For 7, it became default. This means all existing swing applications without a set l&f will use Nimbus if they are running on JRE 7+.
However, the timing of Nimbus is very poor. By the time everyone moves to Java 7, everyone will propably be looking at JavaFX for new stuff. Would have been much better had it been shipped with 6 from the beginning.

But, I think there is also a possibility of people waiting till Java 8 when JavaFX is fully integrated.
 
Michael Swierczek
Ranch Hand
Posts: 125
1
Clojure Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
chris webster wrote:
Michael Swierczek wrote:Thanks for the discussion, I had not realized Swing was deprecated and replaced by JavaFX in Java 7.

If you're thinking of going polyglot, you might be interested in the GroovyFX project.


Thank you for your reply, but I was only interested in the replacement of Swing as a curiosity. I'm trying to make the polyglot move to Scala with Play Framework 2.x.
 
Mohamed Sanaulla
Saloon Keeper
Pie
Posts: 3159
33
Google App Engine Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:
what's in java 7 to make me upgrade?.

There have been whole lot of changes as part of NIO2 in the java.nio.file package like java.nio.file.Files, java.nio.file.Path. Then there's is WatchService API which can be used to monitor a directory for changes like creation, update, delete. And there is API to obtain file metadata. I think these features would be quite a lot useful in Java Desktop applications. Then those who are interested in concurrent applications- you have ForkJoin framework which leverages ExecutorService to implement task stealing algorithm whereby one can spawn out multiple tasks and perform the operations concurrently in each task.
 
Darryl Burke
Bartender
Posts: 5115
11
Java Netbeans IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ben Evans wrote:Swing is officially deprecated

Do you have a link to an Oracle page that says that?

Michael Swierczek wrote:Thanks for the discussion, I had not realized Swing was deprecated

It isn't. Swing is in maintenance mode, which means no new API.

IMO it'll be quite some time before JavaFX can be regarded as a complete replacement for Swing. While rich in fancy features, it is far less amenable to customization.
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Krish Ghata,
Your post was moved to a new topic.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for all the very informative replies.
now convinced to upgrade to Java 7.
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl Burke wrote:
Ben Evans wrote:Swing is officially deprecated

Do you have a link to an Oracle page that says that?

Michael Swierczek wrote:Thanks for the discussion, I had not realized Swing was deprecated

It isn't. Swing is in maintenance mode, which means no new API.

IMO it'll be quite some time before JavaFX can be regarded as a complete replacement for Swing. While rich in fancy features, it is far less amenable to customization.


Hi Darryl, You're quite right - it's not officially deprecated (no deprecated annotations etc), but it's pretty clear that the writing is on the wall. In terms of JavaFX, with version 2.2 (at using Netbeans 7.2) I'm happy using it as a replacement for most cases where I'd use Swing, but I appreciate it's still got 3-6 months to go before most people will simply use it out of the box.
 
Darryl Burke
Bartender
Posts: 5115
11
Java Netbeans IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Martijn Verburg wrote:
Darryl Burke wrote:IMO it'll be quite some time before JavaFX can be regarded as a complete replacement for Swing. While rich in fancy features, it is far less amenable to customization.


Hi Darryl, You're quite right - it's not officially deprecated (no deprecated annotations etc), but it's pretty clear that the writing is on the wall. In terms of JavaFX, with version 2.2 (at using Netbeans 7.2) I'm happy using it as a replacement for most cases where I'd use Swing, but I appreciate it's still got 3-6 months to go before most people will simply use it out of the box.

You mean in 3-6 months, there will be a JavaFX Spinner and API to save a JavaFX Image to disk?

And sorry, when I said that JavaFX is less amenable to customization, I meant customization in the area of business logic: custom models/selection models etc. which are the forte of Swing. With CSS support, visual customization is easier than in any earlier Java API.

I think JavaFX will only bloom with the introduction of lambda expressions in Java 8, which I believe will reduce the presently verbose binding codes to one-liners. Provided the holes in the API are filled.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic