1 of 1 people found the following review helpful
on July 1, 2013
After reading this book from cover to cover and trying out all the example code, I have mixed feelings about this book. One good thing about a book like this is that all features in Java 7 are in one place for easy lookup and reference. The other good thing is that it's in a cookbook style, but I didn't find it as useful relative to other cookbooks (such as Wicket cookbook, Rails cookbook for example). This book can be read from cover to cover in a matter of few days. Some issues are in this book are minor - such as code formatting (which alternates between tolerable and terrible) and repetition more than necessary - those who have worked with Java for more than a year or two are likely to find this book verbose and too much cross-referencing. Other issues are major - some of the examples don't work although it's not hard to figure out where to make the changes or which additional line of code to add to make it happen, it's an annoyance nevertheless. The biggest disappointment is the chapter on concurrency - those who have read other concurrency books (such as Java Concurrency In Practice) are likely to find the chapter shallow - it appears to be a rehash of the online tutorials and javadocs - unlike other concurrency texts, no insights and recommendations are offered. The Database enhancement section of Chapter 9 is less relevant for a practitioner since JDBC 4.1 is not supported by the major open source database drivers available at this time - the examples use Derby. If you want a quick review of Java 7 features, this book may serve that need. However, for the price of this book, I would definitely expect more depth in some areas in addition to better formatting.
on May 2, 2012
This is a good read but could have been better. As the name suggests this is a cook book containing recipes describing new Java 7 features.
Lots of features have been introduced in Java 7 and the authors have covered most of them.
The target audience of this book are experienced Java developers who are familiar with writing programs in Java 5 and beyond and not for newbies to Java. Most of the recipes revolve around I/O i.e. File, Paths , Streams concurrency - which means a previous knowledge of these concepts are essential.
The book contains 11 chapters:
covering core language improvements like using String in switch, using the diamond operator for constructor type inference etc, to various recipes related to Java I/O, to GUI improvements, event handling to JDBC enhancements.
Each recipe follows a standard structure describing how to grasp the concept thru code. It is not necessary to read from start to end, the reader can jump into any recipe and read it.
Also most recipes includes caveats and gotchas which are immensely helpful for the developer.
What could have been improved:
Code examples are very basic. The authors could have taken better interesting examples to illustrate the concepts.
The code blocks are not reader friendly. The font, the formatting etc is sub-standard. This is the crux of the recipe and developers hate to see their code badly formatted.
Examples could have been less repetitive. Seems like the authors were in a hurry to release the book :)
A little bit history on Java versions. This helps readers to refresh the memory and sets some context.
Something on RIA Deployment toolkit, Custom classloaders, Garbage collector etc
Easy to read and understand. Worth picking up. Highly recommended for someone who wants most of the new features in Java 7 in one place with code examples.
on April 26, 2012
Java 7 is the latest major release of the Java Language from Oracle. This release contains a number of language enhancements and new APIs, including better exception handling, new threading mechanisms and additions to the core libraries.
Packt Publishing requested that I review one of their titles about Java 7: Java 7 New Features Cookbook by Richard M. Reese and Jennifer L. Reese, available to buy from Packt's website.
Java 7 New Features Cookbook is an OK, but sometimes inconsistent book. I found parts of it very informative and other parts frustrating, with errors here and there in the example code - overall I'd give it an average score.
The information in the book is very densely packed, but often repetitive and sometimes very slow reading. The information is presented in recipes - how-to examples focusing on a specific Java 7 feature, put together to form a cookbook.
Each recipe is presented in a formulaic way, with information under the sub-headings: 'Getting ready', 'How to do it...', 'How it works...' and 'There's more'. The code examples sufficiently cover the new feature they are trying to demonstrate, and are quite self contained, so you don't need to read the whole chapter to quickly get going with a new Java 7 feature. The 'There's more' sections expand on the basics, fleshing out the examples and include some good tips.
The book covers the full range of Java 7 new features, without going over old ground with respect to previous versions of Java. The book is definitely aimed at developers who are familiar with writing programs in Java 5 and beyond, and not for developers new to Java and OOP. A previous knowledge of Java file I/O, concurrency and a bit of SQL is required to get the most from this book.
This book was difficult to read from cover to cover, and I wouldn't suggest reading it that way. I would recommend consulting its relevant recipes before implementing new code.
A Java 7 JDK installation and an editor are requirements to reproduce the examples in the book. NetBeans 7 is stated as the IDE used to develop the code, but Eclipse or any other IDE or text editor could be used.
A note on the code examples in the book: the immediate thing you notice about the code examples is that they are badly formatted. This coupled with occasional errors in the code and new language syntax, such as try-with-resources, makes for frustrating debugging. The poor code layout is a problem throughout the book and spoilt my enjoyment of it slightly.
Chapter 1 covers new language features from Project Coin. These are small language enhancements designed to make code more readable, more useful and reduce verbosity. The useful new features to take away from this chapter are the new try-with-resources exception handling code, the use of the new AutoClosable interface, catching multiple exception types and using the diamond operator.
This chapter is a good introduction to Java 7 and I think most developers will want to get to grips with all the recipes.
Chapter 2 introduces the new Paths and FileSystem objects, which are used extensively in subsequent chapters. The new classes provide utility methods to simplify the manipulation and comparison of file paths, helping to reducing some of the bespoke code you may have had to write in previous Java versions. The most important feature introduced in this chapter is the managing of symbolic links, but you will need to be running an operating system that supports them.
Chapter 3 deals with file and directory attributes. The first recipe demonstrates a useful new method for determining a files MIME type, something which has required 3rd party libraries in the past. The chapter goes on to give examples of managing file attributes, including support for DOS and POSIX file systems, very useful for managing Linux file permissions, which wasn't directly possible before.
Chapter 4 builds on the previous chapters and uses the new Files object to create, copy, move and delete files and directories with much more control, and much less code than was previously possible. Useful new features presented are temporary file and directory management and creating symbolic and hard links.
Chapter 5 has loads of useful information for interacting with file systems. Recipes include: accessing root file store information, processing directory contents with DirectoryStream, file filtering, globbing patterns, file event monitoring and more! Lastly in this chapter, the ZIP filesystem provider recipe demonstrates how to treat a ZIP or JAR file as though they were file systems.
Java is often criticised for the amount of code needed to perform simple file reading and writing operations. Chapter 6 shows how simple these operations can now be with Java 7, including new APIs for working with buffered I/O. The new SeekableByteChannel class for random access I/O, and the new AsynchronousServerSocketChannel class for building client-server applications are recipes also worth visiting.
Thankfully, after half the book, this is the last chapter that deals with paths, files, files systems, file permissions and file I/O.
Chapter 7 showcases additions to swing which can improve the look of your GUI interfaces. Some of the cool looking new features include window opacity, varying gradient window translucency, and custom window shapes. Less exciting, but definitely useful, border type and print dialog box control recipes are also worth taking a look at in this chapter.
Chapter 9 contains a mix of new features, but has some really useful recipes. Firstly the RowSetFactory example shows how to really reduce the amount of JDBC boiler plate code needed to connect to a SQL database, execute queries and iterate over the returned data.
The next recipe demonstrates further database enhancements for reading database schema and pseudo-column information.
Another recipe worth a look include secure client-server communication using the ExtendedSSLSession interface, making use of the keytool, a serverside keystore and a client side trust store.
A new nested class, ProcessBuilder.Redirect, has been introduced to provide redirecting of input and output of external processes - useful for interacting with other executables and scripts.
I think chapter 9 is another chapter all developers will want to read.
Chapter 10's recipes deal with further concurrency enhancements to the Java language, which have been getting more and more powerful since Java 5. The new fork/join framework allows a task to be split into smaller parallelisable chunks, and then combining the results.
Other useful recipes in this chapter demonstrate using the new ThreadLocalRandom class for more efficient random number generation in a threaded environment. And the ConcurrentLinkedDeque example shows how concurrent threads can safely access the same collection data.
Chapter 11 contains bit and bobs which don't fit in other chapters. The Handling null references recipe introduces the new Objects class which provides utility methods for object comparison, null checking and hashing.
The JavaBean enhancements recipe shows how to use the new Expression class to programatically create and execute Java statements. Also the Introspector and BeanInfo class provide a new way of determining a classes' methods and fields without using the Reflection API.
Overall, I think this book is good in places, but repetitive and difficult to work though in others. About half the book is devoted to paths, files, filesystems and I/O, which I'm sure could be slimmed down a bit. I'd recommend using the book as a reference to consult rather than a book to pick up and read cover to cover. Java 7 New Features Cookbook is definitely worth a read, and I will be using the things I've learned from it in future.
Remember when java came out in 95-6? During next 10 years, it rapidly improved, both with the intrinsic language and with the available default set of libraries that came with the standard distributions. So what is there to say about java 7? The overall impression of this book is that you get a lot of useful fine tuning. Many incremental improvements that can make your code more concise, and thus more understandable and less error prone.
A large set of changes deals with paths of files in a filesystem. You have probably had to do grungy futzing around with java.io.File and related classes within java.io to get out of the jvm and access and manipulate the filesystem. Java 7 offers java.nio.file.*, with a plentitude of nifty classes. One immediate point is that these treat both the unix and Microsoft Windows cases of how filesystems are represented. Indeed, the code snippets cover these cases.
Reassuringly, there is backward compatibility with the java.io classes. But programmers are encouraged by the text to migrate to the next versions.
One cool convenience function is the ability to normalise a path, which might have redundant cases of '.' and '..' embedded in their strings. Making a standard form enables more robust comparisons and other manipulations.
But maybe the biggest new thing with paths is the ability to use symbolic links. These have been a part of unix for over 25 years. So it is a little puzzling why we had to wait till 2011-2 to get them handled properly by the 7th [!] major release of the language. Better late than never, no doubt.
An entire chapter is devoted to improved handling of file management and security, including integrating the use of Access Control Lists.
Roughly half the book deals with the filesystem. While the GUI changes are relatively limited. Now you can vary the opacity of a window, or control its shape. Another related feature is the means to vary the gradient of a partially translucent window. It does seem that GUI changes are saturating, unless there is some conceptual breakthrough for a future java.
on August 5, 2012
Java 7 introduces the new version of java features progressively.
For web applications, for new network programming features, and for the graphical interface you will see the improvement of the existing api from java 6.
As a senior developper , I recommand this book to every one who knows the basics of java and who want to get ready to work with java 7.
The examples will help you. When reading the book, after reading the first chapter, you should start with the chapters on the subjects you like most. For example, you have many chapters with file systems and IO communications which are the achievements of many years of jdk evolution and this is well explained in the book.
on May 11, 2012
If you are considering learning about the new features in Java 7 you might give the new offering from Packt Publishing, Java 7 New Features Cookbook, a try. This book offers comprehensive coverage of the new features of Java 7, organized around easy-to-follow programing recipes. It covers new features such as the try-with-resources block, the monitoring of directory events, asynchronous IO, new GUI enhancements, and more. It features an example-based approach that focuses on key concepts to provide the foundation to solve real world problems. A great resource if you are already somewhat familiar with Java and one who likes to learn by example.
1 of 2 people found the following review helpful
on May 7, 2012
By now I have read the first and second chapters of the book and can tell you how easy it is to read and understand the recipes. The recipes are written in the form "Getting ready - How to do it - How it works - There's more..." which allows you to start using the new features very fast and avoid pitfalls.
Looking at the table of contents you realize that the book covers all major improvements done for Java 7:
Chapter 1 is dedicated to Project Coin (JSR334), those small changes to the language that as developers, we'll love.
Chapters 2, 3, 4, 5 and 6 are deeply dedicated to the new Java IO named NIO.2 (JSR203).
Chapter 7 and 8 explain the graphical user interface and event handling improvements.
Chapter 9 is about database, security and system enhancements.
Chapter 10 is dedicated to the fork/join framework (JSR166).
As you can see, the major improvements of Java 7 (Project Coin, NIO.2 and the fork/join framework) are being covered in this book, that's why I recommend it if you want to upgrade your knowledge of Java to it's latest version.
I have the kindle edition and it looks great on my kindle, paragraphs are well formatted and, generally, the source code is easy to read.