Commons-lang is stupid
Wednesday, September 3rd, 2003A rising star in the evil commons-* cabal is commons-lang. More and more lemmings are jumping off the proverbial bridge of common (ha!) sense and tacking on this evil little baby onto their misbegotten projects.
So what’s so bad about it? Just have a look at the javadocs to examine the functionality provided (and I use that word in the very loosest sense) to see why it’s so ridiculous that there’s an entire project dedicated to providing these things.
First there’s a whole bunch of *Util classes which serve pretty much no purpose other than to provide null wrapping. So you incur the overhead of a method call instead of a simple null check. Not to mention a dependency that God himself can’t undo if you carry it to its extreme (never have any null checks in your own code)
Then we have the equally dimwitted builder classes. The winner of the ’stupidest idea’ award here by far has to go to the reflection builders. Now, it’d be somewhat forgivable if they had the decency to explain how this is a great way to slaughter the performance of your application, but no, the sample code makes no mention whatsoever of the fact that anyone who has more braincells than a gnat should know to cache the returned values.
The number package also blesses us with such gems of wisdom as number comparators. I guess simple operators are just too old fashioned and fly in the face of hardcore OO believers, so one must wrap such calls into a third party dependency if at all possible.
In fact the ONLY vaguely useful class is FastDateFormat, and even then chances are that most applications won’t need it. Credit where credit is due though, it’s nice to see a class in that cesspit that at least nods in the general direction of decent performance.
I’m sure the authors of this superb library realise that it does very little. It’s mostly a collection of convenience function that could well be written inline, and that most developers will likely not use anyway. Mockery and scorn however should be heaped upon the users of said package, they’re the fat lazy people who not only demand to be spoonfed their tripe, but also whimper and whine pitifully when their benefactors try to get them to at least lift the spoon up to their gaping expectant maws.
Realistically, you could write the code for any of these methods faster than you could figure out whether commons-lang provides a function for what you need, and exactly where it exists and what it’s called!