Computer
William Shatner Says He 'Didn't Earn a Penny' From Star Trek Re-Runs
Read more of this story at Slashdot.
Plex Suffers Security Incident Exposing User Data and Urging Password Resets
Read more of this story at Slashdot.
All 54 Lost Clickwheel IPod Games Have Been Preserved For Posterity
Read more of this story at Slashdot.
Nova Launcher's Founder and Sole Developer Has Left
Read more of this story at Slashdot.
Jaguar Land Rover Extends Shutdown After Cyber Attack
Read more of this story at Slashdot.
All IT Work To Involve AI By 2030, Says Gartner
Read more of this story at Slashdot.
Hackers Hijack npm Packages With 2 Billion Weekly Downloads in Supply Chain Attack
Read more of this story at Slashdot.
Signal Rolls Out Encrypted Cloud Backups, Debuts First Subscription Plan at $1.99/Month
Read more of this story at Slashdot.
Google Tells Court 'Open Web is Already in Rapid Decline' After Execs Claimed It Was Thriving
Read more of this story at Slashdot.
US Man Still Alive Six Months After Pig Kidney Transplant
Read more of this story at Slashdot.
Whistle-Blower Sues Meta Over Claims of WhatsApp Security Flaws
Read more of this story at Slashdot.
Mathematicians Find GPT-5 Makes Critical Errors in Original Proof Generation
Read more of this story at Slashdot.
Texas Sued Over Its Lab-Grown Meat Ban
Read more of this story at Slashdot.
OpenAI Says Its Business Will Burn $115 Billion Through 2029
Read more of this story at Slashdot.
The New American Hustle: Dividends Over Day Jobs
Read more of this story at Slashdot.
Some Angry GitHub Users Are Rebelling Against GitHub's Forced Copilot AI Features
Read more of this story at Slashdot.
There's 50% Fewer Young Employees at Tech Companies Now Than Two Years Ago
Read more of this story at Slashdot.
CodeSOD: Pretty Little State Machine
State machines are a powerful way to organize code. They are, after all, one of the fundamental models of computation. That's pretty good. A well designed state machine can make a complicated problem clear, and easy to understand.
Chris, on the other hand, found this one.
static { sM.put(tk(NONE, NONE, invite), sp(PENDING, INVITED)); // t1 sM.put(tk(REJECTED, REJECTED, invite), sp(PENDING, INVITED)); // t2 sM.put(tk(PENDING, IGNORED, invite), sp(PENDING, INVITED)); // t3 sM.put(tk(PENDING, INVITED, cancel), sp(NONE, NONE)); // t4 sM.put(tk(PENDING, IGNORED, cancel), sp(NONE, NONE)); // t5 sM.put(tk(PENDING, BLOCKED, cancel), sp(NONE, BLOCKED)); // t6 sM.put(tk(INVITED, PENDING, accept), sp(ACCEPTED, ACCEPTED)); // t7 sM.put(tk(INVITED, PENDING, reject), sp(REJECTED, REJECTED)); // t8 sM.put(tk(INVITED, PENDING, ignore), sp(IGNORED, PENDING)); // t9 sM.put(tk(INVITED, PENDING, block), sp(BLOCKED, PENDING)); // t10 sM.put(tk(ACCEPTED, ACCEPTED, remove), sp(NONE, NONE)); // t11 sM.put(tk(REJECTED, REJECTED, remove), sp(NONE, NONE)); // t12 sM.put(tk(IGNORED, PENDING, remove), sp(NONE, NONE)); // t13 sM.put(tk(PENDING, IGNORED, remove), sp(NONE, NONE)); // t14 sM.put(tk(BLOCKED, PENDING, remove), sp(NONE, NONE)); // t15 sM.put(tk(PENDING, BLOCKED, remove), sp(NONE, BLOCKED)); // t16 sM.put(tk(NONE, BLOCKED, invite), sp(PENDING, BLOCKED)); // t17 sM.put(tk(IGNORED, PENDING, invite), sp(PENDING, INVITED)); // t19 sM.put(tk(INVITED, PENDING, invite), sp(ACCEPTED, ACCEPTED)); // t20 sM.put(tk(NONE, NONE, remove), sp(NONE, NONE)); // t21 sM.put(tk(NONE, BLOCKED, remove), sp(NONE, BLOCKED)); // t22 sM.put(tk(BLOCKED, NONE, remove), sp(NONE, NONE)); // t23 }Honestly, I only know this is a state machine because Chris told me. I could hazard a guess base on the variable name sM. The comments certainly don't help. Numbering lines isn't exactly what I want comments for. I don't know what tk or sp are actually doing.
So yes, this is an unreadable blob that I don't understand, which is always bad. But do you know what elevates this one step above that? If you note the third parameter to the tk function- invite, cancel, accept, etc? Those are constants. So are INVITED, PENDING, ACCEPTED.
While I am not fond of using the structure of a variable name to denote its role, "caps means const" is a very well accepted standard. A standard that they're using sometimes, but not all the time, and just looking at this makes me grind my teeth.
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!A New Four-Person Crew Will Simulate a Year-Long Mars Mission, NASA Announces
Read more of this story at Slashdot.
Microsoft's Analog Optical Computer Shows AI Promise
Read more of this story at Slashdot.