Design – Mixing Fowlers Transaction Script and Domain Model

designvb.net

I am developing a large application where the previous developer used Martin Fowlers Transaction Script pattern.

The requirements are becoming more complex and it is becoming a bit of a maintenance nightmare. Therefore I have started to use Fowlers Domain Model and Table Data Gateway in an attempt to separate concerns and reuse code. It is becoming a refactoring process.

My question is: is it bad practice to mix and match patterns? e.g. using Transaction Script and Domain Model in the same application or is this relatively common practice?

Best Answer

It is fine to mix domain logic patterns. A large system can be broken down into modules with domain logic patterns selected based on complexity of each module e.g. Complex stuff - Domain Model Pattern and simple stuff can use Transaction Script. If then you find some simple modules are beginning to become complex you can refactor to the domain model pattern. I cover this in a book I am writing at the moment https://leanpub.com/Practicing-DDD

Related Topic