I am building a Java applet for a client. Yes, we have gone over all the options, and for the client's requirements and environment, this is the Right Choice.

I am a big believer in using Apache Commons whenever possible to simplify my code and avoid reinventing the wheel. One part of the functionality I need for this applet is implemented in the Commons IO library, which is 160kb in size.

Or I could create a custom build of Commons IO with just the classes I want. Less easily maintained, but minimizes the overhead of the applet.

I could also write the needed functions; they would be far smaller than 160kb.

I've probably spent more time pondering the Right Thing To Do than it would take me to write the code by hand.

As an additional consideration, I will be doing a code review with the client, and would like to take any opportunities I have to teach them best practices like using Apache Commons.

Any strong opinions, and justifications, for which option I should choose?

  • 1
    Apache Commons ( and the former Jakarta ) are a cancer of poorly designed and implemented code on the Java world.
    – user7519
    Commented Feb 9, 2012 at 4:06
  • @Jarrod, Could you explain why?
    – ahodder
    Commented Feb 11, 2012 at 18:09

3 Answers 3


What's the performance requirements of your application? Is the footprint/impact of this library a bottleneck that stops you from reaching that performance goal?

If the impact is too great, then use a subset, else I'd use the official library to avoid re-inventing the wheel.


If you already found a library that will do the job, just use it as is. If its footprint is too large, consider another library that could be used in its place to deliver the same functionality and use it as is. Don't write your own library unless you absolutely have to. Using a third-party library has the benefit of being developed and tested by someone other than you, so it's very hard to go wrong with using it in your own applications, especially when it comes from the Apache Software Foundation.


If you only need a small part of the library, I would cut it down to just the part you need, especially if this is for a Java applet. The issue with rewriting the functionality yourself is that you may run into subtle bugs that a more stable library has already solved. But the decision there depends on the complexity of the functionality involved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.