5

I have seen this problem a few times and never can come up with a solution i like.

System A
    Sales Order Entity
        order_id
        created
        line_items_count

System B
    Sales Order Entity
        sales_order_id
        created_At
        num_line_items

The problem is, that sales orders are created in System A - for example an e-commerce website. The sales orders need to be exported and stored in another system, for example a warehouse system - System B. They both store the same data but under different field names.

Is there a design pattern or collection of patterns typically used to solve such problem?

I always end up with an associative array containing the mapped fields - but it feels like there must be a better solution.

In the example above, not only sales orders might require this, also customers, products, inventory levels etc - so a generic pattern would be best.

1
  • How do the systems communicate when you need to map data?
    – astreltsov
    Sep 26, 2015 at 7:44

2 Answers 2

2

Though probably not recognised as a design pattern, what you describe would be called a Mapper.
It translates one object into another.
Implementations can be found at AutoMapper.org and at CodeProject.

0

The Web Ontology Language (OWL) implements a description logic with sameAs and other relations between descriptions of entity types as a solution for this problem. 'Description logic' is arguably the design pattern for two-way mappings, as other representations are sub-sets of what a description logic can describe.

If the mapping is single way, then there are many transformation languages in which it can be specified, for example XSLT if the data has an XML representation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.