lei1024 / cp-ddd-framework

A lightweight flexible development framework for complex business architecture with full ecosystem!轻量级、对DDD进行补充和增强的框架!

Home Page:https://github.com/dddplus

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DDDplus

A lightweight flexible development framework for complex business architecture with full ecosystem!

Mavenn Central Requirement CI Maintainability Coverage Status Mentioned in Awesome DDD Gitter chat

Languages: English | 中文


What is DDDplus?

DDDplus, originally cp-ddd-framework(cp means Central Platform:中台), is a lightweight flexible development framework for complex business architecture.

DDDplus是轻量级、对DDD进行补充和增强的框架,提供的核心内容包括:

  • 扩展点机制,支持复杂场景问题
  • 扩充了DDD的building blocks,解决DDD落地难问题
  • 基于代码进行人工DSL标注的逆向建模机制,领域知识模型化

具体内容:

Current status

Used for several complex critical central platform projects in production environment.

Quickstart

Dependencies

<dependency>
    <groupId>io.github.dddplus</groupId>
    <artifactId>dddplus-runtime</artifactId>
</dependency>

Integration with SpringBoot

@SpringBootApplication(scanBasePackages = {"${your base packages}", "io.github.dddplus"})
public class WebApplication {
    public static void main(String[] args) {
        SpringApplication.run(WebApplication.class);
    }
}

扩展点路由原理

Pattern/Partner/Policy,都是Extension#code的提供者(它们有的通过match(IIdentity)方法,有的通过extensionCode(IIdentity)方法),即准入规则,本质上都是把动态的业务场景转换为静态的Extension#code,而Extension#code被扩展点实例通过注解绑定,从而实现了扩展点的动态路由。

之所以设计成这样的间接路由,是基于平台强管控原则。

逆向建模

<dependency>
    <groupId>io.github.dddplus</groupId>
    <artifactId>dddplus-visualization</artifactId>
</dependency>

通过DSL在代码进行标注后,即可自动PlantUML类图形式的业务模型:

class ReverseModelingTest {
    @Test
    void reverseModeling() {
        DomainModelAnalyzer domainModelAnalyzer = new DomainModelAnalyzer();
        ReverseEngineeringModel domainModel = domainModelAnalyzer.scan("{your module root}")
            .analyze();
        new PlantUmlBuilder()
            .build(domainModel)
            .renderSvg("myModel.svg");
    }
}

架构守护

为了避免错误使用造成的线上事故,建议CI流水线里增加DDDplus的错误使用卡控。

<dependency>
    <groupId>io.github.dddplus</groupId>
    <artifactId>dddplus-enforce</artifactId>
    <scope>test</scope>
</dependency>

通过单测执行DDDplus enforcement:

public class DDDPlusEnforcerTest {
    @Test
    public void enforce() {
        DDDPlusEnforcer enforcer = new DDDPlusEnforcer();
        enforcer.scanPackages("${your base package}")
                .enforce();
    }
}

Demos

Key abstractions

Contribution

You are welcome to contribute to the project with pull requests on GitHub.

If you find a bug or want to request a feature, please use the Issue Tracker.

For any question, you can use Gitter Chat to ask.

Licensing

DDDplus is licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

About

A lightweight flexible development framework for complex business architecture with full ecosystem!轻量级、对DDD进行补充和增强的框架!

https://github.com/dddplus

License:Apache License 2.0


Languages

Language:Java 99.8%Language:Makefile 0.2%