Feed aggregator
Protect Arctic From 'Dangerous' Climate Engineering, Scientists Warn
Read more of this story at Slashdot.
Witnesses Tell Congress of UFO Sightings
Read more of this story at Slashdot.
CodeSOD: Upsert Yours
Henrik H sends us a short snippet, for a relative value of short.
We've all seen this method before, but this is a particularly good version of it:
public class CustomerController { public void MyAction(Customer customer) { // snip 125 lines if (customer.someProperty) _customerService.UpsertSomething(customer.Id, customer.Code, customer.Name, customer.Address1, customer.Address2, customer.Zip, customer.City, customer.Country, null, null, null, null, null, null, null, null, null, null, null, null, null, null, false, false, null, null, null, null, null, null, null, null, null, null, null, null, false, false, false, false, true, false, null, null, null, false, true, false, true, true, 0, false, false, false, false, customer.TemplateId, false, false, false, false, false, string.Empty, true, false, false, false, false, false, false, false, false, true, false, false, true, false, false, MiscEnum.Standard, false, false, false, true, null, null, null); else _customerService.UpsertSomething(customer.Id, customer.Code, customer.Name, customer.Address1, customer.Address2, customer.Zip, customer.City, customer.Country, null, null, null, null, null, null, null, null, null, null, null, null, null, null, false, false, null, null, null, null, null, null, null, null, null, null, null, null, false, false, false, false, true, false, null, null, null, false, false, false, true, true, 0, false, false, false, false, customer.TemplateId, false, false, false, false, false, string.Empty, true, false, false, false, false, false, false, false, true, true, false, false, true, false, false, MiscEnum.Standard, false, false, false, true, null, null, null); // snip 52 lines } }Welcome to the world's most annoying "spot the difference" puzzle. I've added line breaks (as each UpsertSomething was all on one line in the original) to help you find it. Here's a hint: it's one of the boolean values. I'm sure that narrows it down for you. It means the original developed didn't need the if/else and instead could have simply passed customer.someProperty as a parameter.
Henrick writes:
While on a simple assignment to help a customer migrate from .NET Framework to .NET core, I encountered this code. The 3 lines are unfortunately pretty representative for the codebase
.comment { border: none; } [Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!Beer Drinkers Are Mosquito Magnets, According To a Festival Study
Read more of this story at Slashdot.
Executive Director Cindy Cohn Will Step Down After 25 Years With EFF
Read more of this story at Slashdot.
Microsoft To Use Some AI From Anthropic In Shift From OpenAI
Read more of this story at Slashdot.
HHS Asks All Employees To Start Using ChatGPT
Read more of this story at Slashdot.
How Google Is Already Monetizing Its AI Services To Generate Revenue
Read more of this story at Slashdot.
US High School Students Lose Ground In Math and Reading, Continuing Yearslong Decline
Read more of this story at Slashdot.
Intel Ousts CEO of Products, Ending 30-Year Career
Read more of this story at Slashdot.
Apple Adds Hypertension and Sleep-Quality Monitoring To Watch Ultra 3, Series 11
Read more of this story at Slashdot.
AirPods Pro 3 Arrive With Heart-Rate Sensing, Live Translation Using Apple Intelligence
Read more of this story at Slashdot.
Canon is Bringing Back a Point-and-Shoot From 2016 With Fewer Features and a Higher Price
Read more of this story at Slashdot.
Apple Launches iPhone 17 Lineup Featuring Ultra-Thin 5.6mm iPhone Air
Read more of this story at Slashdot.
Reuters Withdraws Xi, Putin Longevity Video After China State TV Pulls Legal Permission To Use It
Read more of this story at Slashdot.
Microsoft Forces Workers Back To the Office
Read more of this story at Slashdot.
The Renewed Bid To End Quarterly Earnings Reports
Read more of this story at Slashdot.
US Created 911,000 Fewer Jobs Than Previously Thought in the 12 Months Through March
Read more of this story at Slashdot.
No Alpha Left in Public Markets
Read more of this story at Slashdot.
US Tech Companies Enabled the Surveillance and Detention of Hundreds of Thousands in China
Read more of this story at Slashdot.