Feed aggregator
Meta's Customer Service is So Bad, Users Are Suing in Small Claims Court To Resolve Issues
Read more of this story at Slashdot.
London Premiere of Movie With AI-Generated Script Cancelled After Backlash
Read more of this story at Slashdot.
World's Largest Music Company Is Helping Musicians Make Their Own AI Voice Clones
Read more of this story at Slashdot.
EU Delays Decision Over Scanning Encrypted Messages For CSAM
Read more of this story at Slashdot.
Anthropic Launches Claude 3.5 Sonnet, Says New Model Outperforms GPT-4 Omni
Read more of this story at Slashdot.
YouTube Is Cracking Down on Cheap Premium Plans Bought With a VPN
Read more of this story at Slashdot.
Biden To Ban US Sales of Kaspersky Software Over Ties To Russia
Read more of this story at Slashdot.
Perplexity AI Faces Scrutiny Over Web Scraping and Chatbot Accuracy
Read more of this story at Slashdot.
Heat Waves Grip 3 Continents as Climate Change Warms Earth
Read more of this story at Slashdot.
CodeSOD: Extended Models
If I'm being completely honest, I'm mildly anti-ORM. I'm not about to go on a rampage and suggest they should absolutely, never, ever, ever be used, but I think they tend to create a lot of problems. Instead of being a true mapping between our object model and our relational model, they're their own tool, with its own idosynchracies, and a lot of "magic" that conceals its actual operation. For simple applications, they're great, but once you start getting into something more complicated than basic CRUD operations, you're in for a world of hurt. And that's before someone makes a mistake with eager vs. lazy fetching.
Today's anonymous submission offers us a good example of another way the mismatch can go wrong between objects and relations.
class Category_Product_Model extends Product_Model { protected $table_name = "categories_products"; }Product_Model is the model for our products in our ecommerce solution. Category_Product_Model is the join between products and categories. In no sane world would we consider Category_Product_Model a subclass of Product_Model- this implies that we can use a Category_Product in place of a Product. How much would you charge for a link between a product and it's category? I happen to know that Legos belong in both the "toy" category and the "model building" category- what price would you put on that information? Who's the vendor? (Me, I guess?) How many of those links do I have in inventory? Why… as many as you like. It's just information.
There are a few reasons this code might be like this. The most likely, I think, is that someone just didn't care. It's all models, pick one, inherit off it, and move on to the next. But there's another reason, which would be so much worse.
You see, they could have put functionality into Product_Model. It could be more than a simple model object, and have helper functions- helper functions which Category_Product_Model also wants to use. Instead of doing the right thing and refactoring that functionality out of the models, someone decided that inheritance was a convenient way to inject useful functionality into classes.
Our anonymous submitter points out that this code had been in production for seven years by the time they found it, and this use of "creative subclassing" was rampant throughout their data model.
[Advertisement] Otter - Provision your servers automatically without ever needing to log-in to a command prompt. Get started today!Microplastics Discovered In Human Penises For the First Time
Read more of this story at Slashdot.
Pornhub To Block Five More States Over Age Verification Laws
Read more of this story at Slashdot.
FedEx's Secretive Police Force Is Helping Cops Build An AI Car Surveillance Network
Read more of this story at Slashdot.
Plan for New Accounting Rules on Software Costs Moves Forward
Read more of this story at Slashdot.
EU Chat Control Law Proposes Scanning Your Messages - Even Encrypted Ones
Read more of this story at Slashdot.
OpenAI Co-Founder Ilya Sutskever Launches Venture For Safe Superintelligence
Read more of this story at Slashdot.
Senate Passes Bill To Support Advanced Nuclear Energy Deployment
Read more of this story at Slashdot.
Officials Query if Any Deaths Directly Linked To UK Hospital Hack
Read more of this story at Slashdot.
Britain's Universities in Existential Crisis?
Read more of this story at Slashdot.
Former Cisco CEO: Nvidia's AI Dominance Mirrors Cisco's Internet Boom, But Market Dynamics Differ
Read more of this story at Slashdot.