Pages

Sunday, August 14, 2011

Book Review: NetBeans IDE 7 Cookbook

I have had the opportunity to review NetBeans IDE 7 Cookbook by Rhawi Dantas from Packt Publishing. Let me start by saying that the title is misleading. Normally I expect a cookbook to provide solutions to common problems, or situations which are not normally covered elsewhere, e.g. documentation, or tutorials. This book should have been called NetBeans IDE 7 Tutorial.

Now that I have gotten past the title, I should be frank and say that the book is targeted for new NetBeans users. If you have been using NetBeans for more than a year, this book is not for you. Advanced NetBeans users will likely find very little information in the book for which they are not currently aware.

If you are a new NetBeans user, the book provides a good tutorial on the features in NetBeans. The "recipes" are very topical though. The NetBeans project has a number of great tutorials developed from members of the NetBeans team, and community contributors. A majority of these tutorials cover more details than are in the book. This is not to say that the book is bad, or poor, but does not cover the topics in as great details as some of the more targeted tutorials available.

I would give the book 3/5 stars for new NetBeans users, and 2/5 stars for advanced users. I gave the book a dual rating since I believe that there is valuable information for new NetBeans users, but it is less valuable for advanced users.

Chapter Details

The book is divided into twelve chapters. It covers basic IDE usage to source control, and is logically divided into chapters based on functionality from basic IDE functions to technologies.

Chapter 1 - NetBeans Head First

This chapter has the obligatory "Hello World" application example, and demonstrates some basic features of the IDE. The examples show how to create projects, import projects from Eclipse, and use Apache Maven projects.

The chapter mentions that the Apache Ant scripts allow the project to be run outside of NetBeans. It also notes that Apache Maven applications are first class projects that the IDE can use without modification.

Chapter 2 - Basic IDE Usage

This chapter covers basic IDE functionality. The discussion is a good place to start for any new NetBeans developer. It is well done, and gives a good overview of the basic functionality.

Conditional breakpoints (page 31) are mentioned, but does not cover how to configure, or use them. I was disappointed This is a really nice feature which developers should take advantage of.

Chapter 3 - Designing Desktop GUI Applications

This chapter starts off with as the author notes:
One of the greatest strengths of NetBeans is the powerful Swing GUI Builder.
I couldn't agree more. The Swing GUI building functionality has always been strong, and with each release it gets better.

The SwingX project mentioned on page 38 is actually at Swing Component Extensions. The book has a link to the old project location on Java.net.

On page 56, there is mention of properties one of which is Code. This was an opportunity for the author to provide a real cookbook answer. Alas, it was not meant to be. The author glances over the pre- and post- configuration parameters without an explanation.

The author also comments on the following page that JavaDB is not production quality. I would respectfully differ. Before becoming Apache Derby (JavaDB), it was a database product called Cloudscape from a company by the same name. It provides a great enterprise quality database which has a number of capabilities found in databases 10x its size. I think that the comment is completely without fact, or merit.

Page 62, has a set of typographical errors on item #2. It should read as follows:

Image image = resourceMap.getImageIcon("window.icon").getImage();

The version on the page has guillemets instead of quotes.

Page 67 Step #4 should use EclipseLink instead of TopLink which is its replacement.

EclipseLink JPA 2.0

Chapter 4 - JDBC and NetBeans

This chapter spends a majority of its space dedicated to setting up databases like MySQL, PostgreSQL, Apache Derby, and Oracle. The remainder of the chapter has an explanation of the SQL Editor. It is a nice introduction for beginners, and could serve as a primer.

Page 81, uses the ojdbc14.jar. This is incorrect. It should use ojdbc6.jar.
 

Chapter 5 - Building Web Applications

This is my personal bread and butter. Swing applications are no where near the usage levels as Web based development using Java Enterprise Edition (EE).

One of my favorite things about this chapter is an example of writing a JUnit test for EJBs located on Page 105. This example is very well done, and demonstrates the power of using the embedded container.

The biggest disappointment is the coverage of JSF which is lackluster. There is more coverage of Apache Struts than JSF which is part of the EE specification.

Page 96 under WEB-INF mentions that the web.xml file is located here. This file is optional in Java EE 6, and may not be present. Also the picture shows a beans.xml file which is only present if Context and Dependency Injection (CDI) is being used. It is also optional.

Page 111 has a JSF coding error on <h:panelGrid/> which incorrectly uses rowClasses. It should be as follows:

<h:panelGrid columns="2">
Page 114, the image shows an incorrect layout which has the Session Bean Package and JSF Classes Package listed as ejbs. These should be kept separate.

Page 115, faces-config.xml is not required in JSF 2.0. The author spends a lot of time configuring the faces-config.xml file which is not required, or desired. All of this is handled by annotations. JSF developers take heed!

Page 117, under how it works mentions facelets templates which are not covered in this section, but subsequent section. This is entirely misplaced. Further, the explanation is the author's viewpoint, and is not required by the specification. The reasoning is relatively sound, but should be conveyed as opinion.

Page 127, the author missed the title of the book on NetBeans 7 and mentions Google Web Toolkit and its plugin which are available on NetBeans 6.8. Therefore it is irrelevant.

Chapter 6 - Using JavaFX

This chapter is irrelevant since the functionality discussed is part of NetBeans 6.9.1. That said, it does provide a good learning path for what is available in NetBeans for JavaFX.

I am not sure when the author began writing the book, but currently there is a JavaFX 2.0 Beta SDK Plugin for NetBeans available.  

All developers interested in JavaFX should be using the new plugin.

Chapter 7 - EJB Application

This was a sample chapter that the publisher sent to me originally. The demonstration is well done, and serves as a nice accompaniment to my demonstration on Youtube of how to do some of the same things with JPA.


The recipe for doing a Stateful Session bean demonstrates its usage correctly, but fails to cover when and where you would want to use them.

RESTful web services (JAX-RS) are very popular right now. It seems like every time I look around, I find more applications taking advantage of it. The coverage here is simplistic. The reader is better off looking on the Jersey site, looking at this overview, or demo.

The explanation of Metro (JAX-WS) as a web client is well done, and the example using Google Maps is easy "eye candy".

Chapter 8 - Mobile Development

I examined the section, but reserve some comments since I use Mac OS X and refuse to install Windows to use the kits mentioned. That being noted, the latest version of the Java ME SDK does work on Mac OS X.

CLDC Application Emulator and NetBeans 7.0.1

I was able to create the CLDC application without issues, and run it as can be seen in the image.

I could not verify the Nokia S40 Toolkit since it works only on Windows.

The CDC environment is not available on Mac OS X. I could not verify the information as noted above. I don't use Windows.

Chapter 9 - Java Refactoring

The author does a good job of explaining the refactoring tools in NetBeans in general. This is more complete than a number of publicly available tutorials. This would be a reason to buy the book. I really enjoyed this part of the book, and wished that the author would have provided even more examples. I liked it. The extracting a super class and interface examples are very nicely done.

The author should have skipped a comment at the beginning of the chapter about the techniques breaking some code. As with any refactoring tool, you could cause some code to break, but this puts a new developer on the defensive, and could cause them not to use the tools. This would be a real shame since the NetBeans tools are some of the best around.

Page 202, How it works has commentary about the folder name and project name should be the same. I totally disagree. You could call the folder ejbmailapplication, and then use the refactoring tools to rename the project EJB 3.x Mail Application which is much easier to read than a generic folder name.

Chapter 10 - Extending the IDE

This chapter is dedicated to providing an example of how to extend the IDE to meet a specific need. The examples are contrived, but do demonstrate the ease with which you can extend NetBeans. The examples are simple and to the point.

This is a well done set of examples, but I feel most people would not use this information.

Chapter 11 - Profiling and Testing

I found this chapter to be another missed opportunity by the author. The chapter starts out by showing the user how to perform a profiler calibration of JDK, It is followed by profiling an example application. The author does not provide any real depth to the profiling beyond the basics. There is not explanation, or what the information means. There are some obvious "hot" spots which are shown for example initComponents() and startup() could have some discussion points.

The section on creating JUnit tests explains how to use the IDE to create the tests, but does not cover any of the options that are available, and why you would choose to use them, or not.

The section on SQE is so short I feel it could have been skipped. SQE is a really good tool, but this cursory preview is not much to get you excited about it. I use it and PMD on a daily basis. If I didn't know more about it, I would believe that the author finds it mildly important. SQE can make you a better developer if you understand what it is telling you about the code.

The section on monitoring HTTP connections covers a lot more details than I have seen elsewhere and may be a gem in the rough. I had not played with "replay" and it was interesting.

JMeter should have been skipped. It is frivolous in coverage.

Chapter 12 - Version Control

This chapter covers two important source control systems. The first is Subversion which is probably the largest installed base worldwide. Every very large enterprise I have worked at has used it. I use it at home for code that I post on my blog.

The coverage of Subversion is very well done. Every developer using NetBeans with SVN should read this chapter.

The second source control system is Mercurial. When Sun chose this for OpenJDK I was surprised. Until that point, I had never heard of it. The coverage here of this important SCM is very well done too. If you are using a distributed SCM like Mercurial, this section is a good read.

Please note that NetBeans supports Git and numerous other SCMs.

Additional Information

Additional information on the book, errata, and ordering information directly from Packt can be found here: http://www.packtpub.com/netbeans-ide-7-cookbook/book
Enhanced by Zemanta

3 comments:

  1. Hi John,

    I am Rhawi, the author of the book.

    First I would like to say thanks for the reviewing the book and giving your comments about it. I really do appreciate the input. :)

    However I would like to point out that due time contraints and scope was just impossible to go into more detail on the technologies that are not NetBeans related and even though we cover a lot of ground (mobile, web, desktop, vc, etc) for a 300 page book, some of the examples with specific technologies (such JSF) might lack in depth, and I do agree with you, but there was just not possible to dive further than what we have now. I wish that I would have had the opportunity to go further, specially on Web since it is also my bread and butter. :)

    Packt's idea of a Cookbook is that we help the reader until a certain point where reader might feel comfortable of using the IDE and basics of a certain technology.

    We did start the book with NetBeans 6.8 in mind but the project has been furiously adding versions after versions with new features and deprecating others at the same time. This alone added to a lot of confusion from the time we started the project until completion.

    There are always room for improvements and if/when we decide to release a new version you can be sure that I will have your comments in mind.

    Once again I would like to thank you for your comments. :)
    Rhawi Dantas

    ReplyDelete
  2. I really appreciate it when an author takes the time to look over the reviews and follow up with the reviewer.

    I understand the time constraints involved. Writing a book is a significant undertaking, and a book on NetBeans (or any technology) is a moving target.

    You have done a great job of providing a jumping off point for a new developer. I have given the book to a new NetBeans user on my team to get her up to speed this morning. I think the book will be invaluable to moving her skill set forward.

    I am still stuck on the word "cookbook". For me a cookbook provides simple solutions to common problems. As an example, the section on conditional breakpoints is a great point for a cookbook item. How and why would I choose to use a conditional breakpoint?

    I liked the book, and I encourage new NetBeans users to give it a try. Chapter 9 on Java code refactoring was nicely done!

    I look forward to reviewing your future books.

    ReplyDelete
  3. Good review, I more or less share your opinion - even if I did not delve into the nuts and bolts as you did :-)

    ReplyDelete