GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes Java 7: A Beginner's Tutorial Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java 7: A Beginner Watch "Java 7: A Beginner New topic
Author

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

Eric Bresie
Greenhorn

Joined: Apr 05, 2011
Posts: 20
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

Joined: Apr 30, 2002
Posts: 65
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
 
GeeCON Prague 2014
 
subject: Java 7: A Beginner's Tutorial": What not to use