Libraries aren’t just for checking out books. They’re probably the most important part of any programming endeavor. With a good set of libraries, you don’t need to reinvent the wheel on every project. We rounded up five of the best libraries out there for everything from Web development to cloud development.
When building an application that will live in the cloud, you’ve got two choices: Either write to the native APIs of the cloud and lock yourself into that hosting provider forever, or use Libcloud. This project, which came out of the now-acquired CloudKick, is now under the watchful eye of the Apache Foundation. Libcloud offers link-ins to 24 different cloud hosting providers.
Rather than write specific code to handle the process of spinning up an Amazon Web Services image via Amazon’s own API, you can use Libcloud to set generic paths to such services. Instead of writing directly to Amazon’s load-balancing API, Libcloud allows developers to write more generic code for load balancing behavior, and the resulting code will trigger Amazon’s API. Or Rackspace’s API. Or GoGrid’s API. Or… you get the idea.
Formerly known as the Google Collections Library, the Guava-Libraries is a collection of useful code that started out at Kevin Bourrillion’s 20% project at Google. I’ll let him explain the Guava-Libraries in his own words:
The same basic problems that the Java Collections Framework solves, just taken to the next level. Additional abstractions to more closely fit your needs; new data structures that speed up your processing; conveniences that wage war on boilerplate code everywhere. [Jared Levy, co-creator of Guava-Libraries] and I both love to play board games and, when there’s a board game that’s successful, the publisher inevitably comes back and releases an “expansion” for that game. With the expansion, you can still play the original game you already love, but you can do a little more as well: sail over to the neighboring islands, or go build your train lines in Switzerland instead, etc. So we’d love for you to see our library as “the unofficial expansion to the Java Collections Framework.”
Whether you feel we do or don’t measure up to that standard, it’s the mindset we have had since the beginning. We find the gaps in java.util and we fill those in; we pick up where the JDK leaves off. Most importantly, we conform to the principles and design choices in the Java Collections as much as possible, only deviating when there’s a very clear win.”
This LGPL library of charting functions is said to be the best free charting package out there. Not only can you use it to whip up some snazzy charts on both desktop and server-side systems, but you can also use this library to output those charts as images, vector graphics, and even Swing components.
There are issues with JFreeChart, of course. The API can be a bit cumbersome, and the developers have broken backward compatibility a few times, but at the end of the day, if you absolutely must chart and you have no money to spend on fancy graphing and charting packages, JFreeChart is probably up to the task. Considering that charting and graph packages are quite a popular business, it’s rewarding for such a set of functionality to still be available as an open-source project.
If you aren’t already using Apache Commons, you’re missing out on the most complete set of reusable Java components out there. With a list of components that is constantly expanding, the Commons raises all boats to the same level. There are components here for doing both the high level and the low level. You can use the Byte Code Engineering Library to manipulate and analyze class files, or use Digester to map XML to Java objects.
Or, perhaps you just want Commons for its database tools, such as the Java Database Connectivity helper library (DbUtils), or the Database Connection Pooling services (DBCP). There’s a package of smaller and simpler types for use with Primitives, and a tiny math library that also includes some statistics functions for those tight spaces where math must be done. There’s even a library for creating virtual file systems from desperate sources, like FTP and SMB servers. The Apache Commons project is essentially the Swiss Army knife of Java development.