Archive for October, 2003

'State of the Sandbox'

Friday, October 24th, 2003

I’ve put a commentary on the projects in the Jakarta Commons Sandbox up at generationjava.com.

Basically an attempt to provide an overview of the sandbox and not just those which happen to be shown on the website.

Commons-Lang: Justify your existence

Thursday, October 2nd, 2003

There was a cool episode of Red Dwarf called the Inquisitor. An eons old droid who searches the universe replacing people who cannot justify their existence with people who never had a chance at life [basically one of the failed spem in a person’s contraception]. In other words:

“He prunes away the waste, expunges the wretched and deletes the worthless!”, with a catchphrase of “Justify your existence!”

As Kryten concludes, in the end this comes down to:

“the object isnҴ fame, itҳ simply to have lived a worthwhile life!”

So I wondered if Commons Lang would pass the test. Is it justifiably worth coding?
From my view point, Commons Lang is just a global version of my GenJava-Core library. That’s not to say they have the same functionality, or even the same code, but Lang is effectively the underlying library which I like to sit upon. This used to be GJC. Having a personal util library is a great thing and saves a lot of boring coding. It’s customised to your own tastes and you know where all the lazyitis has occured.

For me, GJC has been very worthwhile. Has it been worhtwhile to anyone else? Vaguely so. I don’t think many used it themselves, though some did c+p code out of it if I should mention that such a piece of code was in there. At work it’s in a lot of places [as I had permission to use it from the start] but I doubt that a large percentage of it gets used. Plus, GJC was created from ideas I didn’t have time to code in previous jobs. My current job does not fit into the same problem domain.
So GJC has not had fame, but it has lived a worthwhile life. A lot of happy code and reuse has gone on in it, and it’s saved me pain and time.

On to Commons Lang. Commons Lang has had the advantage of lots of involvement. Let’s go with 10 major contributors and another 20 who have put their oar in a little. Because agreement is rare, it has a much tighter scope and therefore occupies a smaller functionality space. Due to a lot of happy work, it very densely fills the space. This makes it harder to grasp, surprisingly. Ability to grokk an API appears to deteriorate with the density of the API. JDK 1.0 was probably easier to grokk than JDBC 3.0. I think this is because people are good at understanding lots of folders and poor at grasping lots of files.

Can Lang justify its existence? I’m not convinced. Even for me personally I’m not convinced. I use Lang less than I used to use GJC on projects. Because I don’t have full control over Lang, I’m hesitant to always compile against HEAD and push new ideas in. I also don’t have a 100% grasp of the system anymore, as I would have with my own personal utility library.

On paper, there are less bugs in Lang than there were in GJC. This is definitely true for Commons Collections and GJC, my MultiMap definitely had some odd issues. But the stuff in Lang is not so much about bugs as it is agreement on a way to do some basic task. Do I care personally? I was happy with my ways.

I do like the builder subpackage. That’s a nice idea that I doubt I would ever have added to a personal utility library. I still don’t use it much though, I just respect it.

It’s become clear over the course of this text that I [a commiter to Lang since the beginning] am not convinced that it has justified its existence, so do I even think people should be using it?

Yes. There are a few major reasons:

1) Legality. Using my own libraries at work is dodgy legal-wise. Using Commons-Lang protects me a bit more, and anyone not coding on Lang a lot more.

2) Ideas to steal. Despite the general stupidity of most ideas in Lang, there’s a lot to be grabbed and used. You can c+p the code out, or just make your life easier and reuse the jar. I would be tempted to c+p code out for a bit, then recognise how much I’ve c+p’d and go with the jar. Managing the c+p’d code is not worth the effort.

3) The usual more eyes excuse. However this is not that major as you may only have 3 methods in your util library and it won’t take long to make it a less buggy library.

So…look at your common util library. Look at the size. Wonder if it’d be easier to just hand over a few core pieces to Lang and depend on that than keep managing it. All depends on how much is copied I suspect.

Me? I’m going to be seeing how the next year of Lang goes and see if I adjust to make it a jar I use everywhere. Maybe if I find that all the commons stuff is a pain, I’ll just write some bash/cvs scripting to pull down lots of Jakarta Commons code that I like and merge it into ‘The bits I like about Commons, in one jar’ and ignore the bits I won’t ever use.

Maybe that’s what Commons needs. A build your own distro ability, and you can deal with the dependencies etc. If you want to release your code, then you release a signature for the code, which describes the commons dependency. Someone installing your code matches your signature to theires to see if they have everything you need. If not, they enlarge their distro.

It’s a complicated area, but it needs a better solution than just ignoring the benefits of re-use.

Humility - Don't get cocky

Wednesday, October 1st, 2003

I’m a big fan of regexp’s. I use them a lot as a tool to assist me in coding.
I’ve often taught people how to do basic regexp, search and replace, using perl -pi -e. Everytime I say, “But watch out, it’s easy to fuck up….”

Over the years, I’ve occasionally screwed things up, but generally my regexp usage is pretty solid. Until tonight :)

Lesson #1 of Regexps forgotten:

‘When using any form of punctuation, be positive you know what the escaping rules need to be’

I happily did:

findj src/ | xargs perl -pi -e ’s/@since .*/@since 0.1/’

which results in virtually every line [except ones with package, bit odd that] being replaced by ‘ 0.1′. Of course, I did this on a piece of code that I hadn’t quite gotten around to putting in CVS yet, because I wanted to get it where I wanted the foundation to be before I put it in a public cvs.

2 evenings worth of work byebye. Gotta hunt down a decompiler and some shame.