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

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.

share|improve this answer

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

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

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.
{"cc_re__cc_re__cc_by_sa_3_0": ["                  <li><a href=\"//area51.stackexchange.com\" title=\"proposing new sites in the Stack Exchange network\">Area 51</a></li>\r\n                        <li><a href=\"//careers.stackoverflow.com\">Stack Overflow Careers</a></li>\r\n                    \r\n                </ol>\r\n            </td>\r\n    </tr>\r\n</table>\r\n                </div>\r\n            </div>\r\n\r\n            <div id=\"copyright\">\r\n                site design / logo &#169; 2015 stack exchange inc; user contributions licensed under <a href=\"http://creativecommons.org/licenses/by-sa/3.0/\" rel=\"license\">cc by-sa 3.0</a>                   with <a href=\"http://blog.stackoverflow.com/2009/06/attribution-required/\" rel=\"license\">attribution required</a>\r\n            </div>\r\n            <div id=\"svnrev\">\r\n                rev 2015.1.30.2262\r\n            </div>\r\n            \r\n        </div>\r\n    </div>\r\n    <noscript>\r\n        <div id=\"noscript-warning\">Programmers Stack Exchange works best with JavaScript enabled<img src=\"http://pixel.quantserve.com/pixel/p-c1rF4kxgLUzNc.gif\" alt=\"\" class=\"dno\"></div"], "copyright__copyright__copyright": ["st 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.\n\nshare|improve this answer\n\nYour Answer\n\n\u00a0\ndiscard\n\nBy posting your answer, you agree to the privacy policy and terms of service.\n\nNot the answer you're looking for? Browse other questions tagged or ask your own question."]}