6 ms·
> I don’t get why anyone would introduce a dependency this small to their codebase. This might be controversial, but I think it has to do with less experienced
by thatwasunusual 4y ago
> I don’t get why anyone would introduce a dependency this small to their codebase.
This might be controversial, but I think it has to do with less experienced developers, beginners, who doesn't know how to find out via "pure code" if a number is even or not, or even if something is a number (IIRC, there is an isNumber package out there as well).
I see this in other languages as well, but not in a "JavaScript scale", but that could probably just mean that the language's availability and popularity decides the number of "stupid packages."
- xboxnolifes 4y agoI feel it's more likely related to how often "don't reinvent the wheel" and "NIH syndrome" is thrown around. It's no surprise to me that people will first check to see if a library already exists before going to write their own, probably lacking function.
- BigJono 4y agoLet's call a spade a spade. It's a bunch of noobs that have become the majority and created a culture of dependency-first development. I haven't worked with anyone for years that doesn't start troubleshooting an issue by reaching for a random dependency. They just don't even bother learning Javascript or the Web APIs or CSS anymore. Without a solid base of fundamentals every trivial problem seems insurmountable so they just don't even try.
- ratww 4y agoIf we're going to call a spade a spade, then let's go ahead and say that the majority of the packages that are always referenced in those discussions (is-even, is-odd, etc) is maintained and primarily used by a minority of developers that are very well known in the ecosystem. This minority makes money out of their popularity in the NPM ecosystem. Having 1000 NPM packages is better for your reputation than having 100. And having all 1000 packages with lots of weekly downloads is better than having just a portion of that. But how do they achieve that? Well, they have 1000 NPM packages, so each one depends on 5 to 10, that then depends on a few handful more. You have packages for checking if an HTTP status is a certain number, you have packages that have colors as constants, you have is-even, is-odd and so on. All that exists to maintain that closed ecosystem. So out of the 1000 they basically have 20 useful tools and 980 garbage packages that exist only to maintain their own ecosystem. Most people isn't using is-even or is-odd directly. They imported some other packages that are quite useful, but often need 10-20 sub-dependencies. Another interesting thing is that those shitty packages aren't really that important in applications. They're often used in build tools, CI and testing, tools for making CLI tools, and the sort. The crazy thing is that a lot of people using is-even/is-odd aren't really "noobs": they're probably experienced developers that said "fuck it, I'll use some random tool from the web" when facing some random a problem.
- Tainnor 4y agoThat's a more charitable (and more reassuring) interpretation than "developers don't know the modulo operator". That said, it still leaves a sour taste as this effectively implies that a certain set of JS developers is very happy to abuse their (maybe initially rightfully earned) prestige to gain even more prestige while leaving behind a mess for the whole ecosystem. I don't understand why this is tolerated. The Node community needs to have a serious discussion about why certain packages are allowed to spread garbage, create forks of the relevant packages that rip out "is-even" etc. and then eventually converge to these forks. But to this day, I don't see the community taking this problem seriously enough. Now, supply chain attacks and "too many dependencies" are a potential issue for every language with dependency management (see also log4j, etc.), but no other ecosystem seems to be have such a high frequency of issues and (widely used) "is-even" packages are simply not a thing in any other mainstream language (some languages, like Swift, include similar functionality in the standard library, which is totally fair).
- ratww 4y agoThe reason it is tolerated is because the philosophy of "thousands of small packages" has spread far and wide. For every person calling it out like we're doing here, there are ten others praising maintainers able to whip ten semi-useless packages per week. It's not just random maintainers making small packages. The core infrastructure of Javascript is in it. Babel is made of hundreds of packages, which all live on the same repository (because of course the maintainers don't want the hassle of maintaining multiple things). Some of those packages don't even have anything of importance in it, just metadata, a couple flags and some boilerplate [1]. The package is just a way of organizing code. Webpack, ESLint and others aren't exactly better. EDIT: And of course I got downvoted :) [1] https://github.com/babel/babel/blob/main/packages/babel-plugin-syntax-decimal/src/index.ts https://github.com/babel/babel/blob/main/packages/babel-plug...
- cxr 4y agoYou're tacitly giving the people you despise leverage when you say things like: > The core infrastructure of Javascript is in it. Babel[...] Babel is not core JS infrastructure. It may be close to fundamental to the modern NodeJS development experience, but JS exists happily (and capably) without any of that stuff (including package.json, for that matter).
- ZetaZero 4y agoIf a developer doesn't know how to write their own "iseven", I don't want their product. Maybe you could argue other for other reasons to use these packages.
- haswell 4y agoI suspect a lot of this use doesn’t go into products, it goes into projects.
- zzyzxd 4y agoComparing to: 1. search for a package that does X 2. scan the search result and find the package that really does X 3. learn to use the package's API 4. import the package in the code 5. use it Isn't it much easier to just copy-paste code from stackoverflow? There's also a good chance that the you can get some very good explanation and interesting discussion around the implementation there.
- ratww 4y agoWell, yes. There's also Github Copilot, which pretty much replaced almost my entire usage of Stack Overflow. But the thing is that with a rando package is that one doesn't have to review the code. Sure, the code is also coming from somewhere else. Sure, it might never get updated. Sure it might be full of bugs. Sure, it might be more dangerous than copying from StackOverflow. But out of sight, out of mind. In the end the overuse of packages isn't about saving time or "doing the best for business" or "ensuring that the code is maintained by someone else". It's purely about covering our asses.