Consider two facts of a typical organization:
- Some entities are very common (for example
Orderin a point of sale system)
- Some entities may have complex relationships (for example
Ordercould have a list of
Payment method, the
Addresscustomer and such)
Suppose the organization has many micro-services (REST / json) and they all require the transfer of data of similar types.
For example. service 1 could receive a
Order client, then send the same order to the service 2 that is processing the request, before sending the
PaiementModdod to the client.
Suppose that these can be easily shared and that this sharing would significantly reduce the time needed to create and maintain the exact same models in multiple locations, possibly including the surrounding code (for example, validation). Let me know if you feel that this assumption is not valid for any reason.
- What are the disadvantages, if any, of sharing the model between the parties?
- If the model is not to be shared, does this mean that we are duplicating almost the exact same entities (or at least the required subsets) in each part or are there better approaches?