Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
    
I think you meant to say 160kb instead of 106kb in paragraph 4? –  David Conrad Feb 8 '12 at 22:55
    
thanks for the catch –  Stevi Deter Feb 8 '12 at 23:42
1  
Apache Commons ( and the former Jakarta ) are a cancer of poorly designed and implemented code on the Java world. –  Jarrod Roberson Feb 9 '12 at 4:06
    
@Jarrod, Could you explain why? –  AedonEtLIRA Feb 11 '12 at 18:09
add comment

3 Answers

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.

share|improve this answer
add comment

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.

share|improve this answer
    
You mean "its footprint". Cheers. –  David Conrad Feb 8 '12 at 22:58
    
@David Conrad: Yes, thank you. :) –  Bernard Feb 9 '12 at 2:12
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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