Reputation: 35774
When transferring an object from one system to another, both with completely different representations of the same concepts, are there any common solutions to this?
In my specific case I am taking an order from an ecommerce web application and moving it to a warehouse/crm system.
The order contains data from different source models in the web application order, customer, order item, shipping address. In some cases there is a simple field name change to be completed. But in other cases there are some more complex transformations and logic when moving a field. For example, vat/tax codes must be mapped depending on the tax percentage and shipping country.
Upvotes: 0
Views: 245
Reputation: 5101
Generally,
Sounds like you'll be doing lots of adapting. However you might have one or more facades to facilitate the transliteration process.
My experience dealing with this sort of thing was not a literal adherence to the pattern but was adapter-esque. Patterns are concepts first.
I did some "wishful thinking" design - new classes focused for the needed task. These processing classes used a common "typeX" for data objects. Kind of a lowest common denominator class. Then created these "typeX" objects from both the incoming records and the associated records on the receiving side. Lots of good design, testability, code maintenance qualities resulted from the fresh design using a single DataType.
In the depths "typeX" objects must be dealt with in their original, native type but this tended to be isolated "at the ends". Nonetheless, during processing the matching, finding, sorting, etc. "typeX" objects profoundly simplified all but the most necessarily detailed grunt work.
Upvotes: 1