Over a million developers have joined DZone.

Book Review: JavaFX 2.0: Introduction by Example

DZone's Guide to

Book Review: JavaFX 2.0: Introduction by Example

· Java Zone ·
Free Resource

Java-based (JDBC) data connectivity to SaaS, NoSQL, and Big Data. Download Now.

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 perspective 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.


From http://marxsoftware.blogspot.com/2012/01/book-review-javafx-20-introduction-by.html

Connect any Java based application to your SaaS data.  Over 100+ Java-based data source connectors.


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}