Derby Is Cool

November 20th, 2004

I thought it was worth mentioning that I got to play with Derby as part of the Time Tracker mini-project I mentioned earlier.  Very cool.  I’ve not had a need to work with an embedded database before so it was really nice to have a small, efficient library that handled all my data storage needs.  The only complaint I’d have is that it needs to use a directory to store stuff in (it’s a little more flexible than that but a directory is always created and used).  It would be really nice to be able to just point it at a file and say "that’s my database, do your thing".

It probably would have also been useful to have a persistence tool that worked well with the embedded database. For instance, I was really storing a database representation of TimeEntry objects. It would have been nice to be able to have an API similar to:

store(TimeEntry entry);

find(TimeEntry entry);

update(TimeEntry entry)

 

The find method would have some magical way of detecting which data items within the TimeEntry I’d actually specified and form a search query for all entries that had those attributes with those values (but ignore attributes that I hadn’t explicitly specified).  Similarly the update method would have some magical way of knowing which entry I was talking about.

Of course, I wrote an interface along those lines but it would have been nice to avoid relearning SQL to do so.  An embedded database is going to be used in situations like this a lot where what’s really required is an embedded persistence mechanism.  I’m sure it’s possible to achieve this but it would be nice if there were a project dedicated to it that worked out-of-the-box so to speak.

JDIC

November 20th, 2004

Java Desktop Integration Components (JDIC) is a set of components aimed at making OS specific functionality available to Java programs and to allow Java programs to make better use of existing code within the OS.

The tray icon integration is an excellent example of this.  It’s quite common for a Windows application to make functionality available via a system tray icon and now via JDIC Java apps can do just that.  During some down time after our last release I had a chance to play with this while developing an internal time tracking application and it worked out really well.  The system tray icon acts as the main UI for the program so it’s neatly tucked out of the way so it doesn’t waste screen space but always quickly available so recording time spent on a task is highly efficient.  The downside is that it doesn’t seem to map to an OS X dock icon menu yet (the API doesn’t really fit that model particularly well anyway but it could be done).

The other interesting project for me in JDIC is the browser integration.  There are a lot of complaints about the current HTML support in the Swing Text package so a simple solution for rendering HTML is to provide a Java interface to integrate the user’s default browser instead of attempting to write a pure-Java solution.  Naturally this platform dependency restricts the number of systems that the program can run on but that’s probably not a bad tradeoff.  Sadly, again this component isn’t working on Mac at the moment.  The other massive limitation of this approach is that it doesn’t support HTML editing at all.  The current Swing Text code may not be the world’s best editor (though you can build the world’s best editor using them <grin>) but at least they provide some editing support.

It’s particularly sad to see that Mac support isn’t being worked on early in the process and that Sun (who is throwing the majority of resources behind the project) isn’t putting some time into Mac ports instead of expecting the community to do that.  The projects have a lot of potential but if they’re not available on the major OSs which Java is deployed to (Windows, Linux, Solaris and Mac) it makes them far less usable.  It’s great that it’s possible for Mac developers to add support themselves since the code is opensource, but that doesn’t help much when the target audience for the library are Java developers but the developers have to be native programmers (Obj-C or C on OS X, C pretty much everywhere else).

It will definitely be interesting to see how this project progresses.