Before I would ask my question, here is the context: I am working on one part of a relatively big software. In its simplest form there are 3 layers of the software lets call them lower layer, middle layer and top layer. I am working on the middle layer. The job of middle layer is very simple, retrieve the information from lower layer and deliver it to the top layer. It also can receives various requests from top layer and perform actions on the lower layer and provide the feedback to the top layer.
The lower layer is a third party component, hence we agreed on a data model that would be common between middle layer and top layer. These two layers communicate over a proprietary inter process communication protocol. The data model is delivered as part of the framework containing the libs for proprietary comm protocol (hence, the headers containing the models use the namespace of the framework and not the middle layer).
My approach: The way I implemented was to directly use the data model throughout the middle layer, though it used the namespace of the comm protocol, as I consider it the data model of middle layer. So, I would directly read the data from the lower layer into the data model, send it through various sub-layers within the middle layer and to the top layer over the comm protocol.
One of my colleagues criticised my approach, arguing that it is the data model of the comm layer and what if the comm layer changes tomorrow or is replaced with another one, I will have to replace every single instance where I used it through out the middle layer. So, he suggested to use an internal data model which would be used to read from the lower layer and send this model to the point where I send the data over the comm layer to the top layer. Before sending the data I should performing the data mapping to the comm layer data type.
I don't believe he is right, as it is the data model of the middle and I had defined it myself. Only because it has to be sent over the comm layer, it is delivered with the framework hence has a namespace of the framework. But, that does not make it the comm layer data type. Moreover, if the comm layer and hence the namespace changes, it wouldn't be a big problem, as I can solve this problem with just a simple define.
So, the question after a very long story: Does it really make sense to perform mappings with the layer itself? How do you look at the situation?