Why domain modeling?

We explore why focusing on the domain model can improve your software quality.

Transcript

[00:00:00] Why domain modeling?

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

[00:00:10] So we've been talking about domain modeling and the what and the how of it. But there's this question of why would we even do it in the first place. And that's what I wanna talk about today. So I have this hypothesis, or a thesis, or I don't know what it is, technically. It's a hope. It's a guess.

[00:00:37] Bad software or poorly designed code is not because of some moral failing, cuz it seems like that's what most people back into is that, oh, we're writing bad software. We should refactor more, we should do this, we should do that. And I'm not sure if I agree with [00:01:00] them that there's some moral component to it.

[00:01:06] From what I've seen, people are working really hard. So you can't fault them for not trying. But still people think that our software could be better designed. And I, I generally think that too. I look at software and I think, Wow, this needs a lot of work. So given that our software is, is poorly designed, I think if we attack it from a design perspective, we're just going to take the artifact that we have and try to re reshape it, reframe it, move it, reorganize it, clean it up.

[00:01:47] And my thesis is that that won't work. That will only get you so far. That really the problem is that our [00:02:00] initial model, the core of our software, is poorly thought through. So the thesis is this: stated simply, that if we focus more on the content, on making sure that our, domain model encodes a good conceptual model and encodes them well, that that is what will allow our software to be better designed.

[00:02:39] It's only one aspect of the content, right? Another content is sort of the work that needs to be done, but when you get the data model correct, it's much easier to do the work correctly. That's another hope [00:03:00] and guess, but I think other people share this sentiment, so I have some feeling of it having a ring of truth to it.

[00:03:09] All this is pure speculation. I hope that that's clear, that there's no hard evidence for this.

[00:03:16] But again, my hope is that we can stop having these discussions about how best to name your functions and how to refactor things to be clearer, and instead talk more about whether the thing is, is modeling what it's modeling and whether it's modeling it well. And if we get back down to those core things and then focus on the clarity. It's that thing that we just said: what the conceptual model should be and what the data [00:04:00] encoding should be. Is that just being expressed plainly and simply? I think that we would have a better chance of writing well designed software.

[00:04:11] It's like someone has a novel that they've written and they go to get it critiqued to make it better, but all the stuff that they get told is like their sentence structure and their style and their choice of vocabulary, and they never talk about plot and character and the story. They're not getting down deeper. Oh, you made a typo here. Oh, like maybe use this word instead of that word. I think it's a better word.

[00:04:47] I feel like that's how our discussion of software design tends to go. Oh, this method, I think it would be better if it was over here and wouldn't it [00:05:00] be nice if you used this pattern instead of this pattern? To me it's just very much missing the essence of what makes software good.

[00:05:10] All right, so that's my why. Domain modeling is one aspect-- understanding the domain and then being able to encode it-- that is one very important aspect of writing good software. That's why: Your software will be better and not just in a superficial way, like if you just made a better design.

[00:05:35] Not saying design's not important. Style and wording of a novel, very important, but if your characters are terrible, better style is not gonna help. No one's gonna read your novel.

[00:05:49] All right. My name is Eric Normand. This has been another episode of my podcast. Thank you for listening, and as always, rock on!