Live data from Hacker News

NPM and Left-Pad: Have We Forgotten How to Program?

haneycodes.net

91–100 of 887 posts

Re: NPM and Left-Pad: Have We Forgotten How to Program?

#92

What would happen to all those NPM projects if GitHub is destroyed? I don't think it will close anytime soon, but lets say, a meteor shower hits GitHub data center or something along the lines of this.

Well npm doesn't use GitHub for hosting of modules so honestly npm would be fine. Bower on the other hand would be completely screwed.

Re: NPM and Left-Pad: Have We Forgotten How to Program?

#93
post #6

I don't see anything wrong with using a pre-made left pad function. Why waste time and lines of code implementing something so trivial when there is already a solution available? However, I agree it is ridiculous to have a dedicated module for that one function. For most nontrivial projects I just include lodash, which contains tons and tons of handy utility functions that save time and provide efficient, fast implem…

I think the article's thesis is essentially that every dependency your project pulls in -- which includes all the dependencies your dependencies pull in -- is a point of potential failure. I understand the "don't re-invent the wheel" defense, but the Node/JavaScript ecosystem tacitly encourages its users to build vehicles by chaining together dozens of pre-made wheels, all of which depend on more wheels, and each and…

The problem is not that, the problem is depending on unreleased versions, instead of simply depending on the version that was written when u wrote your code.

a Git submodule like approach would be much better

Re: NPM and Left-Pad: Have We Forgotten How to Program?

#94

What would happen to all those NPM projects if GitHub is destroyed? I don't think it will close anytime soon, but lets say, a meteor shower hits GitHub data center or something along the lines of this.

It is the nature of git that most repos on GitHub also exist in many other places.

Re: NPM and Left-Pad: Have We Forgotten How to Program?

#95
post #7

Holy moly-- is-positive-integer/index.js: var passAll = require('101/pass-all') var isPositive = require('is-positive') var isInteger = require('is-integer') module.exports = passAll(isPositive, isInteger) I retract my previous statements that Javascript programmers are going down the same enterprise-y mess that Java programmers went down a decade ago. They've already taken it to an entirely different level of insani…

it's a module with exactly one dependent module -- by the same author. Daily WTF material but who cares beyond that?

Formerly 9 dependent modules... but who cares maybe it was a homework assignment or a joke.

I don't use NPM so maybe it doesn't really matter aside from the level of abstraction being implemented being relatively ridiculous.

However, if my build system had to go out and grab build files for every X number of basic functions I need to use, grab Y number of dependencies for those functions, run X * Y number of tests for all those dependent packages, AND then also fell apart if someone threw a tantrum and removed any one of those packages basically shutting me down for a day... then I'd question every single thing about my decisions to use that technology.

[Quick Edit] Basically I'm saying "Get off my lawn ya kids!"

Re: NPM and Left-Pad: Have We Forgotten How to Program?

#96
post #26
post #7

Holy moly-- is-positive-integer/index.js: var passAll = require('101/pass-all') var isPositive = require('is-positive') var isInteger = require('is-integer') module.exports = passAll(isPositive, isInteger) I retract my previous statements that Javascript programmers are going down the same enterprise-y mess that Java programmers went down a decade ago. They've already taken it to an entirely different level of insani…

I think this is some sort of cargo cult UNIX minimalism - do one thing and one thing only.

Philistine! You should just be doing i things.

Re: NPM and Left-Pad: Have We Forgotten How to Program?

#97
post #19
post #3

Usually, dependency hell doesn't bite you, until it does. Try to rebuild that thousand-dependencies app in three years from now and you'll see ;-) I recently had to rebuild a large RoR app from circa 2011 and it took me longer to solve dependencies issues than to familiarise myself with the code base. Excessive dependencies are a huge anti-pattern and, in our respective developers communities, we should try to circul…

> Try to rebuild that thousand-dependencies app in three years from now and you'll see ;-) This is your fault for expecting free resources to remain free forever. If you care about build reproduction, dedicate resources to maintain a mirror for your dependencies. These are trivial to setup for any module system worth mentioning (and trivial to write if your module system is so new or esoteric that one wasn't already…

There's more to dependency hell than "oops, the package disappeared." Try updating one of those dependencies because of a security fix, and finding that it now depends on Gizmo 7.0 when one of your other dependencies requires Gizmo < 6.0.

Re: NPM and Left-Pad: Have We Forgotten How to Program?

#98
I find NPM packaging ridiculous. Awhile I go I used NPM on windows, where the folder hierarchy became so deep it broke windows file handling. I could not delete the modules folder. I had install a npm package which allowed me to delete it. I think this is fixed in new versions by flattening the hierarchy, but still.

Re: NPM and Left-Pad: Have We Forgotten How to Program?

#99
post #5

I think it speaks to just how lacking the baseline Javascript standard library is. The libraries that come with node help, but all of this stuff seems like it should be built-in, or at least available in some sort of prelude-like standard addon library. The lack of either leads to all these (apparently ephemeral) dependencies for really simple functions like these. That said, I work with Java, Clojure and Python most…

So many people use lodash as a drop-in standard addon library that I'm surprised people aren't just using the padding functions that are right in there... Some of the packages that broke yesterday even have lodash included as dependencies already!

What if lodash itself was unpublished? I'm having a hard time drawing a line here, obviously a 10 line function is too far on the bad side of lazy, but I can't tell what is an acceptable dependency.

Re: NPM and Left-Pad: Have We Forgotten How to Program?

#100

Counter-argument: A good micro-module removes complexity. It has one simple purpose, is tested, and you can read the code yourself in less than 30 seconds to know what's happening. Take left-pad, for example. Super simple function, 1 minute to write, right? Yes. But check out this PR that fixes an edge case: https://github.com/azer/left-pad/pull/1 The fact of the matter is: every line of code I write myself is a comm…

Another interesting argument for micro-modules: https://github.com/sindresorhus/ama/issues/10#issuecomment-1...

[deleted]
Post reply on HN