News for hackers. Stuff that matters.
Re:Webpack 4 course: What is Webpack? by nailer on Monday July 16, 2018 @09:26AM (#17541074)
Using packages means less code, not more, since you're not rewriting the wheel every time.
Re:Webpack 4 course: What is Webpack? by weiming on Monday July 16, 2018 @10:27AM (#17541472)
Technically not if packages are just the misguided habit of "one package per function" seen in the Node ecosystem. Same amount of code, increased amount of complexity/meta-problems to deal with.
Re:Webpack 4 course: What is Webpack? by nailer on Monday July 16, 2018 @11:18AM (#17541953)
> Technically not if packages are just the misguided habit of "one package per function" seen in the Node ecosystem.

No. Using a package for a single function doesn't preclude code reuse.

Look at underscore.get package. You could write your own recursive key finder (which I have before), and so could every package author, and you'd have 10x the amount of implementations of a recursive key finder.

A single require of underscore.get by you and other authors means you have a single, well tested implementation with a million other users rather than 10 low quality ones.

Re:Webpack 4 course: What is Webpack? by weiming on Monday July 16, 2018 @11:23AM (#17542002)
Why not one package per line of code? One package per expression? Surely, someone will want to reuse var x = a + b.

   const {get} = require("underscore.get");

   get(obj, 'a[0].b', defaultValue);
If your language requires this [1] just to be able to subscript things without going bonkers, it may be time for a new language.

[1] https://github.com/NarHakobyan/underscore.get

Re:Webpack 4 course: What is Webpack? by nailer on Monday July 16, 2018 @11:45AM (#17542208)
> Why not one package per line of code?

Exactly. If it's a difficult line of code, with edge cases, requiring unit tests, etc. then sure. Algorithms are a great example of this.

Using your own example: how many badly written copies of https://github.com/NarHakobyan/underscore.get/blob/master/un... do you want?