sebaszipp | 1 Dec 14:43
Picon
Favicon

Re: Modelling a traffic control center


Hi Nuno, 

Yes, make sense, thanks!. 

So as a summary for your OO modelling technique is more or less:

1) Determine the event/transaction for the use case
2) Define roles around that event/transaction
3) Apply those roles to context concepts

At the time of defining roles do you always include person roles?

Cheers.

--- In domaindrivendesign <at> yahoogroups.com, Nuno Lopes <nbplopes@...> wrote:
>
> Hi Sebastian,
> 
> > OK, but I would see it more as Designee rather than Asignee just because an assignee is simple not assigned
unless a TrafficMap decides to accomplish the assignment. 
> 
> You need to settle on the business events you want to capture in the model. After this define the needed
roles around these events. In this case, the event is assignment (don´t confuse with Greg's events or
domain events). So in an assignment you have an an assignable object, a assignee and optionally someone
that gave the assignment (Manager?). 
> 
> So Balance balance. "Designation" does not seam to be a business transaction that needs to be captured in
this context. It seams to be Assignment only, unless you need to track failed assignment, in which case
Assignment would be a successful designation.
(Continue reading)

Nuno Lopes | 1 Dec 21:21
Picon
Gravatar

Re: Re: Modelling a traffic control center



Its good start.

At the time of defining roles do you always include person roles?

Not necessarily. Only when a person role is relevant for the transaction in terms of business rules. A lot of roles are of things, places (containers) and so on.

Cheers,

Nuno


On Dec 1, 2009, at 1:43 PM, sebaszipp wrote:

 


Hi Nuno,

Yes, make sense, thanks!.

So as a summary for your OO modelling technique is more or less:

1) Determine the event/transaction for the use case
2) Define roles around that event/transaction
3) Apply those roles to context concepts

At the time of defining roles do you always include person roles?

Cheers.


--- In domaindrivendesign <at> yahoogroups.com, Nuno Lopes <nbplopes <at> ...> wrote:
>
> Hi Sebastian,
>
> > OK, but I would see it more as Designee rather than Asignee just because an assignee is simple not assigned unless a TrafficMap decides to accomplish the assignment.
>
> You need to settle on the business events you want to capture in the model. After this define the needed roles around these events. In this case, the event is assignment (don´t confuse with Greg's events or domain events). So in an assignment you have an an assignable object, a assignee and optionally someone that gave the assignment (Manager?).
>
> So Balance balance. "Designation" does not seam to be a business transaction that needs to be captured in this context. It seams to be Assignment only, unless you need to track failed assignment, in which case Assignment would be a successful designation.
>
> Let me explain something about roles. The Role the role Assignee is not specific to one assignment but across all assignments. For instance, you are Student across all your courses, past and present and future. The same goes for Employee, Husband etc etc. Of course you probably become an Employee after an EmployementContract as been signed between you and your Employer, yet Roles are parts you can play and parts that you play. So making a contract between you and your employer is the same as adding a EmploymentContract to the Employee role if all collaborators (Parties) agree including your Employer.
>
> > a designee will bee an asignee if a TrafficMap allow it
>
> Precisely. That is what TestAddTrafficMapAssignment in the AssignableTrafficMap does. AssignableTrafficMap is the TrafficMap in the context of assignments, in other words also a Role. If this test fails the User will not play the role of Assignee with the specific TrafficMap.
>
> Roles are excellent tools for defining the concept contour of a business action. http://domaindrivendesign.org/node/97
>
> > Similar, only that maybe adding the Assignment concept let us decouple the assignment from a person role while letting us to add other assignment services as extending the periord for assignment, and so on.
>
>
> Yes. If you want to track map assignments across time you need to make the assignment concept more explicit in the model with a class of its own. It is not simply about decoupling its about what the business wants to keep records of. If the business does not want to keep a record of assignments in time this would be over designing IMHO. Balance, Balance. Decoupling is nice, but don´t decouple business transaction that don´t need to be decoupled. Again Conceptual Contours: http://domaindrivendesign.org/node/97
>
> That is why I don´t like Greg state change events as a domain design practice, yet offering a excellent integration strategy . Well actually I do only if you put behavior in them like your are suggesting to do in this case, otherwise IMHO, for the domain model it is just nonfunctional data with some interesting properties.
>
> > Yeah, we don't create an assignment collection in the designee class, but for what purpose? That sounds it would be only for queries and not from a transactional perspective where the TrafficMap is the AR.
>
>
> Your designee sounds a lot like my Assignee that you don´t like as much :). If it was just for queries I would not keep the collection in the domain model, yet I specifically integrated a business rule where a collection would probably be needed. In your specific case it is probably unnecessary, just put pass it on to the Reporting Model.
>
> > One question Nuno, AssignableTrafficMap is a class or an interface the TrafficMap implements?
>
> It may be a class or interface. It depends how cohesive you want you class in the end to be.
>
> > I'm just shooting different ideas
>
>
> Those are good ideas. I suggest you to watch your roles as some of them seam redundant. Also watch your business transactions, only record what needs to be recorded.
>
> Does this help?
>
> Cheers,
>
> Nuno
> PS: Roles are one of those things that everyone understands the definition yet it is a trivial concept once ones grabs its insight, not before.
>




__._,_.___

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___
sebaszipp | 2 Dec 18:40
Picon
Favicon

Re: Adding entities to another, questions around basic example


Hi Nuno, 

I wanted to ask you something about:

> Say the operation: Move photo.
> Who moves the photo? The AlbumOwer. What us the photo in             > relationship to the albums when moving a photo? A
PhotoInAlbum. So   > the Photo is the AR of the Photo Aggregate when PhotoInAlbum is part > of.
> Album a = Albums.Get(ida);
> Album b = Albums.Get(idb);
> AlbumOwner  o  = AlbumOwners.Get(oid);
> Photo p = Photos.Get(pid).
> Photo.Move(ida, idb, o);

Since OO modeling is about observing real world, then why the Photo is the responsable for moving itself
from one album to another, instead of the AlbumOwner being the responsable for the movement? 

Album fromAlbum = Albums.Get(ida);
Album toAlbum = Albums.Get(idb);
Photo photo = Photos.Get(pid).
AlbumOwner albumOwner = AlbumOwners.Get(oid);
albumOwner.Move(photo, fromAlbum, toAlbum);

I think both solutions represent the same in terms of business, under both approches you can register the
Album Owner performing the move and registering the transaction/event "movement", among other things
but the one you suggested is creates couple between a photo and its album. 

This will be an eternal discussion.
Kent Beck in its TDD book preferd to create examples using coupled objects, having the "Money" class and
letting that "Money" class know the "Bank" class. On the other hand I once talked to an Smalltalk with lot of
experience and he prefers designing pretty functional and less coupled objects saying Kent Beck design
is not a good design solution in its TDD book.

Move(Photo, FromAlbum, ToAlbum) {
FromAlbum.remove(Photo);
ToAlbum.add(ToAlbum);
Movements.add(new Movement(Photo, FromAlbum,, ToAlbum));
}

vs.

Move(FromAlbum, ToAlbum, AlbumOwner) {
FromAlbum.remove(this);
ToAlbum.add(this);
AlbumOwner.add(new Movement(this, FromAlbum,, ToAlbum)); //or this
}

But given your example, does a Photo know the Album that belongs to?

class Photo{
private Album album; 
}

?

Cheers,

------------------------------------

Nuno Lopes | 2 Dec 20:21
Picon
Gravatar

Re: Re: Adding entities to another, questions around basic example



Hi Sebastian,

Since OO modeling is about observing real world, then why the Photo is the responsable for moving itself from one album to another, instead of the AlbumOwner being the responsable for the movement? 

That is a very interesting question, that many have stumbled on and had opened many fierce debates (some of them philosophical) between soul mates :)

Quick answer 

"Because the the photo may be moves by many parties, not just the owner" :))))

You see, as the system evolves, other parties (say AlbumOwnerFriends) might be able to move photos around. Can you imagine implementing the move operation in each of them?

The operation of adding a photo to an album should actually be implemented by a Photo Role in context ... check bellow.

Long answer

People that invented the OO stuff decades ago where actually quite smart. From then on, many people wrote books and texts totally distorting the initial ideas due to lack of understanding, including myself (privately) and some current prominent DDD people. Since 2001 I decided to get back to basics due to several reasons.

One of the basics is that if you are making an operation over an object, give the object responsibility to make such operation.

This is spread all over well designed OO Frameworks (including some parts of MS.NET) yet a lot of people that I meet have difficulties using this basic OO vision in their models. Take a look at operator overloading, take a look at a collections (peoplecollection.Add(), strings (stringname.Concat(...)) etc etc.

So using this rule what is necessary to move a photo: Two albums (source, dest), a photo and a user. User is put of the question since the operation is done done specifically over it I would say (it is just a participant). Now we have the two Albums and the Photo. Either of the Albums  have many photos, further more, now it may only have photo, whose to say it might not have videos later? So we are up to the Photo, the most specific item of the three.

So if you are moving a Photo between album give the photo the responsibility to move itself. 

If you have two competing forces  for the operation, such as Album, User and Photo, have the most specific object participating in the  business event, i mplement or direct it. Sometimes its difficult to choose which is more specific but at least you did not went to the Human Role or the Collection directly.

Why is this good you may ask?

The quick answer above points to the reason ... FLEXIBILITY. You see, if the most specific object implements or directs the operation it can be changed locally with maximum effect. 

If we went for the other option we would to either re-implement in each kind Role of Person as the system grown in complexity (dumn designer) or put the code in a domain service and have every roles call it. The later is a smarter designer but not quite there in understanding and appreciation of OO.

Why is it not there?

Now is the fun part.  Double Dispatch is only a hack to fit in some dynamic behavior or to avoid some dependency injection. Double dispatch is an effective design pattern (including the visitor pattern) to all things concerned.

If you followed the principle above, double dispatch can be used to make some neat stuff, solving design problems that would be hard to solve otherwise.

Take for instance your Album, your Photo and your User. Take the use cases, If we drop a photo, either we move or we add the photo to the Album, if you drop an Album on a User we add the user as a AlbumOwnerFriend, if you drop the Album we add the user as a AlbumOwnerFriend. 

So i nstead of putting all this behavior in the Album we spread it amongst the most specific parties. If a new kind of item, as for instance Video comes in, we simply need it to implement the drop methods, double dispatch takes care of the rest :)


I wrote above:

"The operation of adding a photo to an album should actually be implemented by a Photo Role in context ... check bellow."

Strange design decision? Philosophical? No reallly.

Later if you want to abstract the album abilities to introduce for instance, Video, S tamps etc etc .....

class Album
{
     ....
     void Add(AlbumOfItem p, AlbumOwner u)
     {
          p.AddToAlbum(this, u) // double dispatch
     }
     void Add(AlbumOfItem p, AlbumOwnerFriend u)
     {
          p.AddToAlbum(this, u) // double dispatch
     }
}

class Photo :  AlbumItem
{
     ....
     void AddToAlbum(AlbumOfItem a, AlbumOwner u)
 & nbsp;   {
          ..... // you favorite business rule methodology .. I already gave examples of mine
     }
     void AddToAlbum(AlbumOfItem a, AlbumOwnerFriend u)
     {
          ..... // you favorite business rule methodology .. I already gave examples of mine     
     }
}

interface AlbumItem
{
     ....
     void AddToAlbum(AlbumOfItem a, AlbumOwner u);
     void AddToAlbum(AlbumOfItem a, AlbumOwnerFriend u );
}

All this made easy because you followed "blindly" a simple rule:

If you are making an operation over an object, give the object responsibility to make such operation.

Does this answer your question?

Cheers,

Nuno
PS: I strongly advise the SOM book. Full of design principles that are OO perls in the right hands.


__._,_.___


Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___
Nuno Lopes | 2 Dec 20:37
Picon
Gravatar

Re: Re: Adding entities to another, questions around basic example



Sorry sebastian, I wrote the previous post without reading it over. Full of errors. Hopefully this one is easier to read so please ignore the previous one. Have to stop this real time blog posts.


Since OO modeling is about observing real world, then why the Photo is the responsable for moving itself from one album to another, instead of the AlbumOwner being the responsable for the movement? 

That is a very interesting question, that many have stumbled on and had opened many fierce debates (some of them philosophical) between soul mates :)

Quick answer 

"Because the photo may be moved by many parties, not just the owner" :))))

You see, as the system evolves, other parties (say AlbumOwnerFriends) might be able to move photos around. Can you imagine implementing the move operation in each of them? For what reason?

The operation o f adding a photo to an album should actually be implemented by a Photo Role (Say AlbumItem) in context ... check bellow.

Long answer

People that invented the OO stuff decades ago where actually quite smart. From then on, many people wrote books and texts totally distorting the initial ideas due to lack of understanding most of the times. This including myself and some current prominent DDD people. Since 2001 I decided to get back to basics due to several reasons.

One of the basics is that if you are making an operation over an object, give the object responsibility to make such operation.

This is spread all over well designed OO Frameworks (including some parts of MS.NET) yet a lot of people that I meet have difficulties using this basic OO vision in their designs. Take a look at operator overloading, take a look at a collections (peoplecollection.Add(), strings (stringname.Concat(...)), all of these objects that we use daily have those operation not by chance. You see, they could have all be put in some domain service with double dispatch, library, or human role :). The question is why they where not and the answer follows.

So using this rule, what is necessary to move a photo? We have two albums (source, dest), a photo and a user. User is totally OUT of the question since the operation is NOT done specifically over it (it is just a participant). We are left with the two Albums and the Photo. Either of the Albums  have many photos, further more, now they may only contain photos, whose to say it might not have videos later? 

So we are up to the Photo, the most specific item of the three. If you are moving a Photo between album give the photo the responsibility to move itself (notice the principle?)

If you have two competing forces  for the operation, such as Album, User and Photo, have the most specific object participating in the  business event, implement or direct it. Sometimes its difficult to choose which is more specific but at least you did not went to the Human Role or the Collection directly.

Why is this good you may ask?

The quick answer above points to the reason ... FLEXIBILITY. You see, if the most specific object implements or directs the operation it can be changed locally with maximum effect. Furthermore, the other participants in the operation can be generalized with great effect.

If we went for the other option we would to either re-implement in each kind Role of Person as the system grown in complexity (dumn designer) or put the code in a domain service and have every roles call it. The later is a smarter designer but not quite there in understanding and appreciation of OO.

Why is it not there?

Now is the fun part.  Double Dispatch is NOT only a hack to fit in some dynamic behavior or to avoid some dependency injection. Double disp atch is an effective design pattern (including the visitor pattern) to all things concerned!

If we followed the principle above, double dispatch can be used to make some neat stuff, solving design problems that would be hard to solve otherwise.

Take for instance your Album, your Photo and your User. Take the use cases, If we drop a photo, either we move or we add the photo to the Album, if you drop an Album on a User we add the user as a AlbumOwnerFriend, if you drop the Album we add the user as a AlbumOwnerFriend. 

So instead of putting all this behavior in the Album we spread it amongst the most specific parties. If a new kind of item, as for instance Video comes in, we simply need it to impl ement the drop methods, double dispatch takes care of the rest :)


I wrote above:

"The operation of adding a photo to an album should actually be implemented by a Photo Role in context ... check bellow."

Strange design decision? Philosophical? No reallly.

Later if you want to abstract the album abilities to introduce for instance, Video, Stamps etc etc .....

class Album
{
     ....
     void Add(AlbumOfItem p, AlbumOwner u)
     {
          p.AddToAlbum(this, u) // double dispatch
     }
     void Add(AlbumOfItem p, AlbumOwnerFriend u)
     {
          p.AddToAlbum(this, u) // double dispatch
     }
}

class Photo :  AlbumItem
{
     ....
     void AddToAlbum(AlbumOfItem a, AlbumOwner u)
     {
          ..... // you favorite business rule methodology .. I already gave examples of mine
     }
     void AddToAlbum(AlbumOfItem a, AlbumOwnerFriend u)
     {
          ..... // you favorite business rule methodology .. I already gave examples of mine     
     }
}

interface AlbumItem
{
     ....
     void AddToAlbum(AlbumOfItem a, AlbumOwner u);
     void AddToAlbum(AlbumOfItem a, AlbumOwnerFriend u);
}

All this made easy because you followed "blindly" a simple rule:

If you are making an operation over an object, give the object responsibility to make such operation.

Does this answer your question?

Hope this post makes more sense.

Cheers,

Nuno


__._,_.___

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___
Nuno Lopes | 2 Dec 20:53
Picon
Gravatar

Re: Adding entities to another, questions around basic example

Code Correction:

class Album
{
     ....
     void Add(AlbumOfItem p, AlbumOwner u)
     {
          p.AddToAlbum(this, u) // double dispatch
     }
     void Add(AlbumOfItem p, AlbumOwnerFriend u)
     {
          p.AddToAlbum(this, u) // double dispatch
     }
}

class Photo :  AlbumItem
{
     ....
     void AddToAlbum(Album a, AlbumOwner u)
     {
          ..... // you favorite business rule methodology .. I already gave examples of mine
     }
     void AddToAlbum(Album a, AlbumOwnerFriend u)
     {
          ..... // you favorite business rule methodology .. I already gave examples of mine     
     }
}

interface AlbumItem
{
     ....
     void AddToAlbum(AlbumOfItem a, AlbumOwner u);
     void AddToAlbum(AlbumOfItem a, AlbumOwnerFriend u);
}

Cheers,

Nuno

------------------------------------

Rickard Öberg | 3 Dec 03:44
Picon
Gravatar

Re: Re: Adding entities to another, questions around basic example

On 2009-12-03 03.21, Nuno Lopes wrote:
>> Since OO modeling is about observing real world, then why the Photo is
>> the responsable for moving itself from one album to another, instead
>> of the AlbumOwner being the responsable for the movement?
>>
> That is a very interesting question, that many have stumbled on and had
> opened many fierce debates (some of them philosophical) between soul
> mates :)

And the reason is that while arguing whether to go through door one or 
door two, the real answer is to go through door three. Problem is, noone 
knew nr three even existed!

Before you read on, check this out:
http://www.artima.com/articles/dci_vision.html

Done? Then continue below.

> *Quick answer*
>
> "Because the the photo may be moves by many parties, not just the owner"
> :))))
>
> You see, as the system evolves, other parties (say AlbumOwnerFriends)
> might be able to move photos around. Can you imagine implementing the
> move operation in each of them?

We might also invent other types of collections, such as "Events" and 
"Last month". All of these would probably involve the interaction 
"moving photos around".

> The operation of adding a photo to an album should actually be
> implemented by a Photo Role in context ... check bellow.

Two important words above: role and context! But one thing is missing...

The main thing that is missing is the interaction, as a first-class 
concept. Then it would also be a good idea to have the context as a 
first-class concept. If we try to model this scenario according to the 
principles outlined in the article above we might get that:
* "Photo" as an object implements a "Movable" role
* "Album" as an object implements a "Container" role
* There is an OrganizerContext which has several roles that can be bound:
Container from;
Container to;
Movable item;
User user;

With this context we might then have an operation move() which takes the 
object bound to "item", takes it out of "from", and puts it into "to", 
but only if the "user" is allowed to modify both "from" and "to" 
Containers. Something like this:
public void move()
{
   checkPermission(user, from, "write");
   checkPermission(user, to, "write");
   from.remove(item);
   to.add(item);
}

Now that we have this context, where the interaction is explicitly 
shown, we have something that no OO-based software to date has ever had: 
readable code that maps to the users mental model! If we want to find 
out what "move" in the UI actually does, here it is. Instead of having 
to split up this functionality into tiny little pieces, strewn here and 
there in objects, we gather it into one place. And, since the objects 
are bound using roles, instead of classes, we can reuse this interaction 
for any case that involves "Containers" and "Movables".

There was a great presentation about DCI by Trygve Reenskaug (inventor 
of MVC pattern) at the last Öredev conference. I hope the video will be 
up soon, because it clarifies a lot about this, and why current OO, with 
the spread-things-out-everywhere approach, doesn't work.

Of course a big issue with all of this is that classes are not really 
useful for modeling objects anymore, as an object needs to be able to 
have a whole bunch of roles instead, depending on what interactions it 
wants to participate in. This is why a mixin-based approach, like Qi4j, 
is absolutely necessary. Other languages have this built-in, which is 
nice (although not necessarily helpful), but in Java the only way to do 
this properly (AFAIK) is by using Qi4j and Composite Oriented Programming.

/Rickard

------------------------------------

Jørn Wildt | 3 Dec 06:52
Picon
Favicon
Gravatar

Re: Re: Adding entities to another, questions around basic example

Richard, where would you place the "move" method? A service outside all of 
the objects?

> Now that we have this context, where the interaction is explicitly
> shown, we have something that no OO-based software to date has ever had:
> readable code that maps to the users mental model!

This style reminds me of the "command" pattern in a message bus: you have 
one single place that orchestrates the actions on objects you pass it.

It also reminds me of some passage in the DDD book (which I cannot quote 
exactly abd possibly got it wrong): if you have an operation that involves 
many parties without a clear place to implement it, then put it in a domain 
service.

I am no OO-guru myself and listen very interestingly to this debate. Thanks.

/Jørn

----- Original Message ----- 
From: "Rickard Öberg" <rickardoberg <at> gmail.com>
To: <domaindrivendesign <at> yahoogroups.com>
Sent: Thursday, December 03, 2009 3:44 AM
Subject: Re: [domaindrivendesign] Re: Adding entities to another, questions 
around basic example

> On 2009-12-03 03.21, Nuno Lopes wrote:
>>> Since OO modeling is about observing real world, then why the Photo is
>>> the responsable for moving itself from one album to another, instead
>>> of the AlbumOwner being the responsable for the movement?
>>>
>> That is a very interesting question, that many have stumbled on and had
>> opened many fierce debates (some of them philosophical) between soul
>> mates :)
>
> And the reason is that while arguing whether to go through door one or
> door two, the real answer is to go through door three. Problem is, noone
> knew nr three even existed!
>
> Before you read on, check this out:
> http://www.artima.com/articles/dci_vision.html
>
> Done? Then continue below.
>
>> *Quick answer*
>>
>> "Because the the photo may be moves by many parties, not just the owner"
>> :))))
>>
>> You see, as the system evolves, other parties (say AlbumOwnerFriends)
>> might be able to move photos around. Can you imagine implementing the
>> move operation in each of them?
>
> We might also invent other types of collections, such as "Events" and
> "Last month". All of these would probably involve the interaction
> "moving photos around".
>
>> The operation of adding a photo to an album should actually be
>> implemented by a Photo Role in context ... check bellow.
>
> Two important words above: role and context! But one thing is missing...
>
> The main thing that is missing is the interaction, as a first-class
> concept. Then it would also be a good idea to have the context as a
> first-class concept. If we try to model this scenario according to the
> principles outlined in the article above we might get that:
> * "Photo" as an object implements a "Movable" role
> * "Album" as an object implements a "Container" role
> * There is an OrganizerContext which has several roles that can be bound:
> Container from;
> Container to;
> Movable item;
> User user;
>
> With this context we might then have an operation move() which takes the
> object bound to "item", takes it out of "from", and puts it into "to",
> but only if the "user" is allowed to modify both "from" and "to"
> Containers. Something like this:
> public void move()
> {
>   checkPermission(user, from, "write");
>   checkPermission(user, to, "write");
>   from.remove(item);
>   to.add(item);
> }
>
> Now that we have this context, where the interaction is explicitly
> shown, we have something that no OO-based software to date has ever had:
> readable code that maps to the users mental model! If we want to find
> out what "move" in the UI actually does, here it is. Instead of having
> to split up this functionality into tiny little pieces, strewn here and
> there in objects, we gather it into one place. And, since the objects
> are bound using roles, instead of classes, we can reuse this interaction
> for any case that involves "Containers" and "Movables".
>
> There was a great presentation about DCI by Trygve Reenskaug (inventor
> of MVC pattern) at the last Öredev conference. I hope the video will be
> up soon, because it clarifies a lot about this, and why current OO, with
> the spread-things-out-everywhere approach, doesn't work.
>
> Of course a big issue with all of this is that classes are not really
> useful for modeling objects anymore, as an object needs to be able to
> have a whole bunch of roles instead, depending on what interactions it
> wants to participate in. This is why a mixin-based approach, like Qi4j,
> is absolutely necessary. Other languages have this built-in, which is
> nice (although not necessarily helpful), but in Java the only way to do
> this properly (AFAIK) is by using Qi4j and Composite Oriented Programming.
>
> /Rickard
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>

------------------------------------

Rickard Öberg | 3 Dec 07:40
Picon
Gravatar

Re: Re: Adding entities to another, questions around basic example

On 2009-12-03 13.52, Jørn Wildt wrote:
> Richard, where would you place the "move" method? A service outside all of
> the objects?

No, on the context object itself. The context is a 
instantiate-populate-invoke-discard type of object, so not a service.

But there are many ways to implement the basic pattern, and this is 
still being explored, so there's no right or wrong.

>> Now that we have this context, where the interaction is explicitly
>> shown, we have something that no OO-based software to date has ever had:
>> readable code that maps to the users mental model!
>
> This style reminds me of the "command" pattern in a message bus: you have
> one single place that orchestrates the actions on objects you pass it.

Except it's not really a single place. The methods for the interactions 
would be on the different contexts, which there would be many of. The 
contexts should map to the users mental model of the software, so it's 
hard to discuss them without understanding the UI.

> It also reminds me of some passage in the DDD book (which I cannot quote
> exactly abd possibly got it wrong): if you have an operation that involves
> many parties without a clear place to implement it, then put it in a domain
> service.

This is an extension of that realization.

> I am no OO-guru myself and listen very interestingly to this debate. Thanks.

Well, same here. I had a chance to talk to Trygve before his talk at 
Öredev (since I was doing a talk on how to implement DCI in Qi4j), and 
there were many new realizations coming just from those brief 
discussions. I think it might take awhile before we settle down on 
exactly how this pattern is to be implemented in different situations. 
The key point is that contexts and interactions should be their own 
thing, rather than being distributed into the objects themselves, which 
makes it very very hard to follow what's going on.

/Rickard

------------------------------------

Bhoomi Kakaiya | 3 Dec 13:37
Picon

Issuing commands



Hi,

Some context regarding my issue :
Domain Objects : TaxStructure : Kind of Tax Master. Having Tax Head and Percentage, like 12.5% etc.
                          BranchInfo    : Branch-Location collection. Tax is applied branch wise. Eg : VAT 12.5% is applied in State A,B & C.


I am dealing with rich UI so user wants a grid for data entry.

I see 2 options for updating anything in TaxStructure UI and sending commands, they are :

Option 1 : Send one command per Object, i.e One command for TaxStructure header, 3 commands for 3 different states, so a total of 4 commands.

Option 2 : Send only one command and in that send Collection of Branch Info's. Is it feasible to send BranchInfo's collection in TaxStructure's command DTO?

Which is the correct method to issue commands, or something else altogether!?

Thanks,
Bkak.



__._,_.___

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Gmane