Clean Code Principles
Status: draft · Confidence: medium (0.635) · Basis: verified_sources
Quality notes: placeholder_content, generic_source_homepage, no_verified_sources, partial_source_verification
## TL;DR Clean Code principles (Robert C. Martin) guide writing readable, maintainable code. Key rules: meaningful names (reveal intent), small functions (do one thing), minimal arguments (0-2 ideal), no side effects, DRY (Don't Repeat Yourself), comments explain WHY not WHAT. Code is read 10x more than written. ## Core Explanation Meaningful names: `customerList` not `cl`, `calculateTotalPrice` not `calc`. Functions: should be small (20 lines max), do one thing at one level of abstraction. Comments: explain intent, warn of consequences, TODO notes. Don't comment bad code — rewrite it. Error handling: use exceptions over return codes, provide context. Boy Scout Rule: leave the code cleaner than you found it. ## Further Reading - [Clean Code (Robert C. Martin)](undefined) ## Related Articles - [AI for Code Translation: Language Migration, Legacy Modernization, and Transpilation](../../ai/ai-code-translation.md) - [AI Coding Assistants: Copilot, Cursor, and Claude Code](../../ai/ai-coding-assistants.md) - [AI for Code Generation: LLMs as Software Engineering Copilots](../../ai/ai-for-code-generation.md)