Backend Development 11 min read

Business Isolation and Domain Modeling for Xianyu Detail Page Architecture

The article shows how to refactor a tangled Xianyu detail‑page built on legacy MVC by isolating each vertical business with the Strategy pattern, extracting shared services, packaging them as libraries or JARs, and then applying domain‑driven design to create a clean, layered, maintainable architecture.

Xianyu Technology
Xianyu Technology
Xianyu Technology
Business Isolation and Domain Modeling for Xianyu Detail Page Architecture

When the term "architecture" is mentioned, many concepts such as layered architecture, event‑driven architecture, DDD, CQRS, and design principles like KISS and SOLID come to mind. This article does not discuss those concepts directly; instead, it starts from the Xianyu detail‑page business scenario, identifies current problems and pain points, and derives an architecture that solves them.

The legacy MVC‑style architecture (DAO → Manager → Service → Controller) works well for small projects, but as the product evolves, multiple vertical business lines (auction, free‑gift, rental, player, etc.) are added to the same detail page. All logic becomes tangled, leading to cross‑line failures, high coupling, and difficult maintenance.

To address these issues, the article proposes a new architecture based on business isolation and domain modeling. First, each vertical business is isolated using the Strategy pattern, turning the detail page into a set of interchangeable implementations. Then, common functionality is extracted into a shared layer while the varying parts remain in each vertical module.

Because the code is still in a single application, developer isolation is lacking. Three solutions are discussed: (a) package common code as a second‑party library, (b) package each vertical business as a separate JAR and integrate it, and (c) combine both approaches so that common services are independently deployed while vertical services can be deployed locally or remotely. This resolves both business and developer isolation.

With isolation in place, the article moves to domain‑driven design (DDD). It models the detail page as an aggregate root containing entities such as Item, Seller, Buyer, and FishPool. Using the four‑color prototype method, roles (seller, buyer, pond owner, pond member) are introduced, and media information (video, image) is abstracted. The resulting class diagram shows the aggregate root and its related entities.

Finally, the DDD layered architecture is presented: Infrastructure (persistence), Domain (core business logic), Application (orchestration), and User Interface (presentation). The mapping to a concrete project structure is illustrated, and a comparison with traditional MVC layers is provided.

In summary, the article demonstrates how to isolate business logic, separate development teams, and apply domain modeling to achieve a maintainable, scalable architecture for complex detail‑page scenarios.

BackendarchitectureDomain-Driven Designsoftware designbusiness isolation
Xianyu Technology
Written by

Xianyu Technology

Official account of the Xianyu technology 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.