Return to site

Comment the why, not the obvious what—getters, setters, constructors don’t need notes

· cleancode,programmmer
Section image

🚀 CLEAN CODE REMINDER: COMMENTS THAT COUNT

“Comment the why, not the obvious what—getters, setters, constructors don’t need notes.”

When code is self-explanatory, extra comments add noise. Save comments for intent, trade-offs, and surprising decisions:

✅ Explain why a rule exists, a constraint, or a workaround.

✅ Capture domain knowledge, edge cases, and assumptions.

❌ Don’t narrate trivial code (e.g., getters/setters/constructors).

Keep it crisp. Let code show the what. Use comments to preserve the why. ✍️

#CleanCode #Java #SpringBoot #Readability #CodeQuality #SoftwareEngineering #DevBestPractices #Refactoring #Comments #Maintainability