Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the basic concept of DDD

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "what is the basic concept of DDD". In daily operation, I believe that many people have doubts about the basic concept of DDD. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the question of "what is the basic concept of DDD?" Next, please follow the editor to study!

What is DDD?

Ddd is not an architectural style, but a methodology, what is methodology, everyone according to their own ideas to design is a set of methodology; ddd is a kind of business recognition, a methodology for micro-service split.

Why is DDD popular in the micro-service environment?

Micro-service is different from the system, service is a set of small and independent functional units, which is the minimum set of functions perceived by users. The smallest atom with a boundary in the DDD model is aggregation. Because aggregation and aggregation are associated only through the aggregation root, when an aggregation root needs to be moved from one bounded context to another, the micro-service can be easily reconstructed with very low moving cost. The concept of micro-service coincides with that of ddd, and the popularity of ddd is a trend in the environment of micro-service.

Why are many industries based on the architecture of micro services or MVC architecture?

Fixed thinking, from school to work, from learning to open source architecture is to adopt this kind of MVC architecture

Many industries carry out project transformation based on traditional industries, but the middleware is related to micro-services, but there is no obvious basis for business separation.

Resource cost, ddd-based split cost is relatively high, mainly reflected in event storm, domain division, entity aggregation, context boundary determination; for an enterprise, what one person can do does not need to spend a lot of manpower and time to plan.

The three-tier architecture belongs to the anemia model, although it does not conform to the idea of object-oriented programming, the architecture is relatively simple and easy to use.

What is the technical difference between DDD and MVC?

The main difference between MVC and DDD is in the Service layer, the main difference is:

MVC:Service implements full business logic, while BO (Business Object) saves business objects, which belongs to anemic model.

DDD:Service implements a small amount of business logic. DO (Domain Object) contains aggregate followers, aggregates, entities, and value objects. Technically speaking, they are entities, including behaviors, actions, attributes, dependencies and attribute congestion models in related fields.

The basic concept of DDD

Domain: domain is the largest concept in DDD, which mainly determines the boundary scope, and the domain is divided into core domain (core business logic), general domain (common business logic) and supporting domain (basic third-party business logic).

Boundary context: it is necessary to establish a common language in the boundary context, that is, everyone can see that the accepted term is the universal language; the boundary context is mainly to determine the domain boundary.

Aggregation root: an aggregation root entity that contains many aggregates, and the aggregation root has a unique identity and can coordinate each aggregation. External access can only access private content based on the unique identity of the aggregation root.

Aggregation: aggregation is a whole, which organizes all entities and value objects to ensure that the domain determines data consistency when performing logic, and avoids data inconsistency in design.

Entity: a collection of attributes that are grouped together by multiple attributes of an overall concept, with a unique identification id. Entities are real business objects with business attributes, behaviors, and business logic.

Value object: a collection of several attributes with only data initialization operations and limited behaviors that do not involve modifying data, and do not contain business logic

DDD modeling process

Using the storm event, according to the sentence business behavior, find the entities and value objects that have occurred in the process.

Select the appropriate one among many entities as the aggregation root, based on whether there is an independent life cycle and a globally unique ID, and whether other objects can be modified or created.

Find the entities and value objects associated from the aggregation root according to the single responsibility of the business and the principle of high cohesion

In the aggregation, the object reference model and dependency model are drawn according to the aggregate root, entity, and value object.

Multiple aggregates are divided into a contextual interface based on business semantics and context, that is, a small micro-service.

DDD modeling exampl

At this point, the study of "what is the basic concept of DDD" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report