Ddd domain model design-Forum

Source: Internet
Author: User

The premise of reading this article is that you are familiar with the domain-driven design (DDD) and cqrs architecture.

 

The domain model diagram is as follows:

Note:
  1. The above domain model draws on the idea of DDD and cqrs during design;
  2. The idea of DDD is used to design the entity, value object, aggregation, and aggregation root. In the figure, there are three aggregation root types: Forum, thread, and user; the thread aggregation root aggregates the post and viewcounter objects. The post object is the reply of the thread. Obviously, leaving the post object is meaningless, but the post object has a local ID in the thread aggregation, that is, it can be unique under the current thread and does not need to be globally unique.
  3. The introduction of cqrs makes sure that we do not have to consider how to store the statistical information generated by object association when designing a domain model, so that the domain model can be simplified and clearer; for example, the total number of replies to the post, the latest reply time, and the latest reply to the post. This information is only used for statistics and is only displayed on the interface, that is, we only need this information when querying, so it can be implemented on the Q-side of cqrs.
  4. The introduction of cqrs can also simplify warehousing, without the need to provide interfaces for querying domain objects and Displaying results on the interface, you only need to provide operations for querying a single aggregation root, add, and remove;
  5. The above domain model only focuses on the basic functions of a standard forum;

I learned a lot of theoretical knowledge before, and now it is time to use some modeling examples to train. I believe you will have many questions, so I hope you can discuss them more. It's a bit late tonight. I can't write down the entire thinking process. I will make up later.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.