8 ms·
I think NPM has finally shown that you can, in fact, have too much code reuse. The representative example for me is this actual isPositiveInteger module: va
by wvenable 10y ago
I think NPM has finally shown that you can, in fact, have too much code reuse. The representative example for me is this actual isPositiveInteger module:
var passAll = require('101/pass-all')
var isPositive = require('is-positive')
var isInteger = require('is-integer')
module.exports = passAll(isPositive, isInteger)
You don't even want to know what the is-positive and is-integer modules look like.
Software pundits have been saying how modern programming is just wiring together existing components for years; the node ecosystem has taken that to its illogical extreme.
- maxxxxx 10y agoIs this real or are you kidding?
- DannyBee 10y agoReal. However, the same day the left-pad debacle stuff was on HN, this was changed to be self-contained: https://github.com/tjmehta/is-positive-integer/commits/master/index.js https://github.com/tjmehta/is-positive-integer/commits/maste...
- dsp1234 10y agoYour information is out of date. https://github.com/tjmehta/is-positive-integer/blob/master/index.js https://github.com/tjmehta/is-positive-integer/blob/master/i...
- userbinator 10y agoNo discussion on Node.js and "overmodularisation" is complete without a mention of the left-pad debacle: https://news.ycombinator.com/item?id=11348798 https://news.ycombinator.com/item?id=11348798
- prodigal_erik 10y agoNo matter how few dependencies you have, any of them can break you if your build system automatically moves you to an updated version without first testing it.
- dllthomas 10y agoTrue. And also, the more independent dependencies you have, the more that risk is compounded.
- vacri 10y agoIt seems to me that what other people call 'functions', npm calls 'modules'. There are so many 'modules' that are just a short function. Why not just make a 'standard library' with all these basic things in it? One place I work at has a node app product with 500 (!!) modules like this, all of which have their own submodules. There are so many files that a server with a bog-standard 8GB EXT4 / drive cannot handle both the installed module, and a replacement during deployment, due to INODE exhaustion (solution: bigger EXT4 or use xfs).
- wyqydsyq 10y agoThe thing is, nobody is forcing you to use excessively small modules. If you use an excessive amount of small modules, that's an error of the developer, not an inherent flaw in the platform/ecosystem.
- int_19h 10y agoThe problem is that the ecosystem encourages small modules, and so the vast majority of existing modules in the ecosystem are small modules, or else are bigger modules that use many small modules. Basically, the only way to avoid depending on something this silly in your real-world Node project is to not use anything from npm. At which point you pretty much lose all the advantages of Node.
- njharman 10y agoNobody is forcing me to use node. If I use it, is that also an error of the developer?
- ramchip 10y agoMy app does not use small modules... but its dependencies do, and the dependencies' dependencies, so in the end my node_modules folder has hundreds of packages and everything compiles slow like molasses :(
- iends 10y agoCompiles?
- alblue 10y agoThere is a "true" module, which returns true. https://www.npmjs.com/package/true https://www.npmjs.com/package/true From the usage: > Usage > Simply require the true module. The export is a function which returns the Boolean value true: > var t = require('./true') , myTrueValue = t(); console.log(myTrueValue === true); // Logs 'true'
- thameera 10y agoAnd it's not as easy as it seems: https://github.com/mde/true/issues/5 https://github.com/mde/true/issues/5
- steveklabnik 10y agohttps://www.gnu.org/software/coreutils/manual/html_node/true-invocation.html#true-invocation https://www.gnu.org/software/coreutils/manual/html_node/true...
- Ericson2314 10y agoI think the overall trend has been from no abstractions to bad abstractions. As a systems programmer, I like reading about the battle stories of e.g. console game developers from the 90s and earlier who practically wrote an OS, but I hope our current trajectory will eventually lead to good abstractions (in good languages).
- Ericson2314 10y agoI think the overall trend has been from no abstractions to bad abstractions. As a systems programmer, I like reading about the battle stories of e.g. console game developers from the 90s and earlier who practically wrote an OS, but I hope our current trajectory will eventually lead to good abstractions (in good languages).