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.
Latest posts by Mark Stephens (see all)
- Introducing the new XFA Parser in FormVu - May 16, 2018
- Moving to JPedal release 8 - May 2, 2018
- Which version of Java SE should I use? - April 25, 2018
- How we are improving our code quality with IDEA in 2018 - March 7, 2018
- How we are improving our code quality with NetBeans in 2018 - March 1, 2018