3 ms·
What did you learn first, npm or Maven/Gradle? I started in Java land, and to me, the idea that you would run a command to add a dependency has always seemed a
by twic 4y ago
What did you learn first, npm or Maven/Gradle?
I started in Java land, and to me, the idea that you would run a command to add a dependency has always seemed a bit weird. The file with dependencies in is part of the source code, and i don't want to modify it at arm's length with a command any more than i want to write code that way.
- circuit10 4y agoI probably learned npm or pip first so I guess it depends on what you’re used to But with npm you can still modify the package.json and it feels simpler than than the Maven XML still (though I have no idea what’s going on with the package_lock file, but I don’t think you’re meant to edit that manually)
- ye-olde-sysrq 4y agoalso fwiw, while xml is kind of not very pretty, for most dependencies, you literally google "mydependency maven", click the first link, click the version you want, then literally just copy/paste the XML into your pom.xml. Is it as slick as 1 command? No. But it's certainly not rocket science, and most libraries github readmes even provide you the maven <dependency /> blob, so it's not usually confusing imo. And also, I do want to point out that "just npm -i mything" comes with problems like typosquatting, which is a lot less common in java afaik.
- nawgz 4y agoThis is a dinosaur opinion, wow. Would you also avoid generating client types for type-safe API consumption because you have to run a command to do that instead of writing the client yourself? After all, the client is source code for the client
- Tostino 4y agoI don't see these as comparable at all.
- nawgz 4y agoSay more. My package.json is part of source code. I can manually write it myself and run `npm install` afterwards; or I can do both steps via a command. The end result is identical: my package.json has a new package, and my local machine has a copy of that package somewhere too. Why wouldn't I use the command, exactly?
- ElectricalUnion 4y ago> The end result is identical Citation needed. Installing npm dependencies in different orders is not garanteed to be deterministic due to npm's package flattening and, before npm 8, plain broken dependency resolution strategy. The package-lock.json is essential to get the same mess that the initial developer got on the same order as his install. > and my local machine has a copy of that package somewhere too. On maven/gradle, like on pnpm, you get one copy of each library. Not 3000x copies of lodash spread around your disk.
- nawgz 4y ago> > The end result is identical > Citation needed. What do you mean? You cited it yourself: > Installing npm dependencies in different orders Fortunately, there is no difference in order between running it as a command and adding it and running `yarn install`, since you already had all the other packages locally either way. Anyways, these complaints are ridiculous, I'm sure I could dig into the past and find some broken Maven or Gradle resolutions. Let's see, 10 second time limit: > gradle.lockfile LOL wow. > 3000x copies of lodash spread around your disk LOL
- kaba0 4y agoModifying text files that are human readable are a big no-no. Generating files that you never touch is absolutely ok (and is a huge thing in Java, mind you, starting from annotation processors).
- nawgz 4y ago> Modifying text files that are human readable are a big no-no. Silly absolutes are a big no-no. You don't use automatic code formatting!? Using commands to modify a literal list is fine.