Where to map external to internal datamodel in 4Layer Architecture

Hi all,

I'm learning about architecture and am making a first attempt at using the appropriate layers.

So I'm integrating with an external API and store my own copy of the data.  I've got the following modules so far

Core layer

one or more _CS modules, with business entities

_Sync module

  • call operations exposed by _IS module, getting back data in IS structures
  • call operations on the _CS modules to store data in the business entities
  • timer to do the synchronisation
  • entities to store information about synchronisations

Library Layer

_IS module

  • consumes REST API
  • public structures to represent parameters and API response
  • public actions with input and output parameters in IS structures

So my first question I run into : my business entities have a fundamentally different structure than the API structure.  So I'm thinking of doing the mapping between these 2 data models inside the _Sync module.

  • This is the one where there is already awareness of both the _IS module and all the _CS modules
  • The _IS module should not be aware of any business layer stuff, so I think that data model should stay as close as possible to the actual API content and structure
  • I would like to isolate the _CS modules from having to know anything about the _IS module (though this is not a strict rule in architecture best practices ??)

But is this indeed what normally would be done, or would there be some sort of _Map modules taking care of translating data between different data models ?

I think I came across some descriptions, saying that the Integration module also "normalizes" the data retrieved from external systems, I'm not sure but that sounds a bit like doing some transformations on it to better fit our internal data model.  But to me that feels a bit like we are allowing the Library layer, that should be business agnostic, become to some level dependent on the business layer ??

 Any insights from real life projects ?

If you made it here, thanks for reading through the long post,


Hi Dorine,

I wouldn't think that  a _Map module is needed for that. Indeed, mapping should be done during synchronization, hence in the _Sync module.