Depending on Dependencies

Posted on May 13, 2022

Hey everyone! OK, so this thing occured to me a couple of days ago. So, I wanted to try out someone’s code. I did the usual thing we all know how to do, right? git clone, read the README, figure out that there are some dependencies I need to install, and oh no…

The dependency in this particular case was Apple’s FoundationDB. I wanna be super respectful here before I get into this topic. I’m not shaming anyone for using that library. Everyone is entitled to use the dependencies they see fit for their code. I would never use something like that, but I’d probably never write something like the project I was checking out. On the other hand, the library is licensed under the Apache 2.0 License, so whether you like or hate Apple, we’re speaking one of their FOSS libraries here.

The building process for that library is… discouraging. For someone like me, who just wanted to test something out, dealing with CMake (which I don’t have installed…), on a library whose code tree is almost 40 MiB big,1 then checking whether the library is installed on a path that my linker will actually find… it’s too much. So I quickly desisted from trying out the project. I know, maybe it’s laziness from my part, but this was just a casual thing… a casual thing deterred by one critical dependency. If the library had been packaged in Arch’s repos everything would’ve been much easier, but this isn’t the case.

There’s a Docker image available, but trust me: I’m never infecting my system with that plague ðŸĪŠ

Again, the developers of the project have all the right to use FoundationDB. If you’re using that library or are actively using something that depends on it, you’re going to go through the hassles that building and installing the library might entail on your OS.2

So I wonder sometimes how many times this happens to people, apart from myself. How many times does the dependency hell discourage people from having a look at projects that in and of themselves are very simple… but depend on very complex infrastructure you didn’t plan dealing with?

Dependencies do determine the potential contributors you might find during your project’s lifetime, don’t they?

Of course nothing is created ex nihilo, therefore everything has dependencies of some sort. For instance, most of my projects depend only on the C Standard Library and that your OS is a POSIX(-like) system that supports some specific system calls. Yeah, that means that on BSD, Linux, and I presume macOS, my code can be compiled and run trivially. Even in my case, we’re assuming your system has the system calls available and that there’s a C Standard Library sitting around… and if you’re compiling from source, you need a C99-compatible compiler, the appropriate headers… The fact that in our little Linux-y world these things are a given doesn’t make it universal.

Good luck compiling any of my projects on an Amiga 500… or on Plan 9… or on your custom OS.

It’s all trade-offs, isn’t it? That’s why I like the idea that you code targeting some platform or platforms in mind, and that also includes other people’s code you’re planning to use. Availability isn’t the key factor. And you’re by no means responsible of what the developers of the dependencies do… It’s their code, not yours. You should take responsibility of your choice, though; as long as you’re doing so, I’m happy.

But just let’s be aware that your choices will leave some people out… and draw other people in. And if you’re in the position I was with that project… not being able to try out some code because of the impracticalities of satisfying the dependencies… hey, remember it’s their choice, you’re not entitled to anything on anyone else’s projects. Suggesting changing the problematic dependency is good on my book, as long as you’ve got a sane alternative that improves the project.

The same goes for programming languages, too, which are another type of dependency, you might say. I hate it when people on places like Reddit or HN reply to a new project telling the developers that X, Y, Z language is “better.” OK, it might be, but rewriting a project into a new language is quite a task and the devs might’ve had reasons to choose that one over others… even if it’s just because it’s the language they happen to know better… Suggest major changes if there’s real, measurable advantanges and you’re actually going to help the devs through the rewrite.

Maybe it’s my background in Humanities, but coding is always a social endeavor, in my opinion… precisely because you depend on your predecessors’ work. Not unlike science, right? So every choice do regarding which technology you target your code for is sort of an act of associating yourself with some people’s work. And that sets you on a particular path for that project, thus also determining what’s ahead, who’s gonna be able to join in, and that sort of things.

I guess the gist of this is that your code is never just your code. It’s your code and all other code that is going to talk to yours and viceversa. Never lose sight of that!

Love you all! 😗

  1. The git repo is almost 140 MiB big, though. The ~40 MiB size is excluding the .git/ subdirectory. ↩︎

  2. I guess MacOS provides it out of the box? ↩︎