Re: Where to place logic for cleaning up data from an external system
Dennis Traub <[email protected]>
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <CAJw46f67ELx05hL4tJ9nK18u4t5hgRU+oUJ0nQ9b0pzZf33n6w@mail.gmail.com> |
Hi, I think the ACL is responsible for transforming the incoming data into domain objects that are stripped off anything that doesn't have to do with the domain. Cleaning fields is an infrastructural issue, and infrastructure should not leak into your model. Cheers Dennis -- Dennis Traub Software Development Consultancy Am Bogen 7 33178 Borchen Phone: 05293/73942-73 Fax: 05293/73942-74 Mobile: 0170/2842385 Mail: [email protected] <[email protected]> On Fri, Apr 5, 2013 at 5:07 PM, triashill <[email protected]> wrote: > ** > > > *Description of the system:* > The system basically processes messages from an external system. > > *The way i have modeled the system is :* > 1. I created an *anti corruption layer* that receives the messages (swift > messages) from an external system. The ACL also has a reponsibility for > cleaning up the data, then lastly, the ACL sends the messages to the domain > services for processing. > 2. I have the *actual domain*, that processes these messages, does some > calculations etc. > > I am having problems with figuring out where to put the logic for > 'cleaning' the data that is in the swift messages. > > *Swift Message:* > Each swift message is just a BLOB of text containing a various *fields*and their respective > *Values* > * > * > *{* > * :field1://value 1 **** > * :field2://value2!!* > *}* > * > * > * > * > So likewise i have an entity called Message, which contains *a list of > fields. *The problem i am facing is transforming the BLOB of text into a > Message entity. This is because each field needs to be extracted > differently from the next. So in the example above, > the value of field1 must be *value 1*, without the ****,* > the value of field2 must be *value 2, *without the *!!* > * > * > In total, there are 4 different fieldTypes. *So my question is*, where do > i put the logic to clean up the fields, > > 1. do i put it in an external 'service' that has an if statement to clean > each field differently? > 2. Do i put the logic for cleaning in the Field Value object itself, so > each field knows how to clean itself > > > And does all this logic sit in the ACL or it moves to the domain. I get a > sense that the logic for cleaning external data must not sit in the omain, > because it has no business sitting there. > > public class Message: Entity<long> > { > public IList<Field> Fields{get; set;} > } > > public class Field: ValueObject > { > string Tag {get; set;} // this is what it looks for in the swift message > BLOB of text from the external system > string Value {get;set;} > } > > >