有关领域驱动设计的只言片语

2018-08-07  本文已影响0人  毛球小二

在创建微服务的过程中,DDD可以在一下4个主要领域发挥作用:

任何一个具有高复杂度的业务领域都由一个或多个界限上下文组成,每个上下文负责领域中的一部分内容。每个界限上下文都包含用于描述领域的模型,同时也定义了这些模型所代表的意义的边界。以一个客户对象为例,每个界限上下文都是按照独有的模型与视角来定义这个客户对象的。

上下文图描述了系统中的所有界限上下文,以及他们之间的相互关联及上下文之间的契约。

以下是界限上下文之间常见的关系模式:

聚合是由多个领域对象构成的一个逻辑组,其中的对象将作为一个整体进行处理。聚合中的某个实体将成为聚合根,它负责接收所有外部请求,并负责整个聚合的生命周期
对于僵硬的架构或是过于复杂的系统来说,可以选择创建一个跨界限上下文的大比例结构,让这个结构随着对于高层次概念的理解不断加深而逐渐进化。
职责层模式是另一种在界限上下文之内创建一个内部结构的结构模式,其思想是按照职责进行结构的创建,而微服务的结构也可以应用相同的概念进行设计。

Bounded Context创建的模型较小,而且内聚性更高,同时维持了模型之间的边界


What is the Core Domain?

The core domain is the part of the domain most closely associated with the strategy of the company.

Definition of Strategy

I offer the following definition for the strategy of a company:

Strategy refers to objectives as a function of environment and available resources, followed by the allocation of these resources, in order to create value for customers while simultaneously creating profit for the company and its employees.

A few remarks concerning this definition:

What is a Support Domain?

A support domain is a part of the domain that indirectly supports the core domain without actually belonging to it.

Typically, this is a thing that everyone needs, yet no one wants to pay for. The reason is that the value added, taken in isolation, is weak. For example, bookkeeping is indispensable in many banking activities, but no one wants to pay for it.

What is a Generic Domain?

A generic domain is one that is universally well-known, without any need for specialization in the core domain.

Some classic examples are accounting, human resources, and project management. These domains are widely known, sometimes even including their various sub-fields. In technical terms, this could for instance be an optimization tool for finding a path in a graph (and many problems, I might add, can be boiled down to a graph). Options to consider here, naturally, would be open source, software packages, outsourced development, and, lastly, in-house development. In this latter case, it would be pertinent to ask the following questions: Is it worth my while to write the software? Why not purchase it off-the-shelf? Why not outsource it?

上一篇 下一篇

猜你喜欢

热点阅读