At the recent NetBeans Greece Day, I heard a very interesting talk on using NetBeans in agile development, mapping each new feature onto a module. This made me think about whether I could make better use of the NetBeans modules….
The problem with any coding activity is that it tends to grow and sprawl. Our company (IDR Solutions) code base has expanded over the years and we now have several products using different parts of the code. In our case, we have a PDF to HTML5 converter, a Swing GUI, a JavaFX PDF viewer, lots of serverside code examples. Initially we just deleted the bits not needed for each build but this has become increasingly brittle and hard to maintain. So here is what I did….
The shared code is now in a core module, which in our case is low level code to read and decode PDF files. We have extracted the image code we use into a separate library (the new JDeli image library). All the code for the JavaFX PDF viewer is now in the javafx module. This makes it much easier for us to separate out the different parts of the application and also to create specific customer builds.
We actually have a special build for several customers. Adobe uses JPedal in ColdFusion, so there is an Adobe module which allows us to build and test their version and keep any specific Adobe code there. We can easily give them HTML or XFA features by adding the module to their build.
We still provide our customers with a single jar or zipped src of either the PDF library or the PDF to HTML5 converter. But it makes it much easier for us to test and maintain internally. Because NetBeans modules can be just a simple wrapper around a Maven project, this also allows you to convert your code base very easily into a set of Maven projects.
Testing is also vastly improved because the code exactly matches what is in the IDE. Continuous integration tests can now be far more precise – changes to the jpdf2html5 code do not run tests related to PDF viewer or PDF to Image. Only core changes will run all the tests (as core changes could impact everything).
So if you have a Java project which has ‘grown’, I recommend you have a look at splitting the code into specific NetBeans modules as a way to tidy up and modularize your code. It has worked very well for us.
Did you know...
IDRsolutions offers a whole range of online file converters to convert PDF and Microsoft Excel, Word and Office Documents to HTML5, SVG or image formats?
It is free to use for single file conversions and also includes Developer links if you want to use our commercial software for bulk conversions. Find out more on this page