Ant Financial Wealth Coding Guidelines – Comprehensive Backend Development and Operations Best Practices
This document presents Ant Financial's comprehensive coding standards covering concurrency control, idempotency, state management, object handling, SQL practices, time handling, exception safety, code quality, architecture design, middleware usage, data quality, production change procedures, emergency response, and client‑frontend considerations to ensure robust, secure, and maintainable backend systems.
Basic Coding Practices Emphasize pessimistic locking for concurrent writes, using a lock‑check‑update pattern, and apply optimistic locking only after thorough evaluation. Ensure idempotency compatibility across old and new systems with clear field constraints and handle exceptional scenarios to prevent request penetration.
State Management Design complete state machines where transitions are driven by explicit business commands; final states must be immutable and consistently reviewed.
Object Handling Distinguish between reference and address semantics, avoid mutable singleton state, deep‑copy when needed, and always compare objects with equals to prevent null‑pointer issues.
SQL Guidelines Avoid SELECT * ; always specify fields, use indexed WHERE clauses matching column types, and apply hints for sharding frameworks to ensure correct routing.
Time Settings Store times in UTC (or GMT+8 for domestic) using DATETIME , transmit as ISO‑8601 strings with timezone information, and account for leap years and daylight‑saving adjustments.
Exception Defense Validate all incoming data for legality and authenticity, log and handle caught exceptions explicitly, and clean up thread‑local resources in finally blocks to avoid memory leaks.
Code Quality Enforce peer Code Review, require comprehensive unit tests with boundary assertions, and mandate full regression testing before any release.
Architecture Design Apply defensive programming, keep core services independent of non‑core ones, provide graceful degradation, implement thread isolation, and configure rate‑limiting for capacity protection.
Network Interaction Define three interaction states (success, failure, unknown) with unambiguous response codes and follow protocol‑defined handling for unknown outcomes.
Interface Specification Clearly define business fields, enforce single‑purpose semantics, and ensure backward‑compatible upgrades without overloading existing meanings.
Disaster Recovery (LDC) Clarify zone logic (G‑zone, R‑zone, C‑zone), enable fast fail‑over, and match disaster‑recovery capacity through regular drills; for transactional data, prefer remote fail‑over databases and batch large transactions.
Middleware Usage Ensure unique groupId for messaging, implement idempotent consumption, monitor transaction message callbacks, design cache to avoid penetration with hot‑key mitigation, configure distributed‑transaction monitoring, schedule tasks without overlap, apply token‑bucket or QPS algorithms for rate limiting, and manage database connection pools and FO mechanisms.
Data Quality Follow data‑development standards, perform smoke, simulation, and gray‑scale testing, monitor key metrics (non‑null primary keys, duplicate avoidance), and establish risk‑governance rules with escalation paths.
Production Change Management Plan changes weekly, conduct pre‑change monitoring and emergency preparation, use gray releases and batch roll‑outs, validate with pre‑ and post‑change checks, observe live systems, and enforce the three‑blade principle (monitoring, gray‑release, emergency fallback) with penalties for violations.
Emergency Response Maintain on‑call readiness with device backup, respond to alerts within five minutes, escalate high‑risk incidents, prioritize recovery, rollback offending changes, apply capacity throttling, and leverage site‑level disaster‑recovery switches when needed.
Client & Frontend Guidelines Allocate complex business logic to backend services, keep frontend focused on presentation, ensure cross‑device compatibility, guard against null‑pointer and boundary errors, optimize rendering to reduce main‑thread load, and protect personal data through masking and isolated logging.
Cognitive Technology Team
Cognitive Technology Team regularly delivers the latest IT news, original content, programming tutorials and experience sharing, with daily perks awaiting you.
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.