Table of Contents

Rule of Explicitness (RoE)

Variants and Alternative Names

Context

Principle Statement

Explicit is better than implicit.

Description

Solutions often differ in the level of explicitness. A feature can be implemented explicitly or it can be a side-effect of the implementation of another feature or a more general functionality. The same applies to module communication. A module can invoke another module directly or there can be various forms of indirections like events or observers.

RoE states that explicit solutions are better than implicit ones. Indirection, side-effects, configuration files, implicit conversions, etc. should be avoided.

Rationale

If something is realized explicitly, it is easier to understand. Implicit solutions require the developer to have a deeper understanding of the module as it is necessary to “read between the lines”. Implicit solutions also tend to be more complex. So explicit solutions are assumed to be less error-prone and easier to maintain.

Strategies

Caveats

See section contrary principles.

Origin

Evidence

Relations to Other Principles

Generalizations

Specializations

Contrary Principles

Complementary Principles

Principle Collections

OOD Principle Language
General Principles
ML KISS MIMC DRY GP RoE
Modularization Principles
MP HC ECV
Module Communication Principles
TdA/IE LC DIP
Interface Design Principles
EUHM PLS UP
Internal Module Design Principles
IH/E IAP LSP PSU

Examples

Description Status

Incomplete

Further Reading

Discussion

Discuss this wiki article and the principle on the corresponding talk page.

1) , 3)
Tim Peters: The Zen of Python
2)
Guido van Rossum: Python's Design Philosophy
4) , 5)
Martin Fowler: To Be Explicit