Friday, March 07, 2008

Extracting Utility Code - Contributions To JODD

I have begun a serious campaign to accomplish two “house cleaning tasks” in all of my Java programming projects:

[1] Identify code in my existing methods that is suitable for extraction into utility methods.

[2] Move suitable code into utility methods when writing new code.

My goal with these two tasks is to contribute my utility code into the JODD library. My utility code will be reviewed (and likely improved) by the JODD maintainer, Igor Spasic.

I believe this house cleaning effort will result in cleaner interfaces for my own programming libraries and projects, and hopefully in a more comprehensive JODD library. I’ve started a folder on the SurveyOS SVN repository to hold code that I think will be eligible for inclusion in JODD. I’ve also placed this code in an Eclipse project called JODD-Ex (JODD Experiemental). I am now actively adding to and maintaining the code in this Eclipse project and I am referencing it in my other Eclipse projects.

What type of utility code have I managed to extract from my existing projects?

So far I have six (6) different packages and 16 classes or interfaces. Below is a brief description of each of the six (6) packages:

jodd.collections.tools: Contains utility methods for members of the Java Collections Framework.

jodd.i18n: Contains utility methods for working with java.util.Locale objects and an alternative to the standard ResourceBundle class. This alternative is backed by a YAML text file and allows for storage and access to descriptions and metadata for translated Strings. (I hope to use this for my translation work in OpenJUMP soon.)

jodd.io.binary: Classes to ease the import and export of binary data. This includes an index that maps UUID objects to the location of binary data representing the object identified by a UUID in a binary file. This should be handy when working with RandomAccessFiles.

jodd.objectutils: Contains methods and interfaces that I wish were in the java.Object class.

jodd.text.parser: It seems that I write a lot of parsers, especially text parsers. I seem to be drawn to this type of programming after I wrote my simple XML pull parser from the ground up. This package has some classes to make creating text parsers easier.

jodd.text.yaml: This package contains some classes that make parsing and working with text data in YAML format easier.

You can view and download all of the JODD-Ex code from the SurveyOs Subversion Repository:

http://surveyos.svn.sourceforge.net/viewvc/surveyos/java/jodd-ex/

I’ll post again soon on my efforts to test, improve, and integrate this utility code into the main JODD Library.

The Sunburned Surveyor
Posted on 12:35 PM | Categories: