Monday, January 16, 2012

Book Review: JavaFX 2.0: Introduction by Example

Although Oracle's changes to JavaFX at JavaOne 2010 and JavaOne 2011 have converted me from a skeptic to a believer when it comes to JavaFX, the shift in JavaFX vision has not been without its downsides. In particular, the JavaFX book market has been tricky because nearly all available JavaFX books have been about version 1.x. In this post, I review the only book that I'm aware of at time of this writing that is completely focused on JavaFX 2.0: Carl Dea's JavaFX 2.0: Introduction by Example.

I'll start my review by stating the most important observation about JavaFX 2.0: Introduction by Example: it provided me exactly what I was looking for exactly when I needed it. There are some attributes of the book that might be considered negative by some readers that I felt were positives in my use of the book. I'll attempt in this post to articulate the finer points of these attributes so that prospective readers can make up their own minds.

JavaFX 2.0 Introduction by Example does exactly what the title implies: it introduces JavaFX 2.0 via numerous and varied examples. This code-heavy book is roughly similar to a "recipes" or "cookbook" with individual item covered (AKA a "recipe" in a recipes or cookbook) featuring subsections on the problem to be solved, the solution or solutions to that problem, and how those solutions work. Like the best recipes-oriented or cookbook-oriented software development books, this one is constructed so that Chapter 1 ("JavaFX Fundamentals") covers some of the basics of JavaFX early on. In other words, the reader is not dropped into JavaFX without first getting some examples of how to write and deploy basic "Hello World" style JavaFX applications.

Although JavaFX 2.0: Introduction by Example does provide introductory examples early on, I really appreciated the author not spending significant time discussing esoteric features of the language or delving into the history of JavaFX in tedious detail or providing pages worth of explanation on why JavaFX is the greatest thing since sliced bread. I'm usually in a hurry and I have come to resent books wasting my time on such things and this book doesn't do that. In this case, I was already familiar with these aspects of JavaFX (at least its history and why I might be interested in learning more about it), so I was especially appreciative of Dea not wasting paper and my time on that subject. In the book's concise "Introduction," Dea covers in a page and a half some advantages of JavaFX and "some history" of JavaFX along with a simple table articulating features of each release of JavaFX. It's a thing of beauty to be able to read all of this in less than two pages and in the introduction!

Dea covers some more background on JavaFX in the first chapter, but again limits that discussion to a single page. This page is more detailed than the introductory section and is a nice, brief segue into the technical meat of the book. This first page also contains the sentences that I think best sum up the value of this book:

Although this book doesn't go through an exhaustive study of all of JavaFX 2.0's capabilities, you will find common use cases that can help you build richer applications. Hopefully, these recipes can lead you in the right direction by providing practical and real-world examples.

This is exactly what JavaFX 2.0: Introduction by Example has done for me. It has provided me with a fast start into the world of JavaFX. Although I have since used several aspects of JavaFX not covered in this book, the book gave me the start that I needed and I was able to use JavaFX documentation for the areas not covered in this book.

JavaFX 2.0: Introduction by Example gets to the point quickly. Besides common things like the very brief introduction and the index, the book contains four chapters (32 "recipes") spanning 174 pages of text, images, and code. Dea doesn't even waste time with a conclusion, but ends the book with "recipe" 4.5 ("Displaying Content from the Database"). Although some readers may need a conclusion to bring closure to their reading experience, I usually little value in this for me as a reader and I didn't miss it here. I typically don't read these types of book cover-to-cover anyway (instead focusing on sections or recipes I am most interested in), so the conclusion is often unnecessary. Lack of a conclusion is another example of how Dea's book focuses most on what I want: the technical meat.

The four chapters in JavaFX 2.0: Introduction by Example are "JavaFX Fundamentals," "Graphics with JavaFX," "Media with JavaFX," and "JavaFX on the Web." The first chapter was most useful for quickly immersing myself into the basics of JavaFX and how to apply it. The examples in that chapter tend to be simple and easy to follow. The examples in the other three chapters tend to be more sophisticated because the functionality being covered tends to be more sophisticated. There are numerous lengthy code listings in the book. Although code listings may not be the easiest to read, I like to see actual code in any book on a language. Dea typically follows each code sample with descriptive text on any new feature shown in the code sample that had not been covered previously in the book. The code samples can be downloaded from Apress's site. The book also features numerous screen snapshots, which I consider a must for a book focused on user interfaces.

The concise and introductory approach of JavaFX 2.0: Introduction by Example that appealed to me may not appeal to everyone. This book, as advertised in the above cited quotation from the first chapter, is intended to be introductory (hence the title) and not to be exhaustive. Some topics that I have not seen covered in this book include subjects such as FXML, the JavaFX charting functionality, GroovyFX, and ScalaFX. Deployment is only lightly covered (and mostly via NetBeans), but Dea does reference Deploying JavaFX Applications for more details on JavaFX deployment. All of these areas, however, are fairly approachable given the JavaFX basics provided in this book. Dea recommends that readers reference forthcoming (mid-February 2012, Apress) Pro JavaFX 2.0 Platform for an "invaluable resource" that provides "further insight into JavaFX."

Although a small number of the items/recipes covered in JavaFX 2.0: Introduction by Example are based on and assume use of NetBeans, most examples in no way specific to any tool or IDE. Rather, most examples provide "raw" code that can be used in any IDE or favorite text editor. Indeed, many of the examples can be compiled with the javac compiler and executed with the java application launcher. I appreciated that in at least one NetBeans-oriented recipe, Dea took the page or two necessary to provide the code listing for code generated by NetBeans. This is invaluable for those who do not use NetBeans or who want to understand the code itself rather than simply understanding how to use NetBeans to generate the code.

JavaFX 2.0: Introduction by Example was exactly what I needed for an efficient and effective start to my investigation of JavaFX. It may not provide quite the level of soft introduction someone completely unfamiliar with JavaFX might want (especially if that person's basic Java skills are a little rusty) and it isn't an "exhaustive" JavaFX 2.0 reference either. It falls in between these extremes and seems to be a fast start example-based introduction to JavaFX for those who want to get into the core of JavaFX as quickly as possible. That's what I wanted when I purchased this book and I was happy to find out that's exactly what this book provides. It's completely JavaFX 2.x-oriented and there is no sign of deprecated JavaFX Script in any of the code examples.

7 comments:

Jonathan said...

My favorite sentence from this review is: "I'm usually in a hurry and I have come to resent books wasting my time on such things and this book doesn't do that. "

It's my favorite sentence, because I routinely use the phrase "in a hurry" in talking about recipe books. I think of readers who just want to get the job done and go home in time for dinner.

I am Carl Dea's editor, btw. He is an excellent writer, and I felt his examples in his book were fun. I'm pleased to see such a nice review of his work.

Jim Weaver said...

Dustin,

Great review! Have you considered posting it on Amazon?

Regards,
Jim Weaver

@DustinMarx said...

Jim,

That's a good idea. I'll put a shorter version on Amazon (where I bought my copy!). I'm looking forward to the release of your book next month as well and will be purchasing that.

Dustin

@DustinMarx said...

Jonathan,

Thanks for the feedback. Like you, I do associate "recipes" oriented books with getting the job done quickly to move onto other things.

This book was exactly what I wanted; the only thing I would have liked even more was to see FXML and some additional topics covered, but Dea's book gave me what I needed so that I could learn about those other things from other resources.

I note that Amazon has already reviewed my review of the book and published it. That was quick!

Dustin

D-man said...

Dustin,

I wanted to say thank you so much for the excellent book review. You pretty much nailed the gist of my intentions.

I used to be a Java Swing developer and my original goal was focusing on client-side technologies as a co-author of the book Java 7 Recipes. There I discuss topics and examples on Java 2D and Swing. I wanted to help client-side developers transition code, skills, and metaphors to the newer JavaFX 2.0 platform.

Regarding the short intro, I felt staying on topic was key (JavaFX 2.x as a solution) instead of explaining the past in great detail which can often get into philosophical discussions.

I often think, instead of telling (convincing) people why JavaFX 2.0 is beneficial it is often better to show them the facets of the platform.

I really look forward to your review on Pro JavaFX 2 Platform.

Great blog!

Carl

@DustinMarx said...

Carl,

Thanks for the feedback, for the nice words about the blog, and especially for writing that book. As I stated, it was exactly what I was looking for in a quick start to JavaFX 2.

I intend to purchase Pro JavaFX 2 Platform as well and I think the books will complement each other nicely.

I am going to be presenting on JavaFX 2 at RMOUG Training Days 2012 next month and your book helped me prepare for that much more quickly than I could have done using solely online resources.

Your book was perfect for me because I was fairly familiar with the history (good and bad) of JavaFX and was also aware of advantages of JavaFX. These are topics I was well prepared to present at the RMOUG conference. Your book helped me to build examples for the presentation and gain the deeper level of knowledge that I like to have when doing a conference presentation. The timing was impeccable!

Thanks again,

Dustin

@DustinMarx said...

Carl Dea (the author) has posted more information about this book in his post JavaFX 2.0 Introduction by Example book.