Hacker News new | ask | show | jobs
by mort96 3 days ago
Sure, it doesn't scale to your typical node.js project with thousands of dependencies. That's a good thing.
3 comments

ffmpeg has 100+ transitive dependencies. I don't see what language or language package managers have to do with the number of transitive dependencies.
ffmpeg has that many dependencies because each of them implements a codec or hardware integration or other feature that ffmpeg users want, not because someone has decided to make left_pad into a separate library.
"it's not a bug, it's a feature"
Well yeah. When things become easier, people do it more, whether it's good or bad. Therefore, good things should be easy and bad things should be hard.

Having thousands of transitive dependencies in a super deep dependency graph is bad.

I really like Rust, but I think there's a convincing argument to be made that if you had to manually run 'cargo add' for every dependency, not just the direct ones, its ecosystem would be in a better state. Those transitive dependencies are part of your project. You should be aware of them and have a relationship with them and vet them.

There’s lots of things we “should” do but don’t. I can agree with you that having lots and lots of transitive dependencies isn’t a good thing, but the thing is, it does remove a lot of day-to-day headaches for people and allows them to work at speeds they couldn’t before. That’s a good thing for them that they value at the expense of most other things.

People want results first, optimisation later. This gives them that.

There’s also a good argument to be made that you shouldn’t always give people what they want, but it’s easy to see why Cargo is so popular.

I agree with your premise and disagree with your conclusion.

There's a lot we "should" do but don't. That's exactly why I think incentives are so important. When I want to add a Cargo dependency, I should look through every dependency that was added after running 'cargo add' and vet it. But I don't, because it's so easy to not do that.

If I had to run 'cargo add' for each transitive dependency manually, there would be two positive effects:

1. I would be forced to at least be aware of which transitive dependencies I'm adding, I can't just ignore them anymore. This is at least a part of the vetting I should be doing today but don't.

2. It would incentivise libraries to use fewer dependencies, because each one would add extra work for the user. The C++ ecosystem has a ton of those "dependency-free header-only" libraries because both being header-only and being dependency-free makes adoption easier in C++. A similar (though lesser) phenomenon would affect Rust if Cargo made you manually add each transitive dependency.

Pious suffering is not a virtue.

We're trying to get thing done, here.

Where did I advocate for suffering and not getting things done
Exactly. Reading that entire exchange I just kept thinking things like "but why would you want that" and "but doesn't that lead to insecure software".

When I use languages that aren't C or C++ I actually audit my dependencies and I don't adopt libraries that would transitively add half a dozen to my project. The result is that I generally can't find acceptable candidates and I end up rolling my own. So I very strongly prefer to remain in the C++ ecosystem where I can check a header only solution into my source tree and just get on with life. (Related, eigen is a work of art.)

But if you really feel you need package management and you can't stomach cmake then consider an agnostic nix-alike or the one that your OS relies on rather than something language specific. Package management should be left to dedicated package managers. I shouldn't need half a dozen different managers pulling from their own centralized repositories.

Oh yea, it's the way every other popular language does it that is unsafe. Not C++.

Custom and out of date code we manually audit is better than packages that can be automatically scanned for known issues.

I realize you're being sarcastic but I unironically agree. Code shouldn't constantly churn.

You can still scan for known issues. Rather than checking version strings in the case of full repos you can check branch names or commit hashes. In the case of individual files you can look at checksums. You can even scan your source tree for known snippets.

Why not have a manager for that sort of thing then?
You mean an automated vulnerability scanner that can sift through bare repos and raw source code to flag known issues? Isn't that exactly what I was describing? Does that not already exist?
I mean yeah probably, I would say custom code that isn't doing critical things like cryptography is more secure. It's a much smaller supply-chain risk, you understand it better, and you can patch it immediately. It's never be easier with LLMs. There's just very little value to a lot of dependencies now.

People also don't consider that most dependencies suck ass. Not on purpose, but because they're trying to be generic libraries. They have edge-cases and legacy baggage out the wazoo, bugs that will never be fixed for political reasons, and shit tons of code. If you just write it yourself, it's likely you can develop something higher-quality and better suited to your needs with 100x less code. No exaggeration on 100x.

Classic sour grapes.
I find working with node.js projects with thousands of dependencies to be very uncomfortable, when I'm doing web stuff I go out of my way to try to avoid that for the most part but it feels like I'm fighting the ecosystem the whole way.

If that's sour grapes then so be it.