It started as a morning debate among the team while waiting for the coffee machine to power on: Could anyone name the most popular library used by Java Developers? We had a few guesses (side note: why does our coffee machine need so much time to get itself ready in the morning?), but to our shock and horror, none of us got it right. So before going any further, make your guess now!
Ready? Then let’s have a look at the top 10 libraries (as defined by downloads from the Maven Central repo):
Clojure is a programming language that combines the flexibility and ease of a scripting language with the robustness of Java. Among the many advantages, Clojure makes writing code less verbose than Java alone.
9. Apache Log4j
Log4j is a common logging framework. It provides an excellent framework for producing coherent logging for your application.
8. Logback Classic Module
Logback is a newer logging framework than log4j and their website states they are offering enhancements over log4j.
7. Apache Commons IO
Commons IO by Apache is a set of utilities to help with IO from your application. Particularly when working with Files, there are a number of features in Commons IO that make your life as a developer much easier.
6. Mockito Core
Mockito is a mocking framework. Used during unit testing, this will allow you to not spin up an entire environment for your testing.
5. Android AppCompat Library V7
The AppCompat Library contains support for the Action Bar within the UI of Android applications.
4. Guava: Google Core Libraries For Java
Guava, like Apache’s Commons, is a set of utilities for making your life as a developer easier. Guava covers all the tools that Google’s Java developers rely on in a single library.
3. Scala Library
Scala is a programming language that combines object oriented and functional programming into a single language. Scala is popular in the big data circles, and given the rise of big data over the last five years, I am not surprised to see Scala on this list.
2. SLF4J API Module
Simple Logging Facade for Java is an abstraction of popular logging frameworks including the two earlier in this list. This allows you to choose your logging framework at deployment time rather than during your development.
And of course, JUnit is at number one—why didn’t I think of that? I am sure many of us add JUnit to our projects without thinking. Who’s going to write code without producing tests? (If this describes you, there are tools out there that can write your tests for you).
There are a few other surprises for me in this list. First, looking at the overall makeup, seven out of the top ten are general libraries which don’t add much new functionality—essentially, these libraries extend or improve on components of the JDK. I will admit it: I was thinking that the likes of Spring would be close to the top of the list.
Initially thinking about the popularity of mobile devices, I was wondering why aren’t there more Android related libraries in the list. But here, we are suffering from lies, damn lies and statistics. Google hosts their own maven repo with android dependencies, so I assume most android developers get their libraries directly from Google.
Out of the household names in this list, Apache appears the most. If I had been asked, I would have thought of Google before Apache for popular open source authors. Interestingly, however, I expected Apache Commons to appear above Guava. I suspect that Apache Commons suffers here from being split into multiple libraries. If we take all Apache Commons libraries the total uses exceed that of Guava.
So there you have it! How accurate were your guesses? Share your guesses with us @DiffblueHQ.