Chapter 7. Let the Rules Rule


In the last chapter, we took a nice break and looked at some infrastructure preparations. Now we'll return to the core model for a chapter. This chapter is about rules.

The topic of rules is a huge one. We will deal with part of it, focusing mainly on validation rules. We will do it by addressing the requirements defined in Chapter 4, "A New Default Architecture," and add some comments where appropriate.

Looking back at the requirements list in Chapter 4 (the list will be repeated shortly), we can clearly see that the majority of the requirements have something to do with rules. As I see it, this is one area where Domain Models really shine. We can go quite a long way without needing a rules engine. As Evans says [Evans DDD], using several paradigms at the same time is problematic, so we are doing ourselves a favor if we can avoid mixing Domain Models with rules engines. (To give you a sense of how complex it can be to mix paradigms, that is why mixing OO and Relational models is so tricky.)

In my last book [Nilsson NED], there was a chapter called "Business Rules" in which I provided a bunch of example problems related to where to locate the rule evaluation. For some reason, almost all the examples ended up being checked in the database. Yet that was from my database era, and now I'm a Domain Model guy, so you will find that this chapter is totally different. Is that for the better? I definitely think so, and I hope you will agree.

OK, where shall we start? How about some categorization of rules?




Applying Domain-Driven Design and Patterns(c) With Examples in C# and  .NET
Applying Domain-Driven Design and Patterns: With Examples in C# and .NET
ISBN: 0321268202
EAN: 2147483647
Year: 2006
Pages: 179
Authors: Jimmy Nilsson

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net