I’m a nobody, nobody is perfect, therefore I’m perfect.

Dependency overload … or laziness?

This is something that started bugging me back in the maven area — when I switched from the likes of Ant as a build tool, which was relying on the user being explicit about a lot of things and doing a lot of the grunt work for it, to the maven world. Now maven was great some said because of the dependency management that it offered.

That did help, I must agree. When you pulled a library it saved the developers the time to find the dependencies, include them in build and so on. It put the onus on the library developer to provide the right set of dependencies needed for the library to work correctly.

And that’s where it started hitting us I think!

The issue that I have with that is that we empowered developers to provide decent dependencies but with that power comes great responsibility — and I see often this responsibilities not met. Because after all pulling an extra dependency comes with no cost for us, the tools we use, be them maven, gradle, ivy etc do this heavy lifting for us. So really, for any library we decide to pull into our project directly, the developer can do whatever the heck he wants and in most cases we won’t notice. This is also accentuated by the fact that RAM is pretty cheap for your average server nowadays so realistically until our dependencies starts growing to about 1Gb I bet you your average dev doesn’t care about what they pull in their project. And I think this is what allows a lot of projects to grow fat around the belly so to speak.

Because if I find a library that offers one class or method I need, I can just use it and save myself a few hours of coding right? I know that my library users won’t mind an extra 1Mb of jar files. And in most cases they won’t know any different!

The only time they start noticing is when one library of different versions starts getting pulled in and the classloader barfs. And that’s when they start looking at their dependency graphs — and pull their hair out 🙂

This has happened to me a few times in a few projects — and that’s when I discovered how lazy we have become since automatic dependency management became a thing.

Let me give you some examples — and I’m not singling out here a library in particular, sadly there are numerous examples of this kind.

For example, if you pull Netflix Governator library you get this dependency tree with it:

There are some interesting ones here: yammer metrics? addthis metrics? And look at this one: supercsv! Why oh why would one need CSV support in Cassandra? Not to mention there is a bunch of stuff in there I have no idea what it’s for : jline, jamm? I can bet good money that you can explicitly exclude some of them and everything will still work fine.

And one last example: if you pull kafka client in your app, do you know you get automatically Scala support? You don’t believe me, have a look: