Live data from Hacker News

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

haneycodes.net

801–810 of 887 posts

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

#801
post #732

Earlier quoted context omitted.

> A 1-line of code module matches your needs exactly just for today. Nothing about function length determines utility. There are many one lines that match many people's needs repeatedly. > When you have 100 such modules which don't quite work This is worrying. How are you picking the modules you use? 100x popular modules from npm - with git repos, unit tests, READMEs, and hundreds of other users - beat 100x functions…

Worry not my friend. I'll take the risk of being wrong. Up to now, it seems that there's consensus on the fact that the JS/frontend world is the worst offender when it comes to engineering robust software. At least there are JS programmers that seem aware of it and agree that this has to change. So there's still hope I guess.

I think there are people who are aware of the problem, but that problem is people reinventing the wheel a thousand times, and relying on copypasta and needless work rather than package management.

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

#802
post #732

Earlier quoted context omitted.

> A 1-line of code module matches your needs exactly just for today. Nothing about function length determines utility. There are many one lines that match many people's needs repeatedly. > When you have 100 such modules which don't quite work This is worrying. How are you picking the modules you use? 100x popular modules from npm - with git repos, unit tests, READMEs, and hundreds of other users - beat 100x functions…

Worry not my friend. I'll take the risk of being wrong. Up to now, it seems that there's consensus on the fact that the JS/frontend world is the worst offender when it comes to engineering robust software. At least there are JS programmers that seem aware of it and agree that this has to change. So there's still hope I guess.

> JS/frontend world is the worst offender when it comes to engineering robust software

I completely agree. I still can't understand why the language that we depend on for increasingly large-scale front-end work still works like this:

[1, 10, 2, 21].sort() // returns: [1, 10, 2, 21]

It's 2016, software engineering is purported to be a profession, and we still have the worst tools imaginable.

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

#803
post #675

Earlier quoted context omitted.

People need modules like leftpad to tick the "maintains moderately popular open source project" checkbox. Instant hirability. I don't want to claim that it would be a directly calculated career move, more like starting a blog: you admire a good blog, you want to be more like the blogger, you start your own one. On the dim chance that it will become both good and not abandoned after the third post. Nanomodules can be…

Yep, I think this is a huge, HUGE part of it. Step 1: Create a culture in which "having open source contributions" is a requirement to entering said culture. Step 2: Remove all friction from introducing open source contributions into the culture. Step 3: Watch the Cambrian explosion. Step 4: (Two years later) Point to the Cambrian collapse and how the new hot thing will solve everything. I don't know what sort of shi…

That scenario in the last paragraph is an uncomfortably convincing view of the future. Do you think it could be avoided by an additional step like the following?

Step 5: a mechanism for curated metamodules

This would not have changed much for the current situation, but it might help cultivating a "too important to play it fast and loose" mindset that would.

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

#804
post #791

No it's because they don't do the same thing at all. This comparison shows you clearly don't understand the first thing about promises.

If you're new to technical discussions, people normally provide supporting arguments. Both of those handle sequences of tasks that need to complete in order. "No you don't understand" without any further info is not a response.

I think if you don't even know the basics of something, you should go learn them before discussing it.

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

#805
post #225

Another explanation for the flourishing of these one function modules may be the fact that some people feel a kind of high/achievement from being able to say they have a published module out there. A sort of bragging rights if you will.

"I may not be Mick Jagger, but I am playing in a band and we did have some gigs (before we had that 50% decline in audience when my mother got bored and stopped showing up)" - just about every twentysomething before coding became a desirable career

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

#806
post #744
post #578

Earlier quoted context omitted.

Odd, the ones I use all have tests, thousands of downloads, and active bug trackers. If I reinvented the wheel, or copy pasted, I wouldn't get those things.

The OP's example ( is-positive-integer) has tests, and is only three lines long, and is on major release version 3.X, because despite all that , it had serious problems in versions 1 and 2.

"Serious problems in versions 1 and 2" suggests that it might be a good idea not to write your own version 1.

But to be explicit about the history: version one[0] had dependencies. Version two[1] had no dependencies, and a comment on github suggests that it might be wrong but I can't immediately see how. Version three[2] is a different implementation, and adds another export.

[0] https://github.com/tjmehta/is-positive-integer/commit/3003f9...

[1] https://github.com/tjmehta/is-positive-integer/commit/b47e90... - it should return false for 0, so I'm not sure what the commenter is getting at

[2] https://github.com/tjmehta/is-positive-integer/commit/3cdfe1...

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

#807
post #599
post #186

Earlier quoted context omitted.

Worse yet, a backdoor or legitimate bug in any of these module could leave huge exploits in the entire Node.js ecosystem.

A backdoor or legitimate bug in any line of custom code could leave huge exploits in your system. A widely-used published module is likely to be much more reliable, at least on average.

Except when you are using a library like boost or pandas you know the people behind it know what they are doing. When you are importing from a thousand different package authors any one of those people could be incompetent and/or malicious and screw up your entire code base.

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

#808
post #423

Earlier quoted context omitted.

I think it would be annoying but recoverable. It's used so widely that somebody would republish it, at worst under a different name. Edit: But there would sure be a period of chaos.

So it's the same with pad-left. But some how people are wrong for depending on pad-left.

If you depend on Lodash, you depend on Lodash. You have 1 point of failure.

If you depend on 2,000 tiny individual modules, each from different authors, you depend on 2,000 tiny individual modules. You have 2,000 different points of failure. Any one of those authors going rogue will break your build or compromise your system, and every one of those tiny modules has a lot less attention and care paid to it than a larger library like Lodash.

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

#809
post #56
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…

A fun r/programming subthread about this package: https://www.reddit.com/r/programming/comments/4bjss2/an_11_l... Those are just the three top-level dependencies. The package has 9 recursive dependencies. There's also a nice table explaining how a package called "is-positive" managed to reach version 3.1.0.

This is just baffling...

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

#810
post #781

Earlier quoted context omitted.

typeof string == "string" && string.length && string[0] == string[0].toUpperCase() && string[0].toUpperCase() != string[0].toLowerCase();

Man, Javascript is AWESOME .

/\p{Lt}/.test(str) would be much more compact, but Unicode properties still aren't available in Javascript regular expressions. It doesn't look like they will be anytime soon. I guess they have some staging system and it's still at stage 0 (https://github.com/tc39/ecma262/blob/master/stage0.md), grouped with lookbehind assertions, named captures, and mode modifiers.
Post reply on HN