9 Feb 14:37
Re: CQRS cross aggregate interaction + private state
sebaszipp <sebaszipp <at> yahoo.com>
2010-02-09 13:37:09 GMT
2010-02-09 13:37:09 GMT
Hi Roger, You can find all those called "collaboration patterns" in the great book StreamLined Object Modeling. I know it thanks to Nuno. You can download the patterns chapter for free on the net. Cheers. --- In domaindrivendesign <at> yahoogroups.com, "rogeralsing" <roger.alsing@...> wrote: > > Ah, ofcourse, it's how the old MUD games works> > player.Eat(apple); > apple.CanBeEaten(player); > > I knew this, just wanted to see if your all awake *jk* > > --- In domaindrivendesign <at> yahoogroups.com, Nuno Lopes <nbplopes@> wrote: > > > > Maybe I can help: > > > > class Product : IOrderableItem > > .... > > void TestAddOrder(Order order, double qty) > > { > > if (this.IsObsolete()) > > throw new BusinessException("An obsolete product cannot be ordered") > > } > > > > void Order (Order o, double qty) { > > o.AddItem(this, this.REF, this.Description, this.Price, qty) > > } > > ..... > > > > class Order > > { > > void AddItem(IOrderableItem i, string REF, string description, double price, double qty) > > { > > ... > > i.TestAddOrder(this, qty) > > ...... > > this.DoAddItem(new OrderLine(REF, description, price, qty)); > > } > > } > > > > Hope it helps. > > > > Nuno > > > > > > On Feb 9, 2010, at 12:38 PM, rogeralsing wrote: > > > > > If entities only have private state, how do you deal with interaction between aggregates? > > > > > > e.g. > > > > > > product = GetProduct(123); > > > order.AddProduct(product,3); > > > > > > Lets for the sake of the argument that addproduct can not occur if product is marked as obsolete. > > > > > > How would you deal with that? > > > What's the idea behind completely private state? > > > Why shouldn't order be able to read properties on product? > > > > > > > > > ------------------------------------
>
> player.Eat(apple);
> apple.CanBeEaten(player);
>
> I knew this, just wanted to see if your all awake *jk*
>
> --- In domaindrivendesign <at> yahoogroups.com, Nuno Lopes <nbplopes@> wrote:
> >
> > Maybe I can help:
> >
> > class Product : IOrderableItem
> > ....
> > void TestAddOrder(Order order, double qty)
> > {
> > if (this.IsObsolete())
> > throw new BusinessException("An obsolete product cannot be ordered")
> > }
> >
> > void Order (Order o, double qty) {
> > o.AddItem(this, this.REF, this.Description, this.Price, qty)
> > }
> > .....
> >
> > class Order
> > {
> > void AddItem(IOrderableItem i, string REF, string description, double price, double qty)
> > {
> > ...
> > i.TestAddOrder(this, qty)
> > ......
> > this.DoAddItem(new OrderLine(REF, description, price, qty));
> > }
> > }
> >
> > Hope it helps.
> >
> > Nuno
> >
> >
> > On Feb 9, 2010, at 12:38 PM, rogeralsing wrote:
> >
> > > If entities only have private state, how do you deal with interaction between aggregates?
> > >
> > > e.g.
> > >
> > > product = GetProduct(123);
> > > order.AddProduct(product,3);
> > >
> > > Lets for the sake of the argument that addproduct can not occur if product is marked as obsolete.
> > >
> > > How would you deal with that?
> > > What's the idea behind completely private state?
> > > Why shouldn't order be able to read properties on product?
> > >
> > >
> >
>
------------------------------------
RSS Feed