首页 > 其他分享 >Implementing Domain Driven Design (A practical guide for implementing the Domain Driven Design with

Implementing Domain Driven Design (A practical guide for implementing the Domain Driven Design with

时间:2023-09-02 19:44:40浏览次数:37  
标签:Domain Layer Driven Application Design DDD

CONTENTS

Introduction..................................................

  • Goal......................................................

  • Simple Code ...................................................................

What is the Domain Driven Design?......................................................................................

  • OOP & SOLID.........................................................

  • DDD Layers & Clean Architecture........................................

  • Core Building Blocks....................................................

Implementation: The Big Picture...............................................................................................

  • Layering of a .NET Solution......................................

  • Dependencies of the Projects in the Solution ...........................

  • Execution Flow of a DDD Based Application .....................................

  • Common Principles ...........................................................

Implementation: The Building Blocks ..........................................

  • The Example Domain ..........................................................

  • Aggregates ....................................................................

  • Repositories ...................................................................

  • Specifications .............................................................

  • Domain Services ....................................................................

  • Application Services ...............................................................

  • Data Transfer Objects ...............................................................

Example Use Cases .....................................................................

  • Entity Creation .............................................

  • Updating / manipulating An Entity ...........................

Domain Logic & Application Logic............................

  • Multiple application Layers..........................
  • Examples.....................................

Reference Books...................

INTRODUCTION

This is a practical guide for implementing the Domain Driven Design (DDD). While the implementation details rely on the ABP Framework infrastructure, core concepts, principles and patterns are applicable in any kind of solution, even if it is not a .NET solution.

Goal

The goals of this book are:

  • Introduce and explain the DDD architecture, concepts, principles, partterns and build blocks.

  • Explain the layered architecture & solution structure offered by the ABP Framework.

  • Introduce explicit rules to implement DDD partterns and best practices by giving concrete examples.

  • Show what ABP Framework provides you as the infrastructure for implementing DDD in a proper way.

  • And finally, provide suggestions based on sofware development best practices and our experiences to create a maintainable codebase.

Simple Code!

Playing football is very simple, but playing simple football is the hardest thing there is. ----Johan Cruyff

if we take this famous quote for programming,we can say:

Writing code is very simple, but writing simple code is the hardest thing there is. ----???

In this document, we will introduce simple rules, those are easy to implement.

Once your application grows, it will be hard to follow these rules. Sometimes you find **b

if you follow the rules and bset practices, your code base will be simpler and easier to maintain. Your application reacts to changes faster.

What is the Domain Driven Design?

Domain-driven design(DDD) is an approach to software development for complex needs by connecting the implementation to an evolving model;

DDD is suitable for complex domains and large-scale applications rather than simple CRUD applications. It focuses on the core domain logic rather than the infrastructure details. It helps to build a flexible, modular and maintainable code base.

OOP && SOLID

Implementing DDD highly relies on the Object Oriented Programming(OOP) and SOLID principles. Actually, it implements and extends these principles. So, a good understanding of OOP & SOLID helps you a lot while truly implementing the DDD.

DDD Layers & Clean Architecture

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

  • 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.

Core Building Blocks

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

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.

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 objects with different Ids are considered as different entities.

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

  • Aggregate & Aggregate Root: An Aggregate is a cluster of objects () bound together by an Aggregate Root object.

  • Repository (interface): A Repository is a co

标签:Domain,Layer,Driven,Application,Design,DDD
From: https://www.cnblogs.com/fengjq/p/17673764.html

相关文章

  • 迁移学习(CLDA)《CLDA: Contrastive Learning for Semi-Supervised Domain Adaptation》
    Note:[wechat:Y466551|可加勿骚扰,付费咨询]论文信息论文标题:CLDA:ContrastiveLearningforSemi-SupervisedDomainAdaptation论文作者:AnkitSingh论文来源:NeurIPS2021论文地址:download 论文代码:download视屏讲解:click1简介动机:半监督导致来自标记源和目标样本的......
  • 论文解读(AdSPT)《Adversarial Soft Prompt Tuning for Cross-Domain Sentiment Analysi
    Note:[wechat:Y466551|可加勿骚扰,付费咨询]论文信息论文标题:AdversarialSoftPromptTuningforCross-DomainSentimentAnalysis论文作者:HuiWu、XiaodongShi论文来源:2022ACL论文地址:download 论文代码:download视屏讲解:click1介绍 动机:直接使用固定的预定义模......
  • <mvc:annotation-driven />, <context:annotation-config/>, <context:component-scan
    <mvc:annotation-driven/> 会做以下几件事: 向spring容器中注册DefaultAnnotationHandlerMapping。向spring容器中注册AnnotationMethodHandlerAdapter。配置一些messageconverter。解决了@Controller注解的使用前提配置,即HandlerMapping能够知道谁来处理请求。<cont......
  • <mvc:annotation-driven>和DefaultAnnotationHandlerMapping
    spring配置拦截器有两种方式: <mvc:annotation-driven/><!--*************openSessionInViewInterceptor*************--><beanid="openSessionInViewInterceptor"class="org.springframework.orm.hibernate3.support.OpenSessionInViewInt......
  • 论文解读(DEAL)《DEAL: An Unsupervised Domain Adaptive Framework for Graph-level Cl
    Note:[wechat:Y466551|可加勿骚扰,付费咨询]论文信息论文标题:DEAL:AnUnsupervisedDomainAdaptiveFrameworkforGraph-levelClassification论文作者:NanYin、LiShen、BaopuLi、MengzhuWang、论文来源:2023aRxiv论文地址:download 论文代码:download视屏讲解:click1......
  • 『PyQt5-基础篇』| 02 Pyqt5开发环境+安装配置QtDesigner
    (02Pyqt5开发环境+安装配置QtDesigner)1Pycharm安装安装教程请参考:安装教程2Python安装下载地址:官网下载地址;根据自身系统选择版本下载:下载完成,直接双击运行,即可,安装路径可选。环境变量设置:如果安装时已经勾选了“增加环境变量”的话,就不用再设置环境变量。如果没有......
  • 论文解读(PERL)《PERL: Pivot-based Domain Adaptation for Pre-trained Deep Contextua
    Note:[wechat:Y466551|可加勿骚扰,付费咨询]论文信息论文标题:PERL:Pivot-basedDomainAdaptationforPre-trainedDeepContextualizedEmbeddingModels论文作者:EyalBen-David、CarmelRabinovitz、RoiReichart论文来源:2020TACL论文地址:download 论文代码:download视屏......
  • 论文解读(TAMEPT)《A Two-Stage Framework with Self-Supervised Distillation For Cros
     论文信息论文标题:ATwo-StageFrameworkwithSelf-SupervisedDistillationForCross-DomainTextClassification论文作者:YunlongFeng,BohanLi,LiboQin,XiaoXu,WanxiangChe论文来源:2023aRxiv论文地址:download 论文代码:download视屏讲解:click1介绍 动......
  • indesign2022中文版下载-Adobe InDesign 2022版 永久安装包
    AdobeIndesign中文免费版是由Adobe公司推出的专业型排版设计软件,软件功能非常强大,具有创建和发布书籍,数字杂志,电子书,海报,交互式PDF等所需的一切,可提供专业的布局和排版工具,且拥有丰富的排版、图形、图形、表格等素材,能够满足用户的各种需求。软件地址:看置顶贴InDesign2022新增功能......
  • ID最新版下载和安装步骤 InDesign设计 永久安装包
    AdobeIndesign中文免费版是由Adobe公司推出的专业型排版设计软件,软件功能非常强大,具有创建和发布书籍,数字杂志,电子书,海报,交互式PDF等所需的一切,可提供专业的布局和排版工具,且拥有丰富的排版、图形、图形、表格等素材,能够满足用户的各种需求。软件地址:看置顶贴InDesign最新版软件功......