Tuesday, April 29, 2014

Book Review: NetBeans Platform for Beginners

The recent Leanpub publication NetBeans Platform for Beginners: Modular Application Development for the Java Desktop by Jason Wexbridge and Walter Nyland provides an introduction to and coverage of the NetBeans Platform. I review the PDF version of NetBeans Platform for Beginners that was last updated on 26 March 2014 in this post.

NetBeans Platform for Beginners features over 350 pages of content divided into ten chapters and three major parts. Although the authors address NetBeans 7.4 specifically, the material in this book should be appropriate for several future versions of NetBeans as well. No prior NetBeans experience is assumed, but familiarity with Java is assumed. Although I've used Java and NetBeans IDE for years, my experience with NetBeans Platform has been minimal, making a book focused on NetBeans Platform for Beginners attractive to me.

Part 1: Core

Part 1 of NetBeans Platform for Beginners consists of four chapters focusing on "the mandatory core features of the NetBeans Platform." The initial chapter provides an overview of NetBeans Platform and demonstrates wizard-based creation and modification of simple NetBeans Platform-based applications. Although I don't have any significant experience with NetBeans Platform, this chapter was an easy-to-understand introduction, especially because much of what is covered consists of variations of approaches very familiar to anyone who has used NetBeans IDE extensively. This first chapter also outlines many advantages and features of NetBeans Platform.

The second, third, and fourth chapters of NetBeans Platform for Beginners respectively cover the Module System, File System, and Lookup features of the NetBeans Platform (three of Geertjan Wielenga's top four NetBeans Platform APIs).

The second chapter's coverage of the NetBeans Platform Module System describes benefits and trade-offs of modularity in general and discusses several details related to NetBeans Platform Module System such as use of manifest files, NBM files, and how to split an application into modules. The third chapter's coverage of the NetBeans Platform File System includes System FileSystem (see also related slides), module layers, FileObjects, FileObject attributes and DataObjects.

The fourth chapter (and final chapter in Part 1) begins with an introduction of why high cohesion and low coupling are architecturally desirable and states that "Lookup is a generic mechanism for loose coupling" in NetBeans Platform. The authors discuss the general JDK ServiceLoader mechanism as a foundation for understanding the NetBeans Lookup mechanism. They then compare the two approaches and list advantages of using NetBeans Lookup with applications based on NetBeans Platform. There are quite a few pages in this chapter devoted to introducing and demonstrating use of various approaches one can use to leverage the Lookup mechanism and the @ServiceProvider annotation.

Part 2: GUIs

Part 2 of NetBeans Platform for Beginners contains three chapters focusing on GUI components of the NetBeans Platform. Chapter 5 covers the Action System, Chapter 6 covers the Window System, and Chapter 7 covers Nodes and Explorers.

Chapter 5 introduces the NetBeans Platform Action System and introduces the ActionListener annotations @ActionID, @ActionRegistration, and @ActionReference. The chapter covers presenters such as menus, toolbars, keyboard shortcuts, and mnemonics.

The sixth chapter of NetBeans Platform for Beginners is focused on the NetBeans Platform Window System. There is quite a bit of content packed into this chapter including coverage of the benefits of the Window System as well as coverage of specific conceptual details such as describing components, registering components, component lifecycle, docking components, undoing changes within components, and lookup. The advanced section of this chapter's concept coverage was useful in understanding some of the material prior to the advanced section. For example, I understood Modes better after reading the advanced section on Modes than I did after reading the earlier section that briefly described Modes. One particularly interesting aspect of this chapter is highlighting of the internally (to NetBeans) developed Simple Validation API.

NetBeans Platform's Nodes and Explorer Views are the subject of Chapter 7 of NetBeans Platform for Beginners. The authors emphasize that "Nodes are a layer of indirection between a data model" before delving into coverage of specific types of Node classes. For example, the authors explain how a BeanNode is an adapter that wraps an underlying data-centric JavaBean/POJO with properties for presentation purposes. Other types of covered Node classes include DataNode (wraps file access), FilterNode (decorates another node in memory), and AbstractNode (suitable for extending for most custom Node implementations).

The authors also discuss explorer views in Chapter 7: "The Explorer & Property Sheet API consists of a set of GUI components, known as explorer views or explorers, that render Nodes."

Part 3: Extras

The first two parts of NetBeans Platform for Beginners ("Core" and "GUI") covered commonly used features of the NetBeans Platform. Part 3 focuses on NetBeans Platform features that are less commonly used.

Chapter 8 begins with an introduction of NetBeans Visual Library and NetBeans Platform Component Palette. Its initial paragraph on NetBeans Visual Library is essentially that provided on the library's main page:

The NetBeans Visual Library provides a set of reusable, predefined, and extensible Java components, called "widgets". Each widget has, built into it, various features, such as actions, layouts, and borders. When you compose widgets together, you can quickly and easily visualize data to the user. Combined with other NetBeans APIs, the NetBeans Visual Library lets you create interactive UIs, with drag-and-drop features commonly found in designer software.

The NetBeans Platform Palette and NetBeans Platform Widgets are covered in Chapter 8.

The ninth chapter of NetBeans Platform for Beginners introduces the NetBeans Platform "project type" and defines it as "a group of folders and files that should be treated as a single unit." There is significant detail in this chapter on using various APIs available on a NetBeans Platform project.

Chapter 10 is a "Miscellaneous" chapter that begins with a table of NetBeans APIs listed in alphabetical order. Text detailing each of these APIs follows the table. Most of the chapters prior to this one covered concepts first (basic and then advanced) before covering application of those concepts in the "Getting Started" section of each chapter. Chapter 10 is different in that the concepts and application are largely covered (briefly) together.

Other Observations
  • NetBeans Platform for Beginners makes use of numerous color (in the PDF version) screen snapshots. This makes visualizing what is being described more pleasant and makes reading and understanding the material easier.
  • I appreciate the color coded syntax applied to the code listings in PDF version of NetBeans Platform for Beginners. Using editors and IDEs that provide color coded syntax for years has spoiled me and I find it much easier to read code in a book when it has syntax coloring. Code samples in books are still not as readable as in IDEs but color syntax is far easier to read than syntax with no color highlighting. Some of the code listings don't seem completed color coded (some keywords are color coded in some listings but not others), but I appreciate the effort to get most of them color coded.
  • The PDF version of NetBeans Platform for Beginners that I reviewed has embedded links in text that references other parts of the book. This is very convenient and much easier to use to navigate throughout the text than trying to find a referenced subtitle or page number. Hyperlinks are a big part of the reason for the ubiquity of the web and I'm a bit surprised that more electronic books don't apply the concept as it is a major advantage over printed books.
  • I like that NetBeans Platform for Beginners often provides keyboard shortcuts for various actions in addition to explaining how to specify actions with mouse clicks.
  • There aren't many typos or spelling errors in the version (March 2014) of NetBeans Platform for Beginners that I reviewed. One exception to this is in Section ("JPA"), which defines the JPA acronym as "Java Persistence Annotation specification" rather than as the "Java Persistence API specification." None of the typos I saw affected the accuracy of the information in a meaningful way as far as I could tell.
  • Although the "for Beginners" portion of its title suggests its introductory nature, NetBeans Platform for Beginners has enough detail in it to be useful as a reference as well. In fact, I think there are portions of the book that I'd better appreciate once I had more familiarity and practical experience with NetBeans Platform. Geertjan Wielenga, who is very familiar with the NetBeans Platform and has read multiple books on the NetBeans Platform, has written about NetBeans Platform for Beginners: "I think 'NetBeans Platform for Beginners' is a fantastic resource for NetBeans Platform developers, all the more so in combination with Leanpub.com, which is a simply wonderful authoring/publishing platform."
  • Most chapters in NetBeans Platform for Beginners covered concepts first and then illustrated those concepts with realistic code examples. In some cases, I found this enhanced my learning and in other cases I found I needed the code examples to clear up my interpretation of the descriptions of the concepts.

NetBeans Platform for Beginners provides a comprehensive introduction to the NetBeans Platform (version 7.4 specifically, though most of its content will apply to versions before and after that). It begins with "core" information that is easily learned by someone new to NetBeans Platform and the other two parts add increasingly deep information regarding the NetBeans Platform.

No comments: