Computer
Founder of Collapsed Social Media Site 'IRL' Charged With Fraud Over Faked Users
Read more of this story at Slashdot.
CodeSOD: Catch or Else
Today's anonymous submitter asks a question: "How do you imagine the rest of the codebase to be like?"
Well, let's look at this snippet of TypeScript and think about it:
.catch((): void => { this.loadFromServerAndShowMessage(); }); } else { this.loadFromServerAndShowMessage(); } }) .catch((): void => { this.loadFromServerAndShowMessage(); }); } else { this.loadFromServer(); } }From the .catchs, I can tell that we're looking at a series of nested promises, each loading content based on the results of the previous. The requests may fail in two ways- either through an exception (hence the catch calls), or because it doesn't return useful data in some fashion (the else clauses).
Regardless of how it fails, we will loadFromServerAndShowMessage, which implies that we're not expecting to handle failures based on connectivity. That seems like a mistake- if our promise fails for some reason, it's likely because we don't have connectivity, so loadFromServer doesn't seem like a viable operation. Maybe we should look at the exception?
Nah, we don't need to do that.
How do I imagine the rest of the code base? Well, I imagine it as a messy thicket of dependencies and no real modularity, fragile and confusing, and probably riddled with bugs, many of which are difficult or impossible to replicate in a controlled environment, meaning they'll likely never get fixed.
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!DARPA Wants to Automatically Transpile C Code Into Rust - Using AI
Read more of this story at Slashdot.
Whatever Happened to MySpace?
Read more of this story at Slashdot.
Neuralink Has Successfully Implanted a Second Brain Chip, Musk Says
Read more of this story at Slashdot.
Rust-Written 'Redox OS' Now Has a Working Web Server
Read more of this story at Slashdot.
Is the 'Kids Online Safety Act' Losing Momentum?
Read more of this story at Slashdot.
What's the 'Smartest' City in America - Based on Tech Jobs, Connectivity, and Sustainability?
Read more of this story at Slashdot.
Revolutionary Dual Action Antibiotic Makes Bacterial Resistance Nearly Impossible
Read more of this story at Slashdot.
NIST Releases an Open-Source Platform for AI Safety Testing
Read more of this story at Slashdot.
Silicon/Perovskite Solar Panels Can Reach 34% Efficiency, Researchers Show
Read more of this story at Slashdot.
Artist and Musician Sue SEC Over Its NFT Regulatory Jurisdiction
Read more of this story at Slashdot.
Apple Is Finally Sending Out Payments For Its Defective Macbook Butterfly Keyboards
Read more of this story at Slashdot.
Coders Don't Fear AI, Reports Stack Overflow's Massive 2024 Survey
Read more of this story at Slashdot.
Should We Fight Climate Change by Releasing Sulfur Dioxide into the Stratosphere?
Read more of this story at Slashdot.
Why DARPA is Funding an AI-Powered Bug-Spotting Challenge
Read more of this story at Slashdot.
Epic Games CEO Criticized For Calling Apple's 'Find My' Feature 'Super Creepy'
Read more of this story at Slashdot.
NFL to Roll Out Facial Authentication Software to All Stadiums, League-Wide
Read more of this story at Slashdot.
How Chinese Attackers Breached an ISP to Poison Insecure Software Updates with Malware
Read more of this story at Slashdot.
Are There Diamonds on Mercury?
Read more of this story at Slashdot.