On 12/11/2015 9:43 AM, Alex Newman wrote:
I almost hate to bring this up, but we are reading Eric Evan's book
"Domain Driven Development" at my company in our technical bookclub
and some techniques in the book seem to be hard to apply in DJango.
The main one being the notion of aggregations:
From  http://martinfowler.com/bliki/DDD_Aggregate.html
"Aggregate is a pattern in Domain-Driven Design. A DDD aggregate is a
cluster of domain objects that can be treated as a single unit. An
example may be an order and its line-items, these will be separate
objects, but it's useful to treat the order (together with its line
items) as a single aggregate.
An aggregate will have one of its component objects be the aggregate
root. Any references from outside the aggregate should only go to the
aggregate root. The root can thus ensure the integrity of the
aggregate as a whole."
Can we actually enforce this in django?
No. But you can write methods in the aggregate root model as an API to
manage the child models. If you are disciplined it should work.
The main problem (I think) implementing Eric Evans aggregate is deleting
items within the boundary.
See
https://docs.djangoproject.com/en/1.8/ref/models/fields/#django.db.models.ForeignKey.on_delete
Maybe it would be possible to use a callable for the root model's
on_delete such that the constant returned is appropriate for the
circumstances.
It is interesting and would be very useful if you worked out how to do
it in a way we could all benefit.
Good luck.
Mike
--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to django-users+unsubscr...@googlegroups.com
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/aa759e76-0192-4103-89c7-0001ed666f26%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/aa759e76-0192-4103-89c7-0001ed666f26%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/5643E7DC.3030509%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.