--
Adam
http://adventuresinagile.blogspot.com/
http://twitter.com/adymitruk/
http://www.agilevancouver.net/
http://altnetvan.grou.ps/
Here's what I do, usually, in Qi4j-land. First off, in situations where
there is likelyhood that the properties will be expanded (e.g. contact
info for a user) I usually use value objects to convey them. This value
gets put into the command, event, and snapshot state. And so, for me the
change boils down to adding this to the value class:
Property<String> myNewProperty();
Done.
/Rickard
Chris
Yeah, you need to get a feel for when you have a situation where the
fields are likely to expand later. For example, the contact info is an
obvious one where you can add any number of fields really. Knowing when
to do what is just based on experience, I think.
/Rickard
Cheers,
Nuno
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
Xsd actually works very well for this (using a tool to create them... Not by hand). We were doing the creation of these as part of our estimation proces
You could also check out steve sanderson's T4 scaffolding project. Using the powershell host you can add files, classes, members etc. to a variety of files. Steve's demos just show ef4 and mvc, but it's built upon a generic framework. You get access to the project files and so on so you're now just at the conceptual level of templatizing "add a member to these four classes".
For situations like these, we'll try to rely on conventions if possible to reduce pointless wiring.
1. Encapsulate the trivial data properties into a single object (you
can call it a value object but it's really more of a DTO) that is part
of the command. Something like ProductValues.
2. This DTO is passed directly to the aggregate root in a single
behavior Product.UpdateValues(ProductValues values) I know that's
terrible for DDD, but again we aren't really dealing with much
behavior related stuff in these changes. These changes are arguably
of little business value.
3. The Aggregate Root's trivial data values are then applied by a
single event which contains a "difference" object representing what
changed. This is somewhat consistent with the version control model
for changes to a document this is managed as a fairly dynamic such
that we can expand or contract the concept without affecting our
history.
I feel this approach allows trivial data changes to be managed and
refactored quickly and dynamically without a lot of ceremony and
avoids even the need for code-gen, leaving most of the other events
focused on communicating state changes that are of clear business
value.
Chris
Yeah, I name mine *DTO. *Value I reserve for purely internal values that
can have some logic in them.
> 2. This DTO is passed directly to the aggregate root in a single
> behavior Product.UpdateValues(ProductValues values) I know that's
> terrible for DDD, but again we aren't really dealing with much
> behavior related stuff in these changes. These changes are arguably
> of little business value.
>
> 3. The Aggregate Root's trivial data values are then applied by a
> single event which contains a "difference" object representing what
> changed. This is somewhat consistent with the version control model
> for changes to a document this is managed as a fairly dynamic such
> that we can expand or contract the concept without affecting our
> history.
>
> I feel this approach allows trivial data changes to be managed and
> refactored quickly and dynamically without a lot of ceremony and
> avoids even the need for code-gen, leaving most of the other events
> focused on communicating state changes that are of clear business
> value.
+1. Although I did XDoclet way back in EJB land, nowadays I try to stay
away from codegen as much as possible.
/Rickard
In my case there's a bit of crud, there's a bit of places where
CQRS/EventSourcing is really needed, but having CQRS/EventSourcing for
everything makes much more sense, in spite of the pockets of CRUD.
/Rickard
Just reading this thread made me wonder if in some cases we're ending
up with complex solutions to simple problems.