Dynamic Modularity in Java

I am really excited about the Netbeans OpenIDE Lookup library! The library allows you to retrieve service-providing class implementations at runtime. My favorite part is that it is elegantly simple to use, just one call to a static method returns all of the registered service providers for a particular abstract class or interface. On top of this it is easy register modules so that they are discoverable via the Lookup library; all that you need to add to implementations is one simple @ServiceProvider annotation.

This library prevents a great deal of hard-coding. This became particularly evident in my spanning tree module development for the Gephi project. I wanted to make the module capable of finding a spanning tree using any one of an undefined number of spanning tree algorithms. With the Lookup library, someone else can add a @ServiceProvider-annotated implementation of the abstract SpanningTreeAlgorithm class, and have it appear in the GUI and be utilized to find a tree. No modification of the GUI code or the abstract class would be necessary.

If you are pumped about making your Java software more dynamic and extendable, see the following links:

Computing, Programming Best PracticesPermalink

Leave a Reply

Your email address will not be published. Required fields are marked *

*


three − = zero

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>