In studying domain-driven design (DDD), I've come across the concept of subdomain, but I think I don't get it yet. My first understanding of this was that a subdomain is a subset of the domain of the application. In other words, it's a partition of the problem space. I've read that there are three types of subdomain:
- core subdomains
- supporting subdomains
- generic subdomains.
My understanding was somewhat like this: We pick the domain of the application, and it is quite complex. Then we look at it and we figure out a way to partition it into simpler pieces, some of which would be core subdomains and some of which would be supporting, while others would be generic.
In searching for more information, I've found some people saying something different: That just one core subdomain exists, along with some generic subdomains and no supporting subdomain whatsoever.
So my questions are:
- What are subdomains, really? Is my first understanding the correct one, or is it the second thing I read?
- How is this idea of subdomains useful?
- What are some good criteria for identifying subdomains? What should we have in mind when deciding on subdomains in order to make better use of this idea?
EDIT: Searching a little more, I found the following:
Think of an e-Commerce system. Initially you can tell that it is an application of a shopping context. If you look more closely, you will see there are other contexts too, such as Inventory, Delivery, Accounts, etc.
This is what I initially thought a subdomain was. We pick a domain (the shopping domain) and break it down into simpler subdomains (inventory, delivery, accounts, and so on). But in the text in question, they refer to these as contexts. So is my former understanding not subdomains but contexts?
I've found one question here on this site about the difference between a subdomain and a bounded context. The answer states that subdomains are a partition of the problem space, while contexts are partitions of the solution space. Yet, separating the shopping context into inventory, delivery, accounts, etc, is not a conceptual partition. That is, is it in the problem space rather than the solution space?