What relationship describes two different abstractions of the same dataset

I am wondering if there is a specific term for when multiple representations are data equivalent. Meaning that you can transfer the data from one representation to the other without any loss of data.

Like an in-memory object model that can be read from data files with the guarantee that if you deserialize and then serialize, that the files you started with and the files you ended up with will be equivalent.

There are a couple of laymen descriptions that come to mind: “roundtrip safe”, “1 to 1 representation”, “ORM”, “Non-leaky abstraction”…..

I thought the term homoiconic would apply. But, apparently, homoiconicity has to do with equal representation, not equal data.

I think you’re looking for isomorphic.

An “isomorphism” is a 1-to-1 structure-preserving mapping between two sets of objects. Two objects are said to be isomorphic if a given isomorphism maps them to each other.

This concept usually corresponds to our intuition that the two sets are “different representations of the same thing”, including the fact that anything you can do with one representation you can just as easily do with the other.


For completeness: The “structure-preserving” part means that any relation which is true of two members in one set must also be true of the corresponding members of the other said. Since that’s a bit abstract, consider the set of integers and the set of strings representing integers (without leading zeros or scientific notation or anything else that’d make them non-1-to-1). The set of integers has a greater than relation. We can define a similar greater than relation for the set of strings representing integers. Now, if we choose the obvious mapping that matches 3 to “3” and so on, then this relation is preserved since whenever x > y it’s also the case that stringGreaterThan(string(x), string(y)) is true. If we choose a silly mapping that matches 1 to “3” and 2 to “-42” and so on, there are many cases where x > y but stringGreaterThan(string(x), string(y)) is not true, which means that mapping is not an isomorphism.


P.S. In programming “isomorphic” sometimes has a completely different meaning, namely code that can run on either the client or the server without alteration. But it should be very obvious in context whether you’re talking about the 1-to-1 mapping or the client-or-server code.

1

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *