What’s New in Alibaba’s Java Manual? 3 Key Coding Standards Revealed
The April 22 release of Alibaba’s Java Development Manual “Taishan” edition introduces five mandatory date‑time rules, two table‑alias SQL conventions, and a unified error‑code standard, all aimed at improving code consistency and reliability across backend projects.
The "Java Development Manual" is a collective effort of Alibaba's technical team, refined through extensive real‑world practice and open‑sourced for community collaboration.
On April 22, the "Taishan" edition was launched, highlighting three major additions: five new date‑time conventions, two table‑alias SQL conventions, and a unified error‑code convention.
Date‑Time Conventions
Seven new rules were added, the first five are mandatory:
Use lowercase y for the year in date patterns; yyyy represents the calendar year, while uppercase YYYY denotes the week‑year.
Distinguish uppercase M (month) from lowercase m (minute); uppercase H (24‑hour) from lowercase h (12‑hour).
Obtain the current milliseconds with System.currentTimeMillis() instead of new Date().getTime().
Avoid using java.sql.Date, java.sql.Time, or java.sql.Timestamp anywhere in the code.
Do not hard‑code a year as 365 days; account for leap years.
The remaining two are recommended:
Avoid February 29 in non‑leap‑year schedules; use a cron expression like 0 0 0 28 2 ? for yearly tasks.
Use enum values for months; remember that Calendar months are zero‑based (January = 0).
Table‑Alias SQL Conventions
Mandatory: When a query or modification involves multiple tables, prefix column names with the table alias or name to avoid ambiguous column errors.
Recommended: Add AS before aliases and name them sequentially as t1, t2, … for clarity.
Unified Error‑Code Convention
A new section defines standardized error codes for each system, improving API readability and enabling real‑time monitoring of exception occurrences.
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.
Programmer DD
A tinkering programmer and author of "Spring Cloud Microservices in Action"
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.
