Giter Site home page Giter Site logo

funkygao / cp-ddd-framework Goto Github PK

View Code? Open in Web Editor NEW
1.1K 53.0 262.0 18.65 MB

轻量级DDD正向/逆向业务建模框架,支撑复杂业务系统的架构演化!

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

License: Apache License 2.0

Java 99.81% Makefile 0.19%
ddd extension ddd-architecture clean-architecture framework enterprise-architecture domain-driven-design dddplus reverse-engineering architecture

cp-ddd-framework's Introduction

DDDplus

A lightweight DDD(Domain Driven Design) enhancement framework for forward/reverse business modeling, supporting complex system architecture evolution!

CI Javadoc Maven Central Requirement Coverage Status Mentioned in Awesome DDD Gitter chat

Languages: English | 中文


What is DDDplus?

DDDplus, formerly named cp-ddd-framework(cp means Central Platform:中台), is a lightweight DDD(Domain Driven Design) enhancement framework for forward/reverse business modeling, supporting complex system architecture evolution!

It captures DDD missing concepts and patches the building block. It empowers building domain model with forward and reverse modeling. It visualizes the complete domain knowledge from code. It connects frontline developers with (architect, product manager, business stakeholder, management team). It makes (analysis, design, design review, implementation, code review, test) a positive feedback closed-loop. It strengthens building extension oriented flexible software solution. It eliminates frequently encountered misunderstanding of DDD via thorough javadoc for each building block with detailed example.

In short, the 3 most essential plus are:

  1. patch DDD building blocks for pragmatic forward modeling, clearing obstacles of DDD implementation
  2. offer a reverse modeling DSL, visualizing complete domain knowledge from code
  3. provide extension point with multiple routing mechanism, suited for complex business scenarios

Current status

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

Showcase

A full demo of DDDplus forward/reverse modeling ->

Quickstart

Forward modeling

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

Integration with SpringBoot

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

Reverse Modeling

Please check out the 《step by step guide》.

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

Annotate your code With DSL, DDDplus will parse AST and render domain model in multiple views.

mvn io.github.dddplus:dddplus-maven-plugin:model \
    -DrootDir=${colon separated source code dirs} \
    -DplantUml=${target business model in svg format} \
    -DtextModel=${target business model in txt format}

Architecture Guard

mvn io.github.dddplus:dddplus-maven-plugin:enforce \
    -DrootPackage={your pkg} \
    -DrootDir={your src dir}

Known Issues

  • reverse modeling assumes unique class names within a code repo

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.

cp-ddd-framework's People

Contributors

carllhw avatar dependabot[bot] avatar dserfe avatar funkygao avatar lxxawfl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cp-ddd-framework's Issues

demo OrderServer的Jetty服务器,返回415错误

$curl -d '{"source":"ISV","customerNo":"home","externalNo":"2020"}' -H 'Content-type: application/json' localhost:9090/order
HTTP/1.1 415 Unsupported Media Type
Date: Wed, 30 Sep 2020 08:10:55 GMT
Cache-Control: must-revalidate,no-cache,no-store
Content-Type: text/html;charset=iso-8859-1
Content-Length: 346
Server: Jetty(9.4.z-SNAPSHOT)

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 415 Unsupported Media Type</title>
</head>
<body><h2>HTTP ERROR 415</h2>
<p>Problem accessing /order. Reason:
<pre>    Unsupported Media Type</pre></p><hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.z-SNAPSHOT</a><hr/>

</body>
</html>

[discuss] What do you want in DDDplus 1.2.0

The purpose of this issue is to discuss what you think should be added in DDDplus 1.2.0, such as features, bugfixes for known problems, and code refactoring optimizations.

类库看起有点复杂

类库、示例看起来有点复杂

示例如何启动?如何观察相关现象表示运行ok

有生产在使用吗?

cp-ddd-framework和DDDplus的区别

你好,cp-ddd-framework和DDDplus(已经是业务中台开发框架) 区别点有哪些(对比了代码架构什么的没看出太大的差别)。

默认步骤编排不支持多聚合情况

步骤编排作为扩展点,只能有一个默认实现,那么两个聚合,比如用户和角色,创建用户的步骤编排和创建角色的步骤编排不能各自实现,如果两个默认的实现写在一起,pattern或partner重新编排创建用户和创建角色都需要重写

Plugin Jar热更新的业务原子性

对于Partner Plugin Jar,一个Partner业务身份可能有几十个Extension,如何保证这些扩展点对一个请求要么全是新jar的,要么全是旧jar的?

例子:
一个请求,针对某一个业务前台身份,有10个扩展点,现在这个请求执行了3个扩展点,由于热更新,后续的7个扩展点可能就变成了新的业务逻辑。This is the issue

绝大部分场景下,后面7个扩展点突然变成新的逻辑,是没有问题的。

但有些场景下,可能会有问题。

TODO 给出具体problematic scenarios

优化一下

org.example.cp.oms.ExampleTest

@Test
    public void dynamicLoadPlugins() throws Throwable {
        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring-test.xml");
        applicationContext.start();

        for (int i = 0; i < 1; i++) {
            // 同一个jar,load多次
            log.info("N:{}", i);
            DDD.getContainer().loadPartnerPlugin(new URL("file:///Users/xxxx/github/ddd/cp-ddd-framework/doc/assets/jar/order-center-bp-isv-0.0.1.jar"), "org.example.bp");
        }

        DDD.getContainer().loadPartnerPlugin(new URL("file:///Users/xxx/github/ddd/cp-ddd-framework/doc/assets/jar/order-center-bp-ka-0.0.1.jar"), "org.example.bp");

        DDD.getContainer().loadPatternPlugin(new URL("file:///Users/xxx/github/ddd/cp-ddd-framework/doc/assets/jar/order-center-pattern-0.0.1.jar"), "org.example.cp");

        DDD.getContainer().unloadPatternPlugin("hair");
...

url改成 file:///Users/xxxx/github/ddd/cp-ddd-framework/doc/assets/jar/ 更好一些,github网络不同

Failed to execute 'mvn test' with 1.1.0-RELEASE and current master branch

Failed to execute 'mvn test' with 1.1.0-RELEASE and current master branch, here is the output:

[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] ArchitectureEnforcerTest.optionalInterfaceNameStartsWithI:55 expected:<... violated (5 times):[
simple name of io.github.dddplus.runtime.registry.mock.ability.AbilityTag does not start with 'I' in (AbilityTag.java:0)
simple name of io.github.dddplus.runtime.registry.mock.pattern.Patterns does not start with 'I' in (Patterns.java:0)
simple name of io.github.dddplus.runtime.registry.mock.step.Steps does not start with 'I' in (Steps.java:0)
simple name of io.github.dddplus.runtime.registry.mock.step.Steps$Cancel does not start with 'I' in (Steps.java:0)]
simple name of io.g...> but was:<... violated (5 times):[
simple name of io.github.dddplus.runtime.registry.mock.ability.AbilityTag does not start with 'I' in (AbilityTag.java:0)
simple name of io.github.dddplus.runtime.registry.mock.pattern.Patterns does not start with 'I' in (Patterns.java:0)
simple name of io.github.dddplus.runtime.registry.mock.step.Steps does not start with 'I' in (Steps.java:0)
]imple name of io.github.dddplus.runtime.registry.mock.step.Steps$Cancel does not start with 'I' in (Steps.java:0)
simple name of io.g...>
[INFO]
[ERROR] Tests run: 85, Failures: 1, Errors: 0, Skipped: 1

目前的扩展点定位,在动态匹配场景下灵活度不完善

在SaaS平台下,要建立一套low-code平台,要实现类似salesforce Trigger机制:

面临的挑战:

  • 谁来实现Pattern?
    • 使用者实现Pattern,则全都是boilerplate code block,违法DRY原则;此外,也不安全,万一写错呢,还需要加保护
    • SaaS平台实现Pattern,但Pattern目前都是靠实现写代码实现的/static;这个场景下,Pattern是不确定的,因为用户可以随时定义新的Model
  • Pattern数量会太多,造成匹配的性能障碍

Wanted: who's using DDDplus

Who is Using DDDplus

Thanks sincerely for constantly using and supporting DDDplus. We will try our best to keep DDDplus better, and keep growing community.

You can refer to the following sample answer for the format:

* Orgnizatioin: Your company name
* Contact: [email protected]
* Scenario: How DDDplus is used in your business

Thanks again for your participation !
DDDplus Team

谁在使用 DDDplus

诚挚地感谢每一位持续关注并使用 DDDplus 的朋友。我们会持续投入,把 DDDplus 变得更好,把 DDDplus 社区和生态变得更加繁荣。

您可以参考下面的样例来提供您的信息:

组织:贵公司名称
联系方式:[email protected]
业务场景:贵公司是如何使用 DDDplus 的

再次感谢你的参与!
DDDplus 团队

PluginApplicationContext和ContainerApplicationContext隔离性

PluginApplicationContext作为containerApplicationContext的子容器,在plugin的component bean里面可以获取spring的任意bean,这样隔离性不太好,如果是plugin里面直接获取dao,调用dao的方法访问数据库,就可以绕过中台的保护

IDecideStepsException与rollback exception有点冲突,容易误用

Describe the bug
IDecideStepsException与rollback exception有点冲突,容易误用

To Reproduce
Steps to reproduce the behavior:

  1. 业务异常,如果是一个,而且实现了IDecideStepsException,执行时抛出该异常,就会重现

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

MQ异步处理后,业务逻辑割裂,代码可读性降低

是否可以在DDDplus里解决它?

复杂业务场景下,经常会使用MQ进行异步的处理。
自己发,自己收的情况很常见。

但业务逻辑被切断了:正在处理一个业务,然后就produce一个message;后面的逻辑会在message consumer处看到,可consumer在哪里?需要找配置文件或其他手段才能找到。

异步方式将本来紧凑的代码都分成两部分:上半场(produce message之前的逻辑),下半场(message consumer里面的逻辑)

有点数据血缘的味道。

需要研发同学,可以在produce message(上半场)处不必切换快速定位下半场业务逻辑的实现。

References

DDD直接获取扩展点实例

目前的扩展点执行,都要先封装到 BaseDomainAbility 里。

但有的控制点:

  • 不需要默认的扩展点
  • 也不会有复杂的 IReducer逻辑,取到第一个匹配的即可
  • 也没有很强的业务属性:它可能是技术实现上考虑而抽象出来的,而不是业务抽象

这些场景下,BaseDomainAbility 显得有些多此一举,可以考虑提供 DDD.firstExtension 方法

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.