Backend Development 6 min read

Applying Domain-Driven Design (DDD) in Youzan Credit Core System

Applying Domain‑Driven Design to Youzan’s Credit Core System involved consulting experts, mapping loan processes, using four‑color modeling to define documents, participants, roles and data, establishing bounded contexts, designing sub‑domains with use‑case diagrams, and adopting a layered (often hexagonal) architecture to ensure maintainable, scalable microservices.

Youzan Coder
Youzan Coder
Youzan Coder
Applying Domain-Driven Design (DDD) in Youzan Credit Core System

The author shares their experience learning and applying Domain-Driven Design (DDD) in the Youzan Credit Core System, aiming to provide practical insights into DDD implementation.

DDD is a methodology that spans the entire software development lifecycle, focusing on solving specific domain problems by abstracting business models from complex real-world scenarios. It employs the divide-and-conquer concept, breaking down large, complex businesses into smaller domains to address problems systematically. The primary goal of DDD is to clearly define business boundaries.

DDD consists of two main parts: strategic design and tactical design. Strategic design revolves around microservice decomposition, while tactical design focuses on microservice implementation.

When tasked with developing a credit core system, the first step is to establish domain knowledge by consulting domain experts, such as specialists, product managers, or operations personnel. This helps clarify business processes and abstract essential domain elements.

Using the loan process as an example, the author outlines the steps involved: user loan application, risk control approval, deduction of user quota, contract signing, generation of repayment plans, and fund disbursement. The process is illustrated in a flowchart.

The article then delves into domain modeling using the four-color modeling method. This involves identifying key business documents (red), participants (green), roles (yellow), and descriptive information (blue) within the business process.

After completing the four-color modeling, the next step is to divide the domain and confirm the bounded context. This is done by starting with the key business documents and creating a domain model for the loan process.

Once the domain model is established, detailed design for each sub-domain can begin. This includes creating use case diagrams and flowcharts to describe interactions and processes.

The article concludes with a discussion on layered architecture, emphasizing the importance of a clear structure for maintainability. It highlights three classic DDD architectures: four-layer, five-layer, and hexagonal architecture. The hexagonal architecture is noted for its adaptability and ease of integration with external systems.

The author reflects on the application of DDD in the Youzan Credit Core System, acknowledging its suitability for large, complex businesses while cautioning against its use in simpler business models due to increased design complexity.

software architectureMicroservicesDDDhexagonal architectureDomain Modelingbusiness processDomain-Driven DesignLoan SystemYouzan Credit Core System
Youzan Coder
Written by

Youzan Coder

Official Youzan tech channel, delivering technical insights and occasional daily updates from the Youzan tech team.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.