You’re thinking of https://en.wikipedia.org/wiki/Npm_left-pad_incident probably, where a single dev removed his like 11 line package of code that just adding padding to text and broke half the internet, yeah.
I still can remember tech bros writing blogs about how putting every function in a separate package is a really good idea. And how it’s silly to implement it yourself.
Kevlin Henney did a presentation which included a code review of the left pad package. Several of his unit tests failed.
The code in question wasn’t particularly well written or anything
module.exports = leftpad;
functionleftpad (str, len, ch) {
str = String(str);
var i = -1;
ch || (ch = ' ');
len = len - str.length;
while (++i < len) {
str = ch + str;
}
return str;
}
And this is the package that it was replaced with. It also failed several tests
'use strict';
module.exports = leftPad;
var cache = [
'',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' '
];
functionleftPad (str, len, ch) {
// convert `str` to a `string`
str = str + '';
// `len` is the `pad`'s length now
len = len - str.length;
// doesn't need to padif (len <= 0) return str;
// `ch` defaults to `' '`if (!ch && ch !== 0) ch = ' ';
// convert `ch` to a `string` cuz it could be a number
ch = ch + '';
// cache common use casesif (ch === ' ' && len < 10) return cache[len] + str;
// `pad` starts with an empty stringvar pad = '';
// loopwhile (true) {
// add `ch` to `pad` if `len` is oddif (len & 1) pad += ch;
// divide `len` by 2, ditch the remainder
len >>= 1;
// "double" the `ch` so this operation count grows logarithmically on `len`// each time `ch` is "doubled", the `len` would need to be "doubled" too// similar to finding a value in binary search tree, hence O(log(n))if (len) ch += ch;
// `len` is 0, exit the loopelsebreak;
}
// pad `str`!return pad + str;
}
Not really caring about things working correctly didn’t start with LLM coding assistants/agents. Outside of a few industries programming never was a serious engineering discipline and people mostly rejected the idea that it should be one.
brogrammers rejected it. Nerds like Margaret Hamilton stood on principle
This caption is misleading btw. She never worked directly for NASA, she worked at MIT who were contracted by NASA for the software.
I also know people who have worked in nuclear energy and aviation software and they are really serious about not taking shortcuts. And regularly complain about higher ups saying things and occasionally pressuring them against industry standards in the name of speeding things up.
For some of the really flight critical stuff that I picked their brains on, the on-cpu cache was disabled because using it would make deterministally analyzing the executive time too difficult. There also wasn’t a pre-emptive multitasking scheduler but instead every task would run during a scheduled time slot in a big superloop.
All of this caution actually made the software a lot more primitive than the software that Margaret Hamilton led the development of for the Apollo program, but these days cpu cycles and memory are a lot cheaper than the engineering time to implement all these things in a safe way, or so they said.
Clients want new shiny features and they want them fast and they want them cheap and they want to change their scope 20 things during the project. They do not want to pay for boring unit tests that confirms that the system works.
A few years ago wasn’t there a single open source project that got abandoned by its dev and it crippled the entire web?
You’re thinking of https://en.wikipedia.org/wiki/Npm_left-pad_incident probably, where a single dev removed his like 11 line package of code that just adding padding to text and broke half the internet, yeah.
I still can remember tech bros writing blogs about how putting every function in a separate package is a really good idea. And how it’s silly to implement it yourself.
Kevlin Henney did a presentation which included a code review of the left pad package. Several of his unit tests failed.
The code in question wasn’t particularly well written or anything
module.exports = leftpad; function leftpad (str, len, ch) { str = String(str); var i = -1; ch || (ch = ' '); len = len - str.length; while (++i < len) { str = ch + str; } return str; }And this is the package that it was replaced with. It also failed several tests
'use strict'; module.exports = leftPad; var cache = [ '', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ]; function leftPad (str, len, ch) { // convert `str` to a `string` str = str + ''; // `len` is the `pad`'s length now len = len - str.length; // doesn't need to pad if (len <= 0) return str; // `ch` defaults to `' '` if (!ch && ch !== 0) ch = ' '; // convert `ch` to a `string` cuz it could be a number ch = ch + ''; // cache common use cases if (ch === ' ' && len < 10) return cache[len] + str; // `pad` starts with an empty string var pad = ''; // loop while (true) { // add `ch` to `pad` if `len` is odd if (len & 1) pad += ch; // divide `len` by 2, ditch the remainder len >>= 1; // "double" the `ch` so this operation count grows logarithmically on `len` // each time `ch` is "doubled", the `len` would need to be "doubled" too // similar to finding a value in binary search tree, hence O(log(n)) if (len) ch += ch; // `len` is 0, exit the loop else break; } // pad `str`! return pad + str; }Not really caring about things working correctly didn’t start with LLM coding assistants/agents. Outside of a few industries programming never was a serious engineering discipline and people mostly rejected the idea that it should be one.
brogrammers rejected it. Nerds like Margaret Hamilton stood on principle
This caption is misleading btw. She never worked directly for NASA, she worked at MIT who were contracted by NASA for the software.
I also know people who have worked in nuclear energy and aviation software and they are really serious about not taking shortcuts. And regularly complain about higher ups saying things and occasionally pressuring them against industry standards in the name of speeding things up.
The only thing I know about software engineering in aviation is that they don’t even fuck with dynamic memory allocation. They are not fucking around.
For some of the really flight critical stuff that I picked their brains on, the on-cpu cache was disabled because using it would make deterministally analyzing the executive time too difficult. There also wasn’t a pre-emptive multitasking scheduler but instead every task would run during a scheduled time slot in a big superloop.
All of this caution actually made the software a lot more primitive than the software that Margaret Hamilton led the development of for the Apollo program, but these days cpu cycles and memory are a lot cheaper than the engineering time to implement all these things in a safe way, or so they said.
Academics wanted it to be math.
Clients want new shiny features and they want them fast and they want them cheap and they want to change their scope 20 things during the project. They do not want to pay for boring unit tests that confirms that the system works.