SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 27 of 27
  1. #26
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,151
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by allspiritseve
    I would much rather specify defaults that I can override at runtime if necessary. For instance, in your example, I would set up my UserMapper to batch lazy load Posts. Thus, if I'm grabbing multiple users and then running them through a foreach, the first access on a User's associatied Posts collection would call a query to fetch all posts for all users originally requested. Each of these posts would probably have eager loaded comments and tags, and these objects would be ready to use. I'm sure you can imagine other related objects being lazy loaded at this point (and when they are loaded, others being lazy/eager/batch loaded, etc.) and all this can happen with that one line of code I showed you before. No work needed on your part. If my database were as simple as yours, I would get away with one query for each relation on my User object-- thus totalling 6 queries which is totally manageable.
    Something that needs to be strategically planned out where as I'm much more interested in being able to make these decisions at run time. The big difference seems to relying on strategy vs. a more agile development approach which is what I'm after. A ORM seems to support the ladder while yielding more responsibility on the developer, while a ActiveRecord supports a more agile approach.
    The only code I hate more than my own is everyone else's.

  2. #27
    Spirit Coder allspiritseve's Avatar
    Join Date
    Dec 2002
    Location
    Ann Arbor, MI (USA)
    Posts
    648
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by oddz View Post
    Something that needs to be strategically planned out where as I'm much more interested in being able to make these decisions at run time. The big difference seems to relying on people be strategic vs. a more agile development approach which is what I'm after.
    I'm interested in specifying object graphs at runtime as well-- but only after proper 'strategic' defaults are in place. It would be interesting to see if I could come up with an elegant way to specify which objects to retrieve, much in the same way you're able to do with tables. There are a lot of other ORM features higher on my list, though.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •