Fundamentals 5 min read

Understanding Code Smells: Module, Function, and Implementation Level Issues

This article explains how Tencent evaluates code quality at module, function, and implementation levels, describing common code smells such as low cohesion, God classes, developer congestion, God functions, DRY violations, nested complexity, and Bumpy Road, and emphasizes the importance of identifying and fixing these issues to improve maintainability and team efficiency.

Continuous Delivery 2.0
Continuous Delivery 2.0
Continuous Delivery 2.0
Understanding Code Smells: Module, Function, and Implementation Level Issues

1. Introduction

We often say "this code is terrible", but what does that really mean and how should we address it?

At Tencent, code quality is evaluated at three levels: 模块(类)级 , 函数级 , and 具体实现级 .

Below is a brief (non‑exhaustive) overview of some of the smells.

2. Module‑level Smells

Low Cohesion

A module/class contains multiple unrelated responsibilities, violating the Single Responsibility Principle (measured by LCOM4).

God Class

A massive module with many lines of code, numerous functions, and at least one complex core method.

Developer Congestion

When several developers work on the same code segment simultaneously, a bottleneck occurs.

Legacy Complex Code from Former Developers

When the developer responsible for a low‑health code area leaves, maintenance risk rises significantly.

3. Function‑level Smells

God Function

A complex function that concentrates too many behaviors, becoming a local hotspot.

Violation of DRY Principle

Duplicated logic that is expected to be changed together.

Complex Method

Excessive conditional statements (if, for, while) increase cyclomatic complexity and reduce code health.

Primitive Obsession

Overuse of built‑in primitive types without encapsulation.

Large Method

A function with too many lines of code, making it hard to understand.

4. Implementation‑level Smells

Nested Complexity

Nested if statements or loops raise the risk of defects.

Bumpy Road

A function or method that contains multiple logical blocks, making reading and maintenance feel like traveling on a rough road; it indicates a lack of encapsulation and can lead to tangled state management.

Complex Condition

Expressions with many logical operators (AND/OR) in a branch increase comprehension difficulty.

Large Assertion Block

Consecutive assertion statements suggest missing abstraction.

Repeated Assertion Block

Copy‑pasted assertions in tests violate the DRY principle.

5. Conclusion

Code quality impacts project maintainability, team efficiency, and software longevity; identifying and fixing code smells is essential for professional developers.

By applying the insights shared here, developers can continuously improve code structure, enhance engineering quality, and achieve smoother collaboration and more efficient delivery.

Let’s hold ourselves to higher standards and write code that satisfies both ourselves and our teammates.

software engineeringbest practicescode qualitymaintainabilitycode smells
Continuous Delivery 2.0
Written by

Continuous Delivery 2.0

Tech and case studies on organizational management, team management, and engineering efficiency

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.