On Mar 11, 8:43 pm, "chasfs" <[EMAIL PROTECTED]> wrote:
> ORM has been contentious for many years - for more background on the
> problems of
> ORM, check out Ted Neward's blog entry 
> -http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science...
>
> Peace,
> -chasfs

That for the link.

Not a bad article (once you wade through the Vietnam stuff). But the
author has only one paragraph on this topic:

"Inheritance mapping isn't the end of it; associations between
objects, the typical 1:n or m:n cardinality associations so commonly
used in both SQL and/or UML, are handled entirely differently: in
object systems, association is unidirectional, from the associator to
the associatee (meaning the associated object(s) have no idea they are
in fact associated unless an explicit bidirectional association is
established), whereas in relational systems the association is
actually reversed, from the associatee to the associator (via foreign
key columns). This turns out to be surprisingly important, as it means
that for m:n associations, a third table must be used to store the
actual relationship between associator and associatee, and even for
the simpler 1:n relationships the associator has no inherent knowledge
of the relations to which it associates--discovering that data
requires a JOIN against any or all associated tables at some point.
(When to actually retrieve that data is a subject of some debate--see
the Loading Paradox, below)."

We already know that associations are reversed between OO and
relational worlds, and it's not really that hard to accommodate,
especially in Django where the relational schema is completely based
off the OO schema.

All that really needs to be done is to either add an attribute to
model.ForeignKey to specify the direction of the association, or to
create a new class to represent this type of association. The DB
schema doesn't need to change at all, but some queries like
get_related() might.

I've heard the argument that Django is only making certain common use
cases simple, and that for any real project "scaffolding is meant to
be torn down". I can only assume that this particular use case
(basically just composition), being pretty elemental to OO design, is
very common. I also hope that newforms will mean that more of the
built-in forms functionality is going to usable in production. As
opposed to having everyone implement their own version, it'd benefit
everyone to have it standardized.

Simon, I hope to implement this also, once things calm down a little.
Feel free to contact me.

-Justin


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

Reply via email to