News for hackers. Stuff that matters.
Re:I've Just Liberated My Modules by sorenjan on Tuesday March 22, 2016 @11:16PM (#11341878)
I've never used npm, but doesn't it take at least as long to find, evaluate, and install a package like left-pad as it would to just write the function yourself when you find you need it?
Re:I've Just Liberated My Modules by callumlocke on Wednesday March 23, 2016 @04:52AM (#11342943)
No. I could find, evaluate and install that package quicker than I could write the code that carefully. And the second time I need it, it's just "remember, install". Also, keeps my code small and focused.
Re:I've Just Liberated My Modules by exDM69 on Wednesday March 23, 2016 @06:28AM (#11343255)
Do you not read the code of packages you're including in your projects? I usually do at least browse through the "beef" of the code for anything I consider adding as a dependency. And try to figure out what's the level of maintenance I can expect, history of bugs, sometimes try to contact the authors, etc.

In short: it would take me a whole lot more time to evaluate whether or not to depend on something as trivial as leftpad than to write it myself. I'm pretty confident I can do that in a minute or two and I trust my collaborators to not break it.

Re:I've Just Liberated My Modules by karmelapple on Wednesday March 23, 2016 @12:59AM (#11342252)
Personally, no, but even if it did, what if a bug is found in the future? The community fixes the bug, not necessarily you!
Re:I've Just Liberated My Modules by esailija on Wednesday March 23, 2016 @02:09AM (#11342463)
The possibility of having bugs in code you don't control (that usually has a clause for no warranties) is an argument for implementing it yourself, not against it. Don't forget how hard it is to get a maintainer even agree on whether something is 1. a bug 2. that needs to be fixed.
Re:I've Just Liberated My Modules by beejiu on Wednesday March 23, 2016 @04:57AM (#11342961)
The reality, however, is that if you took this point of view, you will spend your time reinventing the wheel, introducing bugs and wasting resources. That's how it works in real life.
Re:I've Just Liberated My Modules by karmelapple on Wednesday March 23, 2016 @02:45AM (#11342576)
If someone already wrote the base code, we can always fork it and fix a bug or add a feature ourselves if it runs contrary to what the original authors desires.
Re:I've Just Liberated My Modules by esailija on Wednesday March 23, 2016 @03:15AM (#11342657)
Even getting a response just so you can know what the original author desires can take a long time and there is no warranties or guarantees that you will even get any response. To me, all the downsides that come with dependencies are not even close to worth it for saving 15 seconds.
Re:I've Just Liberated My Modules by karmelapple on Sunday April 03, 2016 @04:53AM (#11415447)
Who cares what the original author desires?

If you fixed the bad behavior you're experiencing, and the original author's effort saved you hours or days of coding, what's the downside?

Perhaps I'm not arguing for 15 second long code changes. But other than typing a single if statement, what takes literally less than one minute to securely change in any partially-complex project?

Re:I've Just Liberated My Modules by bowmessage on Wednesday March 23, 2016 @02:42AM (#11342566)
Fair point. One does run the risk of having bugs in code out of their control by using a package manager such as NPM, but one gains a swath of other programmers inspecting the modules for bugs. And in module repositories for interpreted languages, its very much in your control to fix any bugs you might find, regardless of what the maintainer might say about it.
Re:I've Just Liberated My Modules by brazzledazzle on Wednesday March 23, 2016 @03:08AM (#11342649)
Would simply copying something into your project as small as 17 lines make for a good compromise?
Re:I've Just Liberated My Modules by slang800 on Wednesday March 23, 2016 @06:17AM (#11343198)
No - then you won't get updates easily and everyone reading your project would have to make sure that your copy of the module hasn't diverged from the original module before working with it, especially if it's a larger module that has full documentation and a community of people who know how to work on it.
Re:I've Just Liberated My Modules by Klathmon on Wednesday March 23, 2016 @09:01AM (#11343991)
I've never seen so many programmers advocate copy/pasting code before... it's really surprising!

Something about javascript makes people crazy...

Re:I've Just Liberated My Modules by brazzledazzle on Wednesday March 23, 2016 @02:15PM (#11346872)
That's what I thought, but what concerns me with 100's or even 1000's of dependencies is managing them. Things like figuring out which ones have security issues without reading the issue tracker for each.