4 ms·
Death by a thousand queries Wait a moment here. In my experience, most problems like this can be solved by noting something like: When we get X, we also get a
by stcredzero 15y ago
Death by a thousand queries
Wait a moment here. In my experience, most problems like this can be solved by noting something like: When we get X, we also get all of the associated Y's and their Z's. Declarative association of a Batch Query with certain retrievals isn't a newbie project, but it's something a lone programmer can put together in a week in a good ORM. (I've done it.) I would expect this library feature to be common in the Ruby/Python world.
- jeswin 15y agoIt has been a supported feature in just about every other ORM too (Hibernate, Entity Framework, Linq-to-sql..), for ages. The author doesn't seem to have understood ORMs well enough.
- johnzabroski 15y agoGood observation. Anyone writing a blog article on ORM should probably read the c2 wiki entry with the huge feature comparison chart of ORMs first.
- Swannie 15y agoI think the author's point is that by the time you have gone to learn all of the complexities of an ORM, and all the steps you must take to sidestep when you can't bend it to shape... you could have much more easily written it by hand.
- stcredzero 15y agoIf you have a Declarative Batch Query, then you you get a bunch of SQL and plumbing code for free. The join and the iterative code you'd need to do that writing it "by hand" is 10x more.
- gnaritas 15y agoThe author couldn't be more wrong.
- keithnoizu 15y agoYeah I generally do, if object_in_cache_of_object return object else if object_in_cache_of_object_list add object to chace_of_object, return object else populate cache_of_object_list, populate cache_of_object return object
- keithnoizu 15y agoYeah I generally do, if object_in_cache_of_object return object else if object_in_cache_of_object_list add object to chace_of_object, return object else populate cache_of_object_list, populate cache_of_object return object