# What is an isomorphism?

This is an episode of *The Eric Normand Podcast*.

Subscribe: RSSApple PodcastsGoogle PlayOvercast

An isomorphism is a one-to-one mapping from two sets, and encoding your domain model involves finding a mapping between the real world and your code. So does domain modeling involve isomorphism?

## Transcript

[00:00:00] What is an isomorphism and why is it important to domain modeling?

[00:00:07] Hello, my name is Eric Normand and this is my podcast. Welcome.

[00:00:14] I have been reading some mathematics recently. I wanted to understand: Is isomorphism really one of the things I'm talking about when I'm talking about a high fidelity encoding of a conceptual model? Are we talking about an isomorphism?

[00:00:35] An isomorphism is a set of mathematical objects that are in a certain relationship to each other where you can translate from one to the other and back with no loss of information. It's a one-to-one mapping from one set to the other set.

[00:00:57] There's seven days and they're in a certain order. So you can map them to the numbers one through seven because there are seven of them and they're in an order. And if you make Monday one, then Tuesday is obviously two, et cetera. And you can go back and forth between those.

[00:01:15] We do that kind of thing all the time. I think that this idea is important and I want to explore why. It's not exactly right. Very often we don't get that one-to-one mapping that we're talking about.

[00:01:31] I'm trying to explain what we do precisely, and I'd hate to use the term *isomorphism* if I'm not using it absolutely correctly, because it is a mathematically precise term.

[00:01:49] In the ideal case, we do have a one-to-one mapping with no leftover states. Cause that's what we're dealing with when we're modeling, is the number of states. There are no leftover states, there's no missing states, and there's no confusion really of of which state corresponds to which encoding. But that's not always possible.

[00:02:14] And so we can't use the mathematics of isomorphism because there's a lot of properties of isomorphisms that only work if you have 100% fidelity, a hundred percent, one-to-one mapping between the two different types. But there's something really interesting going on that's probably not gonna wind up in my book. But there's something interesting there where software is not as precise as math, but that's kind of an advantage because we can do mappings that aren't so perfect that they become an isomorphism.

[00:03:04] It's hard to prove properties about them. But we trade that off for being able to, first of all, model more things, but secondly there's a trade off that we can actually run the thing and in a way do kind of an empirical test , an experiment instead of proving something with mathematical certainty.

[00:03:27] You can prove it with a kind of empirical certainty, right? We can probe it and test it. Does it perform correctly despite the fact that it's not a perfect mapping, so you can still even test all of the properties you might be interested in from isomorphism and get a subset of them.

[00:03:51] I haven't done enough reading because now I think: has this been done in mathematics? Is there a kind of isomorphism minus one or two properties, where you could say, well, there's an imperfect mapping, what properties do you get out of like an 80% mapping versus a 90% mapping versus a hundred percent mapping? That might be interesting if someone has done that, but it's really making me think about one of the values of software. It produces an artifact that doesn't have to be mathematically perfect in order to be practical.

[00:04:37] Mathematics also gives you an ideal end point. This is the perfect state that your encoding can be in, a one-to-one mapping and it has all these properties when you get there. But there are many properties that are useful even if you never get there. One of the biggest properties is that you can actually do useful work with the software.

[00:05:03] My name is Eric Normand. This has been another episode of my podcast, as always, rock on!