Tuesday, October 28, 2008

Tried Maven for Jibs

Over the last few days, I converted JIBS directory structure to work with Maven and got Maven to build JIBS. JIBS uses a three other jar files so I really like Maven's repsoitory. Unfortunately, none of the jar files I use are in the Maven repository.

So far so good. Based on my experience, if you are doing lots of smaller Java projects that need to roll up to a big deliverable in an orderly way, Maven is great.

I was particularly impressed with the strongly recommended directory structure (convention over configuration). Moving the files around not only made Maven work out of the box, but made the project more understandable and simplified my existing Ant scripts. Clearly an advantage if you are working on many projects since they will all have the same basic structure.

So, to recap, the good points were:
a) Maven does way more than Ant for its size
b) The dependency management features are great
c) The self-documentation features are great

But I won't be replacing my Ant scripts with Maven. Problem is that on the same code base, I compile for both Java 1.6 and Java 1.4. I do this by dropping a few source files and then calling the compiler with a 1.4 compile option. Opps, no readily apparent easy way to do this in Maven. (I'm not sure there is any practical way to do this in Maven.) Also, I unzip jar files and include classes in my distributable - making it a one click jar file (with an exe wrapper). Again, that's not a Maven kinda thing. So, I'll just stick with ant as my main build tool for the moment.

So here are the bad points:
a) You fall of the face of the earth very very fast if your project deviates from Maven's model.
b) The documentation is a bit sparse.

So, in poking around, it looks like Gradle could be good, but my Ant scripts are working just fine for now.

What do I suggest?
a) We adopt the Maven directory structure
b) We use Maven or other dependence management tool to manage all our modules/products/projects or whatever the heck we call them.
c) We use Maven for when its good (enforcing the directory structure at least...)
d) We use something else for when its bad

Gerhard

Gradle
Ivy
Ivy Review

Maven Issues #1
Maven Issues #2
Maven Issues #3

Sunday, October 19, 2008

The Agony of Java Preferences

My open source project, JIBS, uses Java preferences to save user settings. That part works very well using the Windows registry or, for Linux, hidden directories on the user's home. So far so good.

Then I have a user who says he want to use JIBS with his data on a thumbdrive as he moves from machine to machine. Well, OK, all I have to do is figure out how to write the property files out and read them back in without going to default registry and leaving garbage on every machine he visits.

So I extend Preferences and use the export function to get the file out. A quick test show that the import function reads it back in nicely. What I didn't notice on the quick test is that the export is a non-static function (meaning it works with my extension great), but the import is a static function (meaning it ignores my extension and write to the system properties - which I am trying to avoid). Argh! The lack of symmetry alone is enough to drive you crazy.

Next up, the preferences can not be changed while a program is running - you have to pass in on the command line. So if I try to use a pseudo preferences, I can write them out but not read them in, and if I use the real preferences, I have to have the user's type them on a command line. Yuck.

So now I have a starter module the forms the correct command line then cranks off another instance of Java. Seems a little silly really. Then I notice I lose all console statement (useful for debugging). So I have to get console output of the second Java instance and print it in the first Java instance and create a single from the second to the first so they will both shut down together.

Got all that working and fired off version 2.3.1. Then I hear from another user that JIBS won't work if he moves it from his download directory. Turns out I tested on paths with no spaces and he moved it to directory with spaces in the paths. So after a bucket of double-quotes I finally fixed that problem.

And all this after my first quick look way "no problem, I see preferences has both export and import"!

Don't Make Me Think

Steve Krug's nice thin "common sense approach to web usability".

Very practical book of good web site design techniques. Two things basically: follow conventions so user's easily know what to do with your site and rigorous but simple, easy and cheap testing. One of the points is that if the testing is not simple, easy and cheap it won't be rigorous because to be rigorous you need to do it early and often. Good points of no such thing as "average user" ect. Excellent read altogether.

The Inmates are Running the Asylum

Finally got around to reading Alan Cooper's "The Inmates are Running the Asylum". Alan Cooper is the father of Visual Basic and an outspoken proponent of making software easier to use. This 1999 book is still relevant today - it basically proposes the need for interaction design using very specific personas for the users and focusing on their goals.