Friday, March 21, 2008

Some Things I Like About NetBeans

I have been thinking of writing about how much I like the recent NetBeans improvements. On March 20th I got an email from Sun about their NetBeans IDE 6.1 Beta Blogging Contest. Cool. I can write something I would have written anyway, submit it to the contest, and possibly enjoy these benefits (in decreasing order of probability): more blog traffic, interest in my consulting services, a Netbeans t-shirt, 500 bucks. Why not? So here are some things I like about NetBeans.

Excellent Support for Languages I Use
I'm a regular listener—and sometimes an in-person recording session attendee—of the Java Posse Podcast. I've come to highly regard Dick, Carl, Tor and Joe (and think of them as my imaginary friends). I've enjoyed hearing Tor talk and blog from time to time about how he is adding support to NetBeans for JavaScript and Ruby. At JavaOne 2007 I got to see Tor demonstrate his new Ruby features, and was very impressed by his work, as were many others in the audience. And since I also use Python in my consulting and teaching, I was pleased to hear Tor indicate on a recent Java Posse episode that Sun will probably add really nice Python support to NetBeans.

A Long Path to the Java Persistence API (JPA)
I've been programming with databases for a long time, starting with IBM's Information Management System (IMS) in 1979 as a young man just leaving his teens. In the 80's and 90's I used relational databases: dBase, Oracle, and MySQL. In the early 2000's I started using PostgreSQL, and then decided to learn Object Relational Mapping (ORM).

The ORM tool I used for awhile is Torque. It's a nice tool, but I don't think it ever became very popular. I remember telling Chris Richardson at the EBIG Java SIG, when we were first getting acquainted, that I was using Torque and he found it amusing. Some months later, when I saw him again at another meeting, he was recalling who I was and said something like, "Aren't you the guy who's using Torque?"

As Hibernate became more popular, I decided that I no longer wanted to be "the guy who's using Torque" (and no one was paying me to write to Torque for them). So I learned how to use Hibernate, and put it to work in several projects for myself and for clients.

Java 5 came out and added annotations, and Hibernate adopted them. I could now throw away the XML files that described the mappings between the database and the Java classes and instead annotate my classes with JPA's @Entity, @Id and the like.

The next step was to do all the persistence using JPA, and to have no Hibernate dependencies (although I could continue to use Hibernate as the persistence provider).

I played with the Java EE features of NetBeans 6 when I first downloaded it. NetBeans comes with (if you download the really big version) an application server: GlassFish, a database management system: Java DB, and a persistence provider: Toplink Essentials. NetBeans has nice tools to add a persistence unit and entity classes to the application. It automatically sets up the application server configuration files and database connections. This is a nice way to learn to use JPA!

Unified Modeling Language (UML) Support
Recently I developed a prototype JavaScript application for a client. It persisted data in the back end via Direct Web Remoting (DWR), using Java classes annotated with the Java Persistence API annotations. NetBeans was able to look at the database schema defined entirely with JPA annotations, and generate very nice UML diagrams that I was able to use in discussing the application with the client.

Documentation
There's a lot of excellent documentation for NetBeans 6.1, including guides for using databases, application servers and persistence. Much of this is NetBeans 5 documentation though, and doesn't quite match up with what we see in the IDE today, so I do hope Sun gets it updated quickly.

Summary
With version 6.1, NetBeans has taken big steps forward in giving me what I want in an IDE. Where before I used Eclipse for everything except Swing GUI development, now I find myself using NetBeans exclusively for many projects, especially Web applications, for both the front and back ends.

If you haven't seen NetBeans recently, I recommend you take a look!

0 comments: