DDD Layers & Clean Architecture DDD分层和简洁架构
There are four fundamental layers of a Domain Driven Based Solution;
一个基于领域驱动的解决方案有四层,如下图所示:
Business Logic places into two layers, the Domain layer and the Application Layer, while they contain different kinds of business logic;
业务逻辑分为两层,即领域层和应用层,然而它们包含不同种类的业务逻辑。
-
Domain Layer implements the core, use-case independent business logic of the domain/system.
-
领域层实现核心,用例独立于领域/系统的的业务逻辑。
-
Application Layer implements the use cases of the application based on the domain. A use case can be thought as a user interaction on the User Interface (UI).
-
应用层实现基于领域的应用程序的用例。一个用例可以被认为是用户在用户界面(UI)上的交互。
-
Presentation Layer contains the UI elements (pages,components) of the application.
-
表现层包含应用程序的用户界面元素(页面、组件)。
-
Infrastructure Layer supports other layer by implementing the abstractions and integrations to 3rd-party library and systems.
-
基础设施层通过实现抽象、集成第三方库和其它系统来支持其他层。
The same layering can be shown as the diagram below and known as the Clean Architecture, or sometimes the Onion Architecture:
同样的分层被称为简洁架构,有时被称为洋葱架构,如下图所示:
In the Clean Architecture, each layer only depends on the layer directly inside it. The most independent layer is shown in the most inner circle and it is the Domain Layer.
在简洁架构中,每一层仅直接依赖于其内部的层。最独立的一层显示在最内圈,它就是领域层。