Backend Development 8 min read

Application Layering Best Practices and Alibaba Specification

This article explains common misconceptions about application layering, outlines essential principles for maintainable layers, details Alibaba's multi‑layer architecture, proposes optimized layering with service and manager responsibilities, discusses domain model conversions, and concludes with practical guidance for clear, reusable backend design.

Code Ape Tech Column
Code Ape Tech Column
Code Ape Tech Column
Application Layering Best Practices and Alibaba Specification

Background: Many developers misunderstand application layering, mixing responsibilities among controller, service, and mapper, which leads to maintenance difficulties and poor code reuse.

A good application layering should facilitate future maintenance and extension, be accepted by the whole team, and have clearly defined responsibilities for each layer.

Alibaba's coding specification defines clear layers:

Open Interface Layer – wraps Service methods as RPC or HTTP interfaces with gateway security and traffic control.

Presentation Layer – renders templates for various clients (Velocity, JS, JSP, mobile).

Web Layer – handles access control, basic parameter validation, and simple business processing.

Service Layer – contains specific business logic.

Manager Layer – provides reusable logic such as third‑party integrations, caching, middleware handling, and aggregates DAO interactions.

DAO Layer – data access, interacting with MySQL, Oracle, HBase, etc.

Optimized layering adds a TService (RPC) layer similar to a controller and emphasizes keeping business orchestration in the Service layer, reusable logic in the Manager layer, and restricting DAO access to Service/Manager only.

Domain model conversion in Alibaba's guidelines includes:

DO (Data Object) – mirrors database tables.

DTO (Data Transfer Object) – used for data transfer from Service/Manager.

BO (Business Object) – encapsulates business logic output.

AO (Application Object) – near the presentation layer, low reuse.

VO (View Object) – passed to rendering engines.

Query – encapsulates query parameters, avoiding Map for >2 parameters.

Excessive conversions across layers can cause performance overhead; a balanced approach allows Service/Manager to work directly with domain models while preventing DAO objects from flowing up to controllers.

Conclusion: Proper layering is crucial for code standards, reusability, and clear responsibilities; while teams may have different habits, the essential goal is clear logical boundaries that simplify maintenance and future development.

backendsoftware architecturedaoService Layerapplication layeringAlibaba guidelines
Code Ape Tech Column
Written by

Code Ape Tech Column

Former Ant Group P8 engineer, pure technologist, sharing full‑stack Java, job interview and career advice through a column. Site: java-family.cn

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.