核心域可以跨越多个有界上下文吗? [英] Can Core Domain span multiple Bounded Contexts?

查看:74
本文介绍了核心域可以跨越多个有界上下文吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1)

Evan的书,第pg。 415:

Evan's book, pg. 415:


此外,域模型的关键方面可能跨越多个
有界上下文,但根据定义,这些不同的模型可以

Also, the critical aspects of the domain model may span multiple Bounded Contexts, but by definition these distinct models can't be structured to show their common focus.

a)我认为报价暗示着 Core域 CD 可以跨越几个有界上下文 BC

a) I assume the quote is implying that Core Domain CD can span several Bounded Contexts BCs?

b )我认为 CD 中的 BC 应该只包含核心元素,而没有通用元素?如果是这样,这是否意味着我们应该始终在考虑核心域的情况下设计 BC CD 中包含的那些)?换句话说,在开始设计 BC 之前,我们应该大致了解 CD 是什么?

b) I assume BCs within CD should only contain core elements, but no generic elements? If so, doesn't that mean we should always design BCs ( those contained by CD ) with Core Domain in mind? In other words, we should have some general idea what CD is even before we begin designing BCs?

c )


...但是根据定义,这些不同的模型无法构造为
显示其共同焦点

... but by definition these distinct models can't be structured to show their common focus

我意识到 BC 的结构不应使外界能够立即弄清楚所有部分(即 BC )相互配合,以及它们的共同目的是什么,但作者暗示这种结构(将隐式传达不同 的共同目的)偶然发生?如果是,为什么?

I realize that BCs shouldn't be structured such that outside world would be able to immediately figure out how all the parts ( ie BCs ) fit together and what their common purpose is, but is author implying that such a structure ( which would implicitly convey the common purpose of different BCs ) couldn't happen even by accident? If so, why?

2)域模型可能有几个通用子域 GSs ,但单个 GS 是否可以跨多个 BC

2) Domain Model may have several Generic Subdomains GSs , but can a single GS span multiple BCs?

更新:

1)

b)



我假设CD中的BC应该只包含核心元素,而没有
通用元素? ...

I assume BCs within CD should only contain core elements, but no generic elements? ...

当然应该知道
定义BC时核心域是什么。如上所述,理想情况下,它们应该是一对一的。但是,可以将
BC定义为满足非理想
状态下系统的需求。

One should certainly have an idea of what the core domain is when defining BCs. As stated, ideally, they should be one-one. However, a BC may be defined to fulfill needs of of a system in a non-ideal state.

我认为您是在暗示,在非理想情况下, CD 中的 BC 也可能包含某些非核心元素 -理想情况 CD 可能包含多个 BC

I assume you're implying that in non-ideal situation BC within CD may also contain some non-core elements and also in non-ideal situation CD may contain more than one BC?

c)


一个域跨越多个BC,但是尽管有明确的界限,但域
的行为当然可以跨越BC。上下文地图可以描述这种
跨BC的交互。报价单本身基于
域愿景声明的思想,其目的是强调核心域的价值
并可能解释与BC的关系。

A domain spans multiple BCs but despite explicit boundaries, domain behavior can certainly span BCs. A context map can describe such cross-BC interactions. The quote itself is based around the idea of a domain vision statement the purpose of which is to highlight the value of the core domain and possibly explain the relationship to BCs.

但是为什么作者使用术语 按定义,似乎暗示没有办法 BCs >也可能会意外地构造为使其显示共同焦点

But why is author using the term "by definition", as if to imply there is no way that BCs could accidentally also be structured such that they would show their common focus?

2)



域模型可能具有多个通用子域GS,但是
单个GS可以跨越多个BC吗?

Domain Model may have several Generic Subdomains GSs , but can a single GS span multiple BCs?

多个 BC 可以利用单个通用子域。在这里,我会避免
使用跨度一词,因为这过分强调了通用子域对整个域模型的重要性。

Multiple BCs can make use of a single generic sub-domain. I would avoid the term "spans" here because that overemphasizes the importance of the generic sub-domain for the entire domain model.

a)


多个BC可以利用单个通用子域

Multiple BCs can make use of a single generic sub-domain

不确定我能理解您的答复。您是说 GS 可以包含多个 * BCs *吗?

Not sure I understand your reply. Are you saying that a single GS can contain multiple *BCs*?

b)


在此我避免使用术语 spans,因为这过分强调了通用子域对
的重要性整个域模型。

I would avoid the term "spans" here because that overemphasizes the importance of the generic sub-domain for the entire domain model.

也许这是一个无用的问题,但是您能否详细说明为什么使用术语 span 是否会使通用子域显得比实际更重要?

Perhaps a useless question, but could you elaborate on why using the term "span" would make Generic Subdomain appear more important than it actually is?

回复给Giacomo Tesio:

1)

b)


不,某些通用元素通常在核心域中发挥关键作用。
例如,请参见许多
共享内核中存在的时间,货币和金钱:它们确实是通用的,但对核心
域规则很重要。

No, some generic elements often play a key role in the Core Domain. See for example Time, Currency and Money that are present in many Shared Kernel: they are really generic but important to the Core Domain rules.

因此,如果 Core Domain 也使用 通用元素(例如Time,Currency和Money),则仅实现选项是 Shared Kernel (即,该通用元素 Core Domain 和任何其他 subdomain 共享) ),但是如果 Core Domain 使用通用元素,那么我们就不必为 Shared Kernel ,但应该直接在核心域中定义此通用元素

So if generic element ( such as Time, Currency and Money ) is also used by Core Domain, then only implementation option is Shared Kernel ( ie this generic element is shared by both Core Domain and any other subdomain(s) that needs it ), but if generic element is used only by Core Domain, then we shouldn't bother with Shared Kernel, but should instead define this generic element directly within Core Domain ?

1)


c)上下文边界是根据术语的语义定义的。在卑诗省,
一词的含义不只一件事(请参阅SRP)。当您看到
类在域专家的脑海中具有多个含义时,您会知道
您混合了不同的BC。

c) Context boundaries are defined after term's semantics. In a BC, no term should mean more than one thing (see SRP). When you see that a class has more than one meaning in the domain expert's mind, you know that you have mixed differnt BC.

由于我无法理解您的答案与我的问题有何关系,您能否扩大答案范围?

Could you expand on your answer a bit, since I fail to understand how your answer relates to my question?

第二次更新:

1)

b)


也可能是单个BC包含多个子域。这通常是不理想的
,因为它可能表示BC混淆了。

It may also be that a single BC contains multiple sub-domains. This is usually not ideal because it likely indicates a conflated BC.

在读书时,我没有付款非常注意作者对 subdomain 一词的用法,但我可以肯定的是,这本书并未对 subdomain 的定义提供详尽的定义。那么到底什么才是子域?只是一堆与逻辑相关的领域概念?如果是,那么我认为子域应该永远不会跨越几个 BC

When reading the book, I haven't pay much attention to author's usage of the term "subdomain", but I'm pretty certain that the book doesn't offer a thorough definition of what a subdomain is. So what exactly is considered a subdomain? Just a bunch of logically related domain concepts? If yes, then I assume a subdomain should never span several BCs?

2)

a)


一个Signal GS可以被多个BC使用。之所以这样,是因为
子域是通用的。因此,GS不包含BC。

A signle GS can be used by multiple BCs. This is so because the sub-domain is generic. So the GS doesn't contain the BCs; instead, it is referenced by the BCs.

从您的回复中,您似乎暗示着 Generic子域永远不会实现为 BC ?为什么不呢,因为在我看来,不同的通用子域可能包含独特的模型 BCs 似乎是分离这些通用模型的理想解决方案 ?!

From your reply it seems you're implying that Generic Subdomains are never implemented as BCs? Why not, since in my opinion different Generic Subdomains may contain distinct models and BCs seem ideal solution to separate those generic models?!

3)
您是否也可以帮助我解决以下问题,因为这使我很困惑:如果是通用元素(例如时间,货币和金钱) )也被 Core Domain 使用
,那么只有实现选项是 Shared Kernel (即,该通用元素是共享的由核心域和其他任何需要它的子域),但是如果仅仅使用通用元素 通过 Core Domain ,那么我们就不必为 Shared Kernel 烦恼,而应该直接在 Core Domain中定义此通用元素

3) Could you also help me with the following question, since it's confusing me quite a bit: if generic element ( such as Time, Currency and Money ) is also used by Core Domain, then only implementation option is Shared Kernel ( ie this generic element is shared by both Core Domain and any other subdomain(s) that needs it ), but if generic element is used only by Core Domain, then we shouldn't bother with Shared Kernel, but should instead define this generic element directly within Core Domain ?

谢谢

推荐答案

1a)指整个领域,而不是核心领域。整个域可以跨越多个BC。 BC与核心域之间的关系可能更加复杂。域,子域和核心域是问题空间的元素。 BC是解决方案空间的伪像。实际上,它们可能并不总是一对一的,但这是理想的选择。

1a) In that quote the author is referring to the entire domain, not the core domain. The entire domain can span multiple BCs. The relationship between a BC and core domain can be more complicated. Domains, sub-domains and the core domain are elements of the problem space. A BC is an artifact of the solution space. In reality, they may not always be one-to-one, however that is the ideal.

1b)当然应该知道什么时候核心域是什么定义BC。如上所述,理想情况下,它们应该是一对一的。但是,可以定义一个BC来满足非理想状态下系统的需求。

1b) One should certainly have an idea of what the core domain is when defining BCs. As stated, ideally, they should be one-one. However, a BC may be defined to fulfill needs of of a system in a non-ideal state.

1c)一个域跨越多个BC,尽管有明确的边界,但域行为当然可以跨越BC。上下文图可以描述这种跨BC的交互。引号本身是基于领域愿景声明的思想,该声明的目的是强调核心域的价值并可能解释与BC的关系。

1c) A domain spans multiple BCs but despite explicit boundaries, domain behavior can certainly span BCs. A context map can describe such cross-BC interactions. The quote itself is based around the idea of a domain vision statement the purpose of which is to highlight the value of the core domain and possibly explain the relationship to BCs.

2 )多个BC可以利用一个通用子域。我在这里避免使用跨度一词,因为这过分强调了通用子域对整个域模型的重要性。

2) Multiple BCs can make use of a single generic sub-domain. I would avoid the term "spans" here because that overemphasizes the importance of the generic sub-domain for the entire domain model.

UPDATE

1b)可能是通过多个有界上下文实现了核心域。这不一定是缺陷,在某些情况下是理想的选择。一个BC也可能包含多个子域。这通常是不理想的,因为它可能表示BC混淆。

1b) It may be that a core-domain is implemented with multiple bounded contexts. This isn't necessarily a defect and in some instances is the ideal. It may also be that a single BC contains multiple sub-domains. This is usually not ideal because it likely indicates a conflated BC.

1c)根据定义,BC是物理分区的,不应具有直接依赖性。我认为这就是作者所指的。他强调的问题是,您可以使用多个BC进行解释,特别是在处理单个子域时。

1c) By definition BCs are physically partitioned and shouldn't have direct dependencies. I think this is what the author is referring to. The issue he's highlighting is that you can have multiple BCs at play which warrants explanation, especially when a single sub-domain is addressed.

2a)可以使用单号GS通过多个BC。之所以如此,是因为子域是 generic 。因此,GS不包含BC。

2a) A signle GS can be used by multiple BCs. This is so because the sub-domain is generic. So the GS doesn't contain the BCs; instead, it is referenced by the BCs.

2b)具有通用子域 span的系统可能表明它不是真正的通用子域-domain,但是核心域。这并不是说通用组件不能在整个系统中使用,相反。但是,在那种情况下,跨越系统的组件只是一个技术轴。

2b) Having a generic sub-domain "span" the system may be an indication that it isn't really a generic sub-domain, but a core domain. This is not to say that a generic component can't be used throughout the system, quite the contrary. However in that case, the component spanning the system is only a technical axis.

UPDATE 2

1b)是,子域是整个域的内聚组件。一个子域可以跨越多个BC。这是可以接受的,因为BC是一个解决方案空间工件,并且可能存在技术原因甚至存在组织问题。例如,在在线零售商的域中,有一个产品目录子域。这将具有对应的产品BC。但是,可以将有关产品搜索的其他功能放入产品搜索BC。这仍然是目录子域的一部分,但是由于技术原因,它是新的BC。另一方面,当单个BC包含多个子域时,这可能是有问题的。

1b) Yes a sub-domain is a cohesive component of the entire domain. A sub-domain can span multiple BCs. This can be acceptable because a BC is a solution space artifact and there can be technical reasons or even organizational issues for its existence. For example, in the domain of an online retailer there is a product catalog sub-domain. This would have a corresponding products BC. However, additional functionality regarding product search can be placed into a product search BC. This is still part of the catalog sub-domain, but a new BC for technical reasons. On the other hand, when a single BC contains multiple sub-domains, this can be problematic.

2a)我认为使用跨度一词的语义过大。通用子域可以是BC。但是,必须注意确保实际上以通用方式使用通用子域。

2a) I think I got overly semantic on the use of the word span. A generic sub-domain can be a BC. However, care must be taken to ensure that a generic sub-domain is in fact used in a generic way.

3)是。除此之外,即使在多个地方使用了诸如Money之类的基类,也可以为每个子域唯一地实现它们。有时候复制和粘贴是最好的模式。

3) Yes. Beyond that, base classes like Money can be implemented uniquely for each sub-domain even if they are used in multiple places. Sometimes copy-and-paste is the best pattern.

这篇关于核心域可以跨越多个有界上下文吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆