On 15 Sep 2009, at 12:34, Xavier Shay wrote:

>> I am still a little puzzled, though. If I use modules instead of
>> inheritance, how would one code something like "list all items of  
>> this
>> character"? Would it need to iterate over all types of items? I could
>> imagine coding something that tracks all item types and then  
>> program a
>> fairly short function that iterates over them, but that would lead  
>> to a
>> very large number of queries (one for each item type) just to get the
>> list ...
>>
>> Am I missing something? :)
> No, you're spot on. The question becomes, do you actually need a  
> list of
> all the 'items' intermingled together? In many cases I've seen STI,  
> the
> answer is no, though that doesn't mean your answer is 'no' :)

I'll second this.  I was recently hesitant about one of our user  
stories because it involved adding the ability to "pass", as opposed  
to "answer" a question.  I thought the two would need to be connected  
somehow, but we actually just ended up adding a table of passes and it  
slotted neatly in.  We may have to produce a set of "user responses"  
at some point, but that is probably a higher level presentation  
issue.  The key behaviour of the app was trivial to implement.

Another way of saying this, is that you shouldn't expect the ORM to do  
all the aggregation for you.  Either SQL views or higher-level (hand- 
written) domain models in your code can do the same, without  
attempting to shoehorn everything into a thin, flat layer using only  
ORM features.

Ashley

-- 
http://www.patchspace.co.uk/
http://www.linkedin.com/in/ashleymoran
http://aviewfromafar.net/








--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to