Skip to main content
Clean Code 60 XP · 6 min

Coherence & Clarity

Apply the same pattern everywhere, avoid conceptual clutter, and never couple unrelated concerns.

Showing
Ad (728×90)

Consistency

G11: If you do something one way, do it that way everywhere. If you call a function fetchUser in one place, don't call a similar function loadUser somewhere else. The difference will confuse every reader into thinking the difference is intentional. When there is no difference, there should be no different name.

Conceptual Clutter & Artificial Coupling

G12: Clutter is code that doesn't earn its place. Default constructors with no implementation, variables never used, comments that say nothing — all add noise and zero value. G17: Artificial coupling is when unrelated things share a location for the developer's convenience. Enums defined in a class that doesn't use them, utility functions placed wherever the developer happened to be — these force readers to hunt for things in illogical places. Every piece of code should live where a reader would naturally look for it.

Code Challenge

Standardize the method naming convention across the service class.

Key takeaway

Coherence is a promise to every future reader: when you see a pattern, it means the same thing everywhere.

Done with this lesson?

Mark it complete to earn XP and track your progress.