Commons-Lang: Justify your existence

October 2nd, 2003 by Hen

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.

3 Responses to “Commons-Lang: Justify your existence”

  1. Tom,Dick,Harry Says:

    I’m almost deafened by the silence…

  2. Mark Mascolino Says:

    That silence is the agreement of the masses. Also for those of us that never got around to writing some formal personal util library, it has been a godsend.

  3. Eric Says:

    The reason I like commons-lang over my own personal library isn’t so much for use in my own work, but in the zillions of projects I contribute.. They don’t want my own personal library cluttering up their dependencies, they want a util library that is open sourced, has support, and momentum. If it is just for work, then maybe your own stuff is fine, but for open source projects, you either have to add it to their tree, or spend the time getting all your code hosted on SF or someplace.