Live data from Hacker News

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

haneycodes.net

821–830 of 887 posts

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

#821
post #446

Earlier quoted context omitted.

Similar idea but what if you were to write your tests first and then upload them to a site that pieces together the required modules to pass them and generates an API against the modules.

Because finding code that passes arbitrary tests is undecidable in the general case. (Same reason the pseudo-Idris language would have to be non-Turing-complete)

I was joking clearly. Thought the ridiculousness of the idea make that clear.

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

#823
post #815

Earlier quoted context omitted.

It's not working out fine. You just haven't been around long enough to understand it. JS code is the most disposable piece of any infrastructure. In all companies(mine included) that I know of, npm and the JS jenga tower of hell is the most brittle element that breaks every fucking day. It's the constant pain you can count on being around. The stack and the dependencies are a moving target. Like.. every minute. If yo…

Perhaps you should be looking inwards, rather than blaming your tools, for the reason your npm 'jenga tower of hell' exists in the first place. I experience no such pain, and i've been doing this for many years. And i've coded plenty in other languages. None with anywhere near as good an experience as NPM if you know how to use it properly.

Tell me the languages and package managers you're talking about.

Don't worry, we ain't going nowhere. Think hard and take as much time as you want.

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

#824
post #117

Have we forgotten how to program? Maybe we've forgotten how to /just/ program. Everyone bangs the drum so hard of "let github be your resume." Incentivizing putting every brain fart you ever had out into the universe instead of just keeping it to yourself. Just a thought.

The problem is not that we forgot how to program, the problem is that we never actually learned how to create a good programming language which avoids these problems. Just look at the whole build system and module hell of C and C++... I totally like the language C++ but I hate the tooling around it with a passion. As long as you only need stuff from stdlib then you are fine, but as soon as you want to create some cus…

Of course we learned how to create good programming languages which deal with this problem. A very good and thorough approach was introduced with Modula-2, which, as the name hints to, had modules as a main focus point. Building Modula programs was an easy and quick process. The module system lives on today in the form of Golang - one of the founders was a student or Wirth.

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

#825

Earlier quoted context omitted.

A module doesn’t solve that kind of type confusion, though. Static typing does. The next best thing in JavaScript is passing consistent types of values to your functions, so just write function isPositiveInteger(x) { return x > 0 && Number.isInteger(x); } and always pass it a number. (Of course, this shouldn’t even be a function, because JavaScript is confused about the definition of “integer” – maybe you really want…

The module checks that the positive integer is less than Number.MAX_SAFE_INTEGER constant, while yours would lead to unsafe comparisons if we trust its validity as a number.

The name of the function, though, isn’t `isPositiveSafeInteger`; it matches `Number.isInteger` instead.

Or maybe you don’t just want safe integers, maybe you want `x >>> 0 === x`, or `x > 0 && (x | 0) === x`, or…. This is what I meant about JavaScript being confused about the definition of “integer”.

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

#826

Yes, or more accurately a large new generation of coders is entering the workforce who know how to code only in a superficial sense and think this is a good thing. Programming, and especially startup programming, is being taken over by people who are primarily technicians rather than engineers. They want to assemble prefab components in standardized ways rather than invent new things. They are plumbers who know how t…

What would you recommend to a junior CS major to avoid falling into this pattern?

Specialize. Pick a subfield of CS that you really enjoy, that really resonates with you -- machine learning, NLP, algorithms, whatever -- and become an absolute expert at it. Know your subfield inside and out.

Start thinking about what specialty you want now, today. Do some research, talk to professors and other students, etc. By the time you are a senior, you should know what you want to specialize in and be well on your way.

Then, you can get a job that actually requires deep knowledge. Since you actually care about this, you'll quickly become bored and frustrated if you take a standard startup code monkey job where you are expected to write Rails or PHP code all day, but then that's the only experience you'll have. You'll also be competing with less well educated programmers who are willing to work for less.

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

#827
post #615

Yes, or more accurately a large new generation of coders is entering the workforce who know how to code only in a superficial sense and think this is a good thing. Programming, and especially startup programming, is being taken over by people who are primarily technicians rather than engineers. They want to assemble prefab components in standardized ways rather than invent new things. They are plumbers who know how t…

an engineer is more like a plumber than an inventor though. you don't need to design a new type of screw to make a one off aquaduct, you don't need to design new bearings to make a gear box, you don't need to design a new opamp to make an amplifier, nor do you need to design a new MVC framework to make a one off CRUD app. You use off the shelf parts and combine them with your knowledge and skills to produce and effec…

The point is that for most things, there were no such off-the-shelf parts in software engineering until recently. You had to invent each screw and bearing yourself, because you couldn't just order a bunch of screws and bearings. Nobody sold them.

Moreover, the difference is that today's technician-programmers don't know how screws and bearings work at all. The engineer who uses prefab screws and bearings still understands them in detail and knows when to deploy them and when not to. Rather than understanding what bearings are for, the technician-programmer has a problem X, reads a blog post that says, "I solved Y by adding some bearings," and thinks, "gee, X is similar enough to Y that adding some bearings may work."

They add some random bearings, some screws, some cams and driveshafts here and there, without any deep understanding at all of why you ought to use these things in a design... and over time build a Rube Goldberg monolith with 10,000 moving parts sticking out randomly that nobody actually understands at all, so as a result everyone is terrified to work on any part of it for fear of inadvertently breaking the other 60 hidden dependencies of that piece.

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

#828

Yes, or more accurately a large new generation of coders is entering the workforce who know how to code only in a superficial sense and think this is a good thing. Programming, and especially startup programming, is being taken over by people who are primarily technicians rather than engineers. They want to assemble prefab components in standardized ways rather than invent new things. They are plumbers who know how t…

Bravo. Saving this comment. For substance: Consider how this is all part of the effort by management to make programmers feel as interchangeable and insignificant as possible. And it's not even in the name of quality. Plenty of software out there breaks because of its multiple single points of failure in the form of dependencies.

Yes, totally. I can understand why management does this. Coders have a very high turnover rate as a profession. When your genius Clojure or Rust programmer leaves, it's much harder and more expensive to find a replacement than when your PHP or Rails programmer quits.

This then incentivizes new coders to take up one of the popular languages, because that's what most of the advertised jobs are for, creating a self-reinforcing positive feedback loop.

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

#829
post #518
post #484

Earlier quoted context omitted.

> basic null check What's funny to me is that leftpad(null, 6, ' ') outputs " null".

Am I right that len(" null") here is 5, so it's working incorreclly?

I think the joke here is that javascript has a long history of thinking that this:

    null
is the same as this:

    "null"
...Which it isn't.

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

#830
post #696

Earlier quoted context omitted.

Case in point: the left-pad package has quadratic complexity.

Depends on the JS implementation in question. And I think node uses one that optimizes string concatenation, possibly making that the fastest way to do it.

Yeah, as far as I know in modern JS engines += is actually faster than using an array.
Post reply on HN