Core Building Blocks 核心构件

DDD mostly focuses on the Domain & Application Layers and ignores the Presentation and Infrastructure. They are seen as details and the business layers should not depend on them.

DDD主要关注领域和应用层而忽略表现层和基础设施。它们被看作是细节,业务层不应该依赖于它们。

That doesn't mean the Presentation and Infrastructure layers are not important. They are very important. UI frameworks and database providers have their own rules and best practices that you need to know and apply. However these are not in the topics of DDD.

这并不意味着表现层和基础设施层不重要。它们是非常重要的。UI框架和数据提供者有他们自己的规则和最佳实践,你需要了解和应用。然而,这些并不在DDD的考虑范畴。

This section introduces the essential building blocks of the Domain & Application Layers.

本节介绍领域层和应用层的基本构件。

Domain Layer Building Blocks 领域层构件

  • Entity: An Entity is an object with its own properties (state, data) and methods that implements the business logic that is executed on these properties. An entity is represented by its unique identifier (Id). Two entity object with different Ids are considered as different entities.

  • 实体实体是一个有自己属性(状态、数据)和实现对这些属性执行业务逻辑的方法的对象。一个实体由其唯一的标识(Id)来表示。两个具有不同ID的实体对象被认为是不同的实体。

  • Value Object: A Value Object is another kind of domain object that is identified by its properties rather than a unique Id. That means two Value Objects with same properties are considered as the same object. Value objects are generally implemented as immutable and mostly are much simpler than the Entities.

  • 值对象值对象是另一种领域对象,它通过其属性而不是唯一标识Id来识别。这意味着两个具有属性相同的值对象被认为是同一个对象。值对象通常被实现为不可变的,而且大多数比实体要简单得多。

  • Aggregate & Aggregate Root: An Aggregate is a cluster of objects (entities and value objects) bound together by an Aggregate Root object. The Aggregate Root is a specific type of an entity with some additional responsibilities.

  • 聚合与聚合根聚合是由聚合根对象关联在一起的一组对象(实体和值对象)。聚合根是一个特定类型的实体,具有一些额外的职责。

  • Repository (interface): A Repository is a collection-like interface that is used by the Domain and Application Layers to access to the data persistence system (the database). It hides the complexity of the DBMS from the business code. Domain Layer contains the interfaces of the repositories.

  • 存储库存储库是一个类似集合的接口,被领域层和应用层用来访问数据持久化系统(数据库)。它将DBMS的复杂性从业务代码中隐藏起来。领域层包含存储库的接口。

  • Domain Service: A Domain Service is a stateless service that implements core business rules of the domain. It is useful to implement domain logic that depends on multiple aggregate (entity) type or some external services.

  • 领域服务领域服务是一个无状态的服务,它实现了领域的核心业务规则。它对于实现依赖于多个聚合(实体)类型或一些外部服务的领域逻辑很有用。

  • Specification: A Specification is used to define named,reusable and combinable filters for entities and other business objects.

  • 规范规范被用来为实体和其他业务对象定义命名的、可重用性和可组合性的过滤器。

  • Domain Event: A Domain Event is a way of informing other services in a loosely coupled manner, when a domain specific event occurs.

  • 领域事件领域事件是当一个领域的特定事件发生时以松散耦合的方式通知其他服务的一种方式。

Application Layer Building Blocks 应用层构件

  • Application Service: An Application Service is a stateless service that implements use cases of the application. An application service typically gets and returns DTOs. It is used by the Presentation Layer. It uses and coordinates the domain objects to implement the use cases. A use case is typically considered as a Unit Of Work.

  • 应用服务:一个应用服务是一个无状态的服务,它实现了应用程序的用例(交互场景)。一个应用服务通常获取和返回DTO。 它用于表示层。它使用并调用领域对象来实现用例。一个用例通常被认为是一个工作单元。

  • Data Transfer Object (DTO): A DTO is a simple object without any business logic that is used to transfer state (data) between the Application and Presentation Layers.

  • 数据传输对象:DTO是一个没有任何业务逻辑的简单对象,用于在应用层和表现层之间传输状态(数据)。

  • Unit of Work (UOW): A Unit of Work is an atomic work that should be done as a transaction unit. All the operations inside a UOW should be committed on success or rolled back on a failure.

  • 工作单元:一个工作单元是一个原子性的工作,应该作为一个事务单元来完成。一个工作单元内的所有操作在成功时应被提交,在失败时应被回滚。

2.3 Core Building Blocks 核心构件的更多相关文章

  1. 四、Implementation: The Building Blocks 实现:构件

    四.Implementation: The Building Blocks 实现:构件 This is the essential part of this guide. We will introd ...

  2. 企业架构研究总结(35)——TOGAF架构内容框架之构建块(Building Blocks)

    之前忙于搬家移居,无暇顾及博客,今天终于得闲继续我的“政治课”了,希望之后至少能够补完TOGAF方面的内容.从前面文章可以看出,笔者并无太多能力和机会对TOGAF进行理论和实际的联系,仅可对标准的文本 ...

  3. TOGAF架构内容框架之构建块(Building Blocks)

    TOGAF架构内容框架之构建块(Building Blocks) 之前忙于搬家移居,无暇顾及博客,今天终于得闲继续我的“政治课”了,希望之后至少能够补完TOGAF方面的内容.从前面文章可以看出,笔者并 ...

  4. Intel® Threading Building Blocks (Intel® TBB) Developer Guide 中文 Parallelizing Data Flow and Dependence Graphs并行化data flow和依赖图

    https://www.threadingbuildingblocks.org/docs/help/index.htm Parallelizing Data Flow and Dependency G ...

  5. bc.34.B.Building Blocks(贪心)

    Building Blocks Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) ...

  6. DTD - XML Building Blocks

    The main building blocks of both XML and HTML documents are elements. The Building Blocks of XML Doc ...

  7. HDU—— 5159 Building Blocks

    Problem Description After enjoying the movie,LeLe went home alone. LeLe decided to build blocks. LeL ...

  8. [翻译]Review——How JavaScript works:The building blocks of Web Workers

    原文地址:https://blog.sessionstack.com/how-javascript-works-the-building-blocks-of-web-workers-5-cases-w ...

  9. Spring Core Programming(Spring核心编程) - AOP Concepts(AOP基本概念)

    1. What is aspect-oriented programming?(什么是面向切面编程?) Aspects help to modularize cross-cutting concern ...

随机推荐

  1. ArcEngine+C# 森林资源仿真系统 核心代码

    目录 第一章 基础功能的核心代码 实现滚轮缩放事件 创建或获取地理数据(导入前询问用户是否覆盖) 创建要素类(Shape) 点列数据创建要素类 Shape文件创建要素类 GDB中取出要素类 创建栅格数 ...

  2. Java调用腾讯云短信接口,完成验证码的发送(不成功你来砍我!!)

    一.前言 我们在一些网站注册页面,经常会见到手机验证码的存在,这些验证码一般的小公司都是去买一些大的厂家的短信服务,自己开发对小公司的成本花费太大了!今天小编就带着大家来学习一下腾讯云的短信接口,体验 ...

  3. 20210719 noip20

    考场 后两题是原题,教练说不用写了(ycx 不讲武德) T1 先手模了 \(n\le5\) 的情况,尝试找规律失败.那就只能 DP 了,最终没搞出来. 记忆化搜索打了 \(n\le20\) 的表,交了 ...

  4. noip模拟30

    \(\color{white}{\mathbb{缀以无尽之群星点点,饰以常青之巨木郁郁,可细斟木纹叶脉,独无可极苍穹之览,名之以:密林}}\) 看完题后感觉整套题都没什么思路,而且基本上整场考试确实是 ...

  5. golang接口类型判断 VS 接口类型查询

    接口类型判断:接口.(类型) 1.类型查询:查询接口数据对应的类型是否是指定的类型 2.类型转化:如果是指定类型,就将数据转化为接口类型查询: 1.reflect.TypeOf(接口) 2.接口.(T ...

  6. 2020ICPC沈阳站C题 Mean Streets of Gadgetzan

    大致题意 原题链接 翻译 \(有n个逻辑变量 请你分别对它们赋值 使其满足m个命题\) \(命题有四种格式:\) 单独数字x 表示第x个逻辑变量为真 ! + 数字x 表示第x个逻辑变量为假 若干个数字 ...

  7. C++快读讲解

    C++快读讲解 inline int read(){ int x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9'){ if(ch=='-') ...

  8. PHP设计模式之原型模式

    原型模式其实更形象的来说应该叫克隆模式.它主要的行为是对对象进行克隆,但是又把被克隆的对象称之为最初的原型,于是,这个模式就这样被命名了.说真的,从使用方式来看真的感觉叫克隆模式更贴切一些. Gof类 ...

  9. js 获取转换网址中文参数

    var search = decodeURI(location.search).substr(1); console.log(search); decodeURI 方法返回一个已编码的统一资源标识符 ...

  10. 『PyTorch』屌丝的PyTorch玩法

    1. prefetch_generator 使用 prefetch_generator库 在后台加载下一batch的数据,原本PyTorch默认的DataLoader会创建一些worker线程来预读取 ...