This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java 7: A Beginner's Tutorial": What not to use

 
Eric Bresie
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome Budi Kurniawan  to the ranch and good luck with your new book "Java 7: A Beginner's Tutorial".

With each new version of Java comes new features and depreciation of old features and APIs. I am curious, what old features are best to leave behind and which new features should be used in its place?
 
Budi Kurniawan
Author
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric,
Thank you for your question. Please see my answer below.

--> With each new version of Java comes new features and depreciation of old features and APIs. I am curious, what old features are best to leave behind and which new features should be used in its place?

I would certainly say the old IO API is one to leave behind in favor of NIO.2, even though, admittedly, this is not going to be easy as there are still billions of apps that contain the old API. If you're starting a new project, however, you should consider the new API as it's more stable than its predecessor.

Another one: the Java’s built-in support for writing multi-threaded applications, such as the Thread class and the synchronized keyword, should not be used anymore. They are hard to use correctly because they are too low level. Java 5 added the Concurrency Utilities in the java.util.concurrent package and subpackages. The types in these packages have been designed to provide better alternatives to Java’s built-in thread and synchronization features. (In my book, threads and the Concurrency Utilites are discussed in Chapter 23 and Chapter 24, respectively.)

Sample chapters (198 pages) are available here: http://books.brainysoftware.com/download/java7SampleChapters.pdf
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic