News for hackers. Stuff that matters.
Re:The Deno Company by tomxor on Monday March 29, 2021 @09:51AM (#26621510)
This probably either sounds nuts or over opinionated but I don't think the NPM ecosystem is as valuable as people think it is... stuff is deprecated continuously anyway - when you find a way to move away from 10k dependencies (because your shortsighted previous self decided to depend on a single package without looking closer), it's a damn relief. I hate how needlessly complicated the NPM ecosystem is, I would actually like it if no one built bridges to Deno, it could be a clean start with lessons learned.

Most of the packages on NPM are complete garbage - most not all - (and I say this as a full time JS dev who actually likes JS), liking the technology does not have to mean liking what people do with it, and JS is the worst, both in terms of the crap on NPM and the web.

Re:The Deno Company by sublimefire on Monday March 29, 2021 @10:35AM (#26622261)
Your thoughts and experience resonate with me.

Although I would look for similar examples elsewhere to understand where it is all headed. And one of those could be the rise and adoption of the JVM. There are a bunch of old dependencies, multiple repositories (compared to just one popular npmjs), a couple of build tools (ant, maven, gradle) compared to npm, yarn, then multiple languages (invented for somewhat similar reasons as Typescript). One thing is sure that the dependencies stay somewhere for-almost-ever, and all else kind of evolves around it.

It seems that the main problem at the moment is the developer (me, you, everyone) who instead of writing 20 lines of code uses a dependency that has 10 other transient ones. You cannot fix it but rather challenge those situations at work and reduce the tech debt for good. Maybe there should be a build tool that throws errors depending on the amount of dependencies. Maybe there should be a frontend framework which will only need 10 dependencies for the helloworld instead of 1500; otherwise we kind of think that if a boilerplate template has 1500 deps then surely adding another 100 will not make much harm.

Re:The Deno Company by TimTheTinker on Monday March 29, 2021 @10:05AM (#26621723)
> I don't think the NPM ecosystem is as valuable as people think it is

Its value is less about the existing dependency tree of libraries and more about how many apps directly depend on libraries that are npm-hosted.

There are many 200+ kloc apps out there making millions/yr each that deeply depend on libraries and frameworks hosted in npm.

Re:The Deno Company by cloverich on Monday March 29, 2021 @11:52AM (#26623670)
I mostly agree with this, after using Node the last several years. IMHO the primary valuable components are making it free to implement the commenest kinds of concurrency correctly. I.e. most programmers don't even know they are doing it, other than "Oh I have to use `await` here". Even in something as simple as Go, you still have to intentionally set it up. And in Java, I run into very slow very low volume apps all the time because programmers don't realize they added a blocking call somewhere.
Re:The Deno Company by kybernetikos on Tuesday March 30, 2021 @04:48AM (#26632393)
> I don't think the NPM ecosystem is as valuable as people think it is

I generally think the NPM ecosystem is pretty cool, but I have noticed that even simple stuff like creating a RESTful service doesn't seem to have stablised in the ways I would have expected given node's target audience, and you end up writing a lot of the boilerplate yourself. Hopefully this will result in hundreds of replies telling me how I should be doing it, but even the fact that it's not trivial to find that out is a sign of a fragmented ecosystem.

Re:The Deno Company by notJim on Monday March 29, 2021 @01:07PM (#26624916)
> Most of the packages on NPM are complete garbage

And don't do anything. I'm amazed by how often I read the source for a package I'm interested in, only to find it's about 10 or 20 lines of code.

The convenience of adding a package means that if you're not sure how to do something, you can easily just add a package to do it rather than figuring out how to do it yourself. A lot of the time, you can just read the source and adapt it rather than installing the package.

Re:The Deno Company by ggregoire on Monday March 29, 2021 @02:46PM (#26626426)
So if you need that package in your 10 projects, do you copy those 20 lines of code in your 10 projects? Yikes. Then what happens when it requires a change? Do you make the change in all your projects? Double yikes. When it becomes 30 lines, do you still copy/paste those 30 lines in all your projects? Do you also copy/paste the tests related to those 30 lines in all your projects? ...

Having reusable code wrapped into packages is basic software engineering.

Re:The Deno Company by nightski on Monday March 29, 2021 @10:21PM (#26630672)
Or you create a library which contains a collection of 10-20 line of code modules and share it among your projects.
Re:The Deno Company by ggregoire on Monday March 29, 2021 @11:27PM (#26630995)
Yes I agree it's better to have one library with 20 helper functions than 20 libraries with 1 function each. Think Lodash.

Although some people will then complain about the size of the library...

Re:The Deno Company by speedgoose on Tuesday March 30, 2021 @12:37AM (#26631302)
Yes. Every Lodash function is available in its own npm package too. I use it like this, I rather have 4 lodash packages than the big whole lodash library in one package with almost everything left unused.
Re:The Deno Company by Master_Odin on Tuesday March 30, 2021 @09:31AM (#26634394)
These will go away in v5 (if a v5 is ever released) and is not recommended if using a bundler as it'll end up wasting space rather than saving as it'll include duplicate code that each individual function could share.

https://lodash.com/per-method-packages

Re:The Deno Company by speedgoose on Wednesday March 31, 2021 @01:43AM (#26643900)
Thanks for the information. I think it will be about time to completely remove lodash from my code bases.
Re:The Deno Company by runawaybottle on Tuesday March 30, 2021 @02:38AM (#26631753)
JS libraries only did that to reduce bundle size being sent to the browser. It’s done out of necessity, not because it makes any sense.

Exporting out one method at a time is pretty absurd.

Re:The Deno Company by speedgoose on Tuesday March 30, 2021 @02:58AM (#26631851)
Lodash has a lot of features that are not needed anymore or even dangerous sometimes. If you don't need them, why would you install them?
Re:The Deno Company by runawaybottle on Tuesday March 30, 2021 @03:18AM (#26631968)
Because it’s simply not a big deal on the server.
Re:The Deno Company by tomxor on Monday March 29, 2021 @07:24PM (#26629582)
I'm not afraid to say I agree with you, i'm not sure why you are being down voted... This is one of the attributes that is part of my argument against NPM, packages which are at the extreme end of too small, delivering almost no value at the cost of a lot of risk.

This is also an opinionated subject, and as with most things in life there is a balance somewhere in between the two extremes. However the NPM packages you refer to (and yes I have seen the <10 line offenders you refer to) are clearly at a stupid end of extremely useless shared code that amount to the most trivial stackoverflow JS examples.

In response to the sibling comment on duplication: all I can say is that it cuts both ways, deduplication to the extreme also has downsides: when someone changes that code you don't control, it now affects a large number of dependencies that the author may not care about. But even ignoring those issues and assuming you package-lock everything and never look back, extreme de-duplication in general can result in highly illegible code due to a lack of holistic view: whether it's achieved with thousands of tiny external packages or thousands of tiny 3 line functions in the same file - many have covered this topic in detail before, deduplication for deduplication sake never ends well, abstractions always have a cost.