Inconsistent Models
Let’s go back to the example of a telemarketing company from Chapter 2. The compa‐ ny’s marketing department generates leads through online advertisements. Its sales department is in charge of soliciting prospective customers to buy its products or services, a chain that is shown in Figure 3-1.
![]() |
Figure 3-1. Example business domain: telemarketing company
An examination of the domain experts’ language reveals a peculiar observation. The term lead has different meanings in the marketing and sales departments:
Marketing department
For the marketing people, a lead represents a notification that somebody is inter‐ ested in one of the products. The event of receiving the prospective customer’s contact details is considered a lead.
Sales department
In the context of the sales department, a lead is a much more complex entity. It represents the entire lifecycle of the sales process. It’s not a mere event, but a long-running process.
How do we formulate a ubiquitous language in the case of this telemarketing company?
On the one hand, we know the ubiquitous language has to be consistent—each term should have one meaning. On the other hand, we know the ubiquitous language has to reflect the domain experts’ mental models. In this case, the mental model of the “lead” is inconsistent among the domain experts in the sales and marketing departments.
This ambiguity doesn’t present that much of a challenge in person-to-person commu‐ nications. Indeed, communication can be more challenging among people from dif‐ ferent departments, but it’s easy enough for humans to infer the exact meaning from the interaction’s context.
However, it is more difficult to represent such a divergent model of the business domain in software. Source code doesn’t cope well with ambiguity. If we were to bring the sales department’s complicated model into marketing, it would introduce com‐ plexity where it’s not needed— far more detail and behavior than marketing people need for optimizing advertising campaigns. But if we were to try to simplify the sales model according to the marketing world view, it wouldn’t fit the sales subdomain’s needs, because it’s too simplistic for managing and optimizing the sales process. We’d have an overengineered solution in the first case and an under-engineered one in the second.
How do we solve this catch-22?
The traditional solution to this problem is to design a single model that can be used for all kinds of problems. Such models result in enormous entity relationship dia‐ grams (ERDs) spanning whole office walls. Is Figure 3-2 an effective model?
Figure 3-2. Enterprise-wide entity relationship diagram
As the saying goes, “jack of all trades, master of none.” Such models are supposed to be suitable for everything but eventually are effective for nothing. No matter what you do, you are always facing complexity: the complexity of filtering out extraneous details, the complexity of finding what you do need, and most importantly, the com‐ plexity of keeping the data in a consistent state.
Another solution would be to prefix the problematic term with a definition of the context: “marketing lead” and “sales lead.” That would allow the implementation of the two models in code. However, this approach has two main disadvantages. First, it induces cognitive load. When should each model be used? The closer the implemen‐ tations of the conflicting models are, the easier it is to make a mistake. Second, the implementation of the model won’t be aligned with the ubiquitous language. No one would use the prefixes in conversations. People don’t need this extra information; they can rely on the conversation’s context.
Let’s turn to the domain-driven design pattern for tackling such scenarios: the boun‐ ded context pattern.