Computer
Google's 'Aluminium OS' Will Eventually Replace ChromeOS With Android
Read more of this story at Slashdot.
Science-Centric Streaming Service Curiosity Stream is an AI-licensing Firm Now
Read more of this story at Slashdot.
Google Denies 'Misleading' Reports of Gmail Using Your Emails To Train AI
Read more of this story at Slashdot.
NATO Taps Google For Air-Gapped Sovereign Cloud
Read more of this story at Slashdot.
The Slow Transformation of Notepad Into Something Else Entirely Continues
Read more of this story at Slashdot.
Lenovo Stockpiling PC Memory Due To 'Unprecedented' AI Squeeze
Read more of this story at Slashdot.
Apple iOS 27 to Be No-Frills 'Snow Leopard' Update, Other Than New AI
Read more of this story at Slashdot.
Ubisoft Shows Off New AI-Powered FPS And Hopes You've Forgotten About Its Failed NFTs
Read more of this story at Slashdot.
How Google Finally Leapfrogged Rivals With New Gemini Rollout
Read more of this story at Slashdot.
New Mars Orbiter Manuever Challenges Theory: That May Not Be an Underground Lake on Mars
Read more of this story at Slashdot.
How An MIT Student Awed Top Economists With His AI Study - Until It All Fell Apart
Read more of this story at Slashdot.
CodeSOD: Copied Homework
Part of the "fun" of JavaScript is dealing with code which comes from before sensible features existed. For example, if you wanted to clone an object in JavaScript, circa 2013, that was a wheel you needed to invent for yourself, as this StackOverflow thread highlights.
There are now better options, and you'd think that people would use them. However, the only thing more "fun" than dealing with code that hasn't caught up with the times is dealing with developers who haven't, and still insist on writing their own versions of standard methods.
const objectReplace = (oldObject, newObject) => { let keys = Object.keys(newObject) try { for (let key of keys) { oldObject[key] = newObject[key] } } catch (err) { console.log(err, oldObject) } return oldObject }It's worth noting that Object.entries returns an array containing both the keys and values, which would be a more sensible for this operation, but then again, if we're talking about using correct functions, Object.assign would replace this function.
There's no need to handle errors here, as nothing about this assignment should throw an exception.
The thing that really irks me about this though is that it pretends to be functional (in the programming idiom sense) by returning the newly modified value, but it's also just changing that value in place because it's a reference. So it has side effects, in a technical sense (changing the value of its input parameters) while pretending not to. Now, I probably shouldn't get too hung up on that, because that's also exactly how Object.assign behaves, but dammit, I'm going to be bothered by it anyway. If you're going to reinvent the wheel, either make one that's substantially worse, or fix the problems with the existing wheel.
In any case, the real WTF here is that this function is buried deep in a 15,000 line file, written by an offshore contract team, and there are at least 5 other versions of this function, all with slightly different names, but all basically doing the same thing, because everyone on the team is just copy/pasting until they get enough code to submit a pull request.
Our submitter wonders, "Is there a way to train an AI to not let people type this?"
No, there isn't. You can try rolling that boulder up a hill, but it'll always roll right back down. Always and forever, people are going to write bad code.
[Advertisement] Utilize BuildMaster to release your software with confidence, at the pace your business demands. Download today!'We Could've Asked ChatGPT': UK Students Fight Back Over Course Taught By AI
Read more of this story at Slashdot.
Napster Said It Raised $3 Billion From a Mystery Investor. But Now the 'Investor' and 'Money' Are Gone
Read more of this story at Slashdot.
New Research Finds America's Top Social Media Sites: YouTube (84%) Facebook (71%), Instagram (50%)
Read more of this story at Slashdot.
Was the Moon-Forming Protoplanet 'Theia' a Neighbor of Earth?
Read more of this story at Slashdot.
Cryptologist DJB Criticizes Push to Finalize Non-Hybrid Security for Post-Quantum Cryptography
Read more of this story at Slashdot.
Google Revisits JPEG XL in Chromium After Earlier Removal
Read more of this story at Slashdot.
Mozilla Announces 'TABS API' For Developers Building AI Agents
Read more of this story at Slashdot.
One Company's Plan to Sink Nuclear Reactors Deep Underground
Read more of this story at Slashdot.
