Fundamentals 15 min read

What Defines Good Code? Multi‑Dimensional Standards, Bad Smells, and Design Patterns Explained

This article explores what makes code truly good by examining functional, stability, user experience, efficiency, and cost dimensions, presenting the "Gold Code" evaluation criteria, discussing design principles, common code smells, practical examples, and how design patterns and layering affect readability and maintainability.

DaTaobao Tech
DaTaobao Tech
DaTaobao Tech
What Defines Good Code? Multi‑Dimensional Standards, Bad Smells, and Design Patterns Explained

What Is Good Code?

Good code is not only about meeting functional requirements and stability; it must also consider user experience, development efficiency, maintainability, and cost control. The author references the "Gold Code" award criteria, which quantifies these four dimensions.

Four Evaluation Dimensions

Stability (40 points) : High availability, fault tolerance, and business continuity.

Experience (30 points) : User‑friendly interfaces, performance, and clear error messages.

Efficiency (20 points) : Development speed, runtime performance, and operational ease.

Cost (10 points) : Resource usage, operational overhead, and testing expenses.

Code Review Standards

The "Gold Code" review emphasizes avoiding bad smells, over‑layering, and overly complex frameworks that hurt readability and maintainability. Consensus among reviewers is crucial for objective evaluation.

Common Bad Smells and Fixes

Examples include using lowercase l for long literals, magic numbers, inefficient collection usage, and unsafe constructors like new BigDecimal(double). Each bad smell is illustrated with a long value = 1l; example and a corrected version using long value = 1L;.

Design Principles and Patterns

The article highlights the Open‑Closed Principle and the Chain of Responsibility pattern as ways to keep code extensible without modification. Real‑world examples from transaction systems demonstrate how these principles improve modularity and reduce coupling.

Layering and Readability Challenges

Excessive layering can lead to context propagation overhead (e.g., using ThreadLocal) and make the codebase harder to understand. The author advocates for minimal, purposeful layers and warns against over‑engineering.

Conclusion

Good code evolves with changing priorities; teams must continuously balance stability, experience, efficiency, and cost. Consensus‑driven standards and disciplined design help produce maintainable, high‑quality software.

code reviewcode qualitysoftware designgood code
DaTaobao Tech
Written by

DaTaobao Tech

Official account of DaTaobao Technology

0 followers
Reader feedback

How this landed with the community

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.