Saturday, November 14, 2009

Netbeans Platform

We recently started cleaning up a mess. This mess was the software of one of our products. The action was a complete redevelopment. I didn't even use the original code as a reference. It was a complete rethink and redesign. This also opened up some avenues for using technology to our benefit, something you can't always do or fully benefit from in the middle of a project or on existing code basis. An example would be Maven.

Either way. I decided to do the frontend in Netbeans RCP Platform. For desktop applications in Java you have 2 options. SWT or Swing. People say SWT is faster, and they might be right. But Swing has so many more benefits... like extensibility and being pure Java.

Netbeans Platform is basically an application framework built on Swing. The only other comparison to it would be Eclispe RCP. I used to be an Eclipse follower, and naturally I've built on Eclipse RCP before. Even with all the tutorials, books and documentation Eclipse RCP has a steep learning curve, and it's a mess. There is no natural progression into Eclipse RCP development from anywhere, at least no where I've come from or heard off. Everything is different that what you're used to, even their OOP style and entity names.

One of my biggest complaints with Eclipse is inconsistency. Personally I believe this is because too many people are trying to make things too flexible without proper coordination and without completing things to the end. This has pushed Eclipse into a corner where making things work the way it's best for the end user is very difficult. Eclipse has a lot of powerful features, though none of them are worth the sharp edges.

To give an example, look at Eclipse's project structure. Eclipse has a flat project structure. Maven doesn't. So the Eclipse Maven plugin doesn't really give you true Maven support. Why didn't they plugin developers just add this support? Maybe because it's just too difficult to achieve in Eclipse? I'm not saying this is the reason. It's just a guess based on my personal experiences with Eclipse and Eclipse RCP.

I only started to truly grasp this when I began using Netbeans for JavaEE development. Having not nearly as large a feature count as Eclipse does, the features it does have are far more complete and of much higher quality.

Netbeans' Maven support for instance are almost PURE Maven. You can take any Maven project and open it in Netbeans. If it's a multi-level project you can open child projects from the parent project using a "Modules" node, dedicated to this purpose. You can then build individual components, or groups of components. You can edit the POM with auto-completion. You can manage dependencies in multiple ways. Repository browsers and a whole range of other customizations.

If this isn't enough, you can even do your Netbeans Platform applications as Maven projects, using the Netbeans Platform archetypes.

It all branches from the attitudes of the core developers. On this I'd rather not branch out (for reasons obvious to anyone whose said anything bad of Eclipse in front of an Eclipse user), so it'll remain my personal opinion.

So, back to the Platform. I started developing in the Netbeans Platform. Before this I knew nothing about how to use the Platform. A bold move for a new project. Though if it was anything like Netbeans I knew it would save me tons of time. I wanted to use an application framework based on a module system, as one of the requirements of the project was modularity. When we started the redevelopment of this a few months ago I resorted to Apache Felix for a pure OSGi system. This development was interrupted, and only started again a few weeks ago.

This time I decided to use an existing framework to save me some time, something which wasn't available on this run. Eclipse RCP and Netbeans RCP was the 2 obvious choices, and past experience influenced me into a obvious decision.

I completed the JavaEE layer and settled on Geronimo for the application server (since it uses OpenEJB). Another great choice here. When I started doing the frontend I was struggling a bit at first. It's very quick to get into Netbeans Platform (here after just NBP, phew) development. There's not much to learn. Though the reference documentation isn't too good. You're mostly left up to JavaDoc and Google Codesearch (thanks to one of the NB developers for this tip).

Though, if you would work through all the tutorials and do all the examples you should be able to find your way around and get right into developing your product pretty comfortably. The result would be an application that forms very rapidly. I can't even remember the number of times I got excited because I was able to implement very advanced features in minutes. I'm not going to rave about them now, though I will be documenting them in the weeks to come as I slowly get my life back.

2 comments:

Adam Metzler said...

I to have just recently switched from eclipse to netbeans for RCP development and I don't think that I will be looking back. I use to insist on eclipse as an IDE because of the missing features in netbeans like language support outside of java or C/C++, but not anymore! This was not the only reason I switched to netbeans, when I started toying with RCP development in eclipse I too found it very difficult to achieve what I wanted (eclipse architecture is a really big maze). After trying out netbeans for RCP development and seeing all the new features, like integration with kenai, I think that I will become a long time netbeans user. The only thing that is really lagging behind eclipse is scala support, but that to is catching up.

Quintin said...

The Scala module rewrite in 6.8 is definitely a big improvement!