Feed aggregator
FTC Says 23andMe Purchaser Must Uphold Existing Privacy Policy For Data Handling
Read more of this story at Slashdot.
Arkansas Social Media Age Verification Law Blocked By Federal Judge
Read more of this story at Slashdot.
MCP: the New 'USB-C For AI' That's Bringing Fierce Rivals Together
Read more of this story at Slashdot.
Larry Fink Says Bitcoin Could Replace the Dollar as the World's Reserve Currency Because of National Debt
Read more of this story at Slashdot.
DeepMind is Holding Back Release of AI Research To Give Google an Edge
Read more of this story at Slashdot.
Study Reveals Why Credit Card Interest Rates Remain Stubbornly High
Read more of this story at Slashdot.
London Mayor Axes Cyber Crime Victim Support Line
Read more of this story at Slashdot.
Gmail is Making It Easier For Businesses To Send Encrypted Emails To Anyone
Read more of this story at Slashdot.
Average Person Will Be 40% Poorer If World Warms By 4C, New Research Shows
Read more of this story at Slashdot.
Xiaomi EV Involved in First Fatal Autopilot Crash
Read more of this story at Slashdot.
Alan Turing Institute Plans Revamp in Face of Criticism and Technological Change
Read more of this story at Slashdot.
CodeSOD: A Ruby Encrusted Footgun
Many years ago, JP joined a Ruby project. This was in the heyday of Ruby, when every startup on Earth was using it, and if you weren't building your app on Rails, were you even building an app?
Now, Ruby offers a lot of flexibility. One might argue that it offers too much flexibility, especially insofar as it permits "monkey patching": you can always add new methods to an existing class, if you want. Regardless of the technical details, JP and the team saw that massive flexibility and said, "Yes, we should use that. All of it!"
As these stories usually go, that was fine- for awhile. Then one day, a test started failing because a class name wasn't defined. That was already odd, but what was even odder is that when they searched through the code, that class name wasn't actually used anywhere. So yes, there was definitely no class with that name, but also, there was no line of code that was trying to instantiate that class. So where was the problem?
def controller_class(name) "#{settings.app_name.camelize}::Controllers".constantize.const_get("#{name.to_s.camelize}") end def model_class(name) "#{settings.app_name.camelize}".constantize.const_get("#{name.to_s.camelize}") end def resource_class(name) "#{settings.app_name.camelize}Client".constantize.const_get("#{name.to_s.camelize}") endIt happened because they were dynamically constructing the class names from a settings field. And not just in this handful of lines- this pattern occurred all over the codebase. There were other places where it referenced a different settings field, and they just hadn't encountered the bug yet, but knew that it was only a matter of time before changing a settings file was going to break more functionality in the application.
They wisely rewrote these sections to not reference the settings, and dubbed the pattern the "Caramelize Pattern". They added that to their coding standards as a thing to avoid, and learned a valuable lesson about how languages provide footguns.
Since today's April Fool's Day, consider the prank the fact that everyone learned their lesson and corrected their mistakes. I suppose that has to happen at least sometimes.
[Advertisement] Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.Anthropic Will Begin Sweeping Offices For Hidden Devices
Read more of this story at Slashdot.
First Flight of Isar Aerospace's Spectrum Rocket Lasted Just 40 Seconds
Read more of this story at Slashdot.
'There is No Vibe Engineering'
Read more of this story at Slashdot.
Intel CEO Lip-Bu Tan Says Company Will Spin Off Non-Core Units
Read more of this story at Slashdot.
UK's GCHQ Intern Transferred Top Secret Files To His Phone
Read more of this story at Slashdot.
Intel and Microsoft Staff Allegedly Lured To Work For Fake Chinese Company In Taiwan
Read more of this story at Slashdot.
OpenAI Plans To Release a New 'Open' AI Language Model In the Coming Months
Read more of this story at Slashdot.
Google To Pay $100 Million To Settle 14-Year-Old Advertising Lawsuit
Read more of this story at Slashdot.