Code Monkey home page Code Monkey logo

ddd-architecture-samples's Introduction

DDD Architecture Samples

At first, you must remember, a simple blog system often does not need to use a DDD workshop (like Event Storming) to design and apply a complex architecture. However, when you are skilled, you will find DDD thinking is very usefully for your daily thought. Also, your modeling speed will be more and more fast. So you can quickly complete all the design process in your brain.

These examples aim to demonstrate a DDD architecture with different tech stacks, which can work in the real project and let you understand and reference quickly.

When designing these samples, I refer to the following architecture patterns:

And I designed them with these principles (you can call it CUPET):

  • Easy to Code
  • Easy to Understand
  • Easy to Protect
  • Easy to Extend
  • Easy to Test

Domain Model & Humble Object

Work in progress...

Specification Pattern

Test Strategy

Architecture Test

Work in progress...

API Test

Work in progress...

Repository Test

I don't write the test for the specific implementation of repositories, and the instead is inject the repository implementation to services, and write the integration tests for the services.

Because when we used the domain models and services to replace anemic models like POJO or POCO, it makes creating input data for repositories in the tests are very difficult. The more important is only focus on the implementation of repositories is make little sense; they must work correctly in the business context (services).

Service Test

The test doubles are handy when writing unit tests for services. This way can make the service's tests very easy because we want to focus on the business logic in service, not the implementation of domain models and repositories.

Domain Test

Work in progress...

ddd-architecture-samples's People

Contributors

howiehu avatar

Watchers

 avatar

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.