Tim Boudreau@NetBeans Day: Plug-ins "R" Us

At NetBeans day today, Tim Boudreau demonstrated how plug-in creation has gotten much easier in newer versions of NetBeans. Can NetBeans outdo Eclipse at the extensibility game?
Written by Ed Burnette, Contributor

There seems to be a continuing theme at NetBeans day today of admitting that previous versions of NetBeans (earlier than 4.0) were, well, bad, but that new versions have greatly improved. One such area of improvement is creating plug-ins (or modules). After watching Tim Boudreau demonstrating this today, one could argue that plug-ins are even easier to create in NB5 than in Eclipse, normally considered the top dog when it comes to extensibility.

Tim Boudreau shows how NetBeans is designed

Tim Boudreau should know a lot about NetBeans since he worked on it even before it was acquired by Sun. According to Tim, NetBeans is a generic desktop application framework that provides services almost all applications need. This lets you concentrate on your business logic as opposed to writing plumbing.

Everything in NetBeans is a plug-in (sometimes called a module). By removing all but the bare necessities, your startup footprint can be as low as 2.8MB. During a demo in which Tim created a simple application, I noticed a couple things I didn't know before. First, NB allows you to download and install a plug-in from an update site without restarting. And second, it allows you to load a module you just built directly into your current IDE, although starting a second IDE is often recommended for the best stability.

So what does a Rich Client Platform do for you? According to Tim, it saves years of development time, gives you free stuff, and gives you better software. Menus, actions, settings, windowing, etc. are no fun no fun and bug prone. The platform already gives you all of this, plus apps built with it are automatically webstartable. Besides, the modular programming that NetBeans (and Eclipse) force on you is a good pattern to follow in its own right.

Why modular applications? Let's say Version 1.0 is cleanly designed. In Version 1.1, you put a few expedient hacks, saying "we'll clean those up in 2.0". The problem is, you don't get to go clean it up, and version 2.0 gets more and more coupled. Version 3.0: "help!". Whenever you fix one bug, you create two more. Finally, you get to rewrite it from scratch for version 4.0, which takes a long time but has this nice perfect design... until version 4.1 comes along.

"Healthy APIs make Healthy Applications", according to Tim. If A depends on B, it has to declare a dependency explicitly. B can say that only certain classes are visible. While plug-in frameworks do this without any language changes, Tim says there will be some language changes in JSE 7 to do this for Java at large (I think he's talking about super-packages -Ed).

We can make it better than it was...

Finally Tim showed a better designed and much more functional version (including layers and brush types) of his early Paint program example. Source code can be found at http://imagine.dev.java.net . The application was split into many different plug-ins that don't know about each other. They communicate through the NetBeans global selection object. Tim and the other NetBeans folks will have more to say on this at a BOF at JavaOne on Thursday night.

(Sorry about the dark pictures, folks. Lighting in these rooms is terrible and flash just makes it worse. --Ed) 

Editorial standards