Lessons From a NetBeans Platform Master
I was recently lucky enough to attend Toni Epple's NetBeans Platform Architect Course in Johannesburg, South Africa, and thought that I should share a couple of observations that I made throughout the course:
- Don't ignore normal patterns: If it seems like a singleton is the best way to do something then it most probably is - don't then try and push it into a Lookup because it seems like the NetBeans platform thing to do.
- Sometimes Swing is enough: Don't feel that you need to use nodes, or outline views or the lookup. If the solution seems easier by using standard Swing then just do it.
- It's just Swing: The NetBeans platform is built on Swing, so if you're wondering if you can swap out a component with one of your own custom ones, you probably can. Want your own custom status bar? Write it.
- It's modular: If you don't like the way the Default Window Manager works then replace it.
- Be modular: If you think that there's a chance this code will be used somewhere else then create a new module.
- Avoid Module Installers: As a rule of thumb try to not have one for your module, they slow down start-up, and you have to be aware of what modules have been initialized if you want to use classes from them.
- Take Advantage: The platform has a lot to offer you. Initially it seems like too much, but after a while you get into the swing of how it works, what it can offer you and what you should use. For example the UI gestures Collector – You can detect slowness, log errors and analyse what sections of your application are not being used.
- Action Attributes: I could never quite figure out which attributes I was allowed to use with my actions – There just didn't seem to be a list. If you Google the methodValue of instanceCreate in your action (ie org.openide.awt.Actions.context) you will get the javadocs of that particular method call. The method parameters are the attributes for your action.
- Annotations: The increasing use of annotations in the platform can only be a good thing, I can't wait for NetBeans 7 to come out so that I can start using the Action annotations.
- Visual Library: I need to find an excuse to use it, it' just that cool!
- Your application doesn't need to look like the IDE:
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)