How Xianyu Refactored Its Publish/Edit Feature with SWAK to Boost Team Collaboration
Xianyu transformed its product publishing and editing functions by extracting platform code, introducing the SWAK framework, and decoupling services through RPC, resulting in clearer architecture, reduced code coupling, and significantly improved cross‑team development efficiency.
Upgrade of Publish/Edit Feature
To improve code quality and team efficiency, Xianyu performed two rounds of refactoring on its product publishing and editing functions.
1. Platform‑Business Separation and Business‑Business Isolation
In the first round, the original publish/edit logic was extracted from the monolithic app into a new item service. A custom framework called SWAK was introduced to separate platform logic from business logic and to isolate different business lines (e.g., rental, free‑gift) into independent packages or JARs.
SWAK defines 17 extension points that represent the core publish/edit workflow. Business teams implement the points relevant to their tag, while core developers maintain only the backbone code.
Developers are divided into business developers (maintain business‑specific logic) and backbone developers (maintain the core workflow and extension points).
Benefits include clearer code, higher reuse, isolated mutable logic per tag, and faster onboarding for new developers.
2. System‑to‑System Decoupling to Improve Collaboration
Using the rental business as an example, the same business previously had to modify code in multiple services (item, detail, transaction). After the refactor, each business is packaged as an independent service that communicates with the backbone via RPC.
Any organization that designs a system will inevitably produce a design whose structure mirrors the organization’s communication structure. – Conway’s Law
The second round implements “business service‑ization” by exposing backbone extension points as remote services. SWAK registers business tags and their RPC client instances (HSF/Dubbo) and provides three exception‑handling strategies: IGNORE, SKIP, and DEFAULT_VALUE.
Reducing Extension Points
To lower RPC overhead, related extension points were merged, reducing the count from 17 to 6, and configuration‑type interfaces were introduced with caching and dynamic configuration platforms.
Interface Design
Three object‑model options were evaluated; the final design uses a Map<String, Object> to hold business‑specific data, allowing the backbone to remain agnostic to individual business DOs.
The development flow for a new business includes agreeing on its DO, adding routing configuration in the backbone, implementing the extension point in the business service, and then integration testing.
SWAK Framework Improvements
SWAK now registers business tags and RPC client instances, supports timeout and connection‑exception strategies, and provides a visual interface for configuration‑type extension points.
Conclusion
After two upgrades, Xianyu’s publish/edit feature is decoupled at both platform‑business and system‑system levels, enabling faster, more stable support for multiple teams and business scenarios. Ongoing work includes parallel and asynchronous processing of some extension points.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Alibaba Cloud Developer
Alibaba's official tech channel, featuring all of its technology innovations.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
