Code Smell 06 - Too Clever Programmer
Code is difficult to read, and tricky with names without semantics. Sometimes using language's accidental complexity.

TL;DR: Don't try to look too smart. Clean code emphasizes readability and simplicity.
Problems π
Readability
Maintainability
Code Quality
Premature Optimization
Solutions π
Refactor the code
Use good names
Refactor tricky code
Prefer clarity first
Avoid hidden tricks
Optimize only later with strong real evidence
Refactorings βοΈ
Examples
- Optimized loops
Context π¬
You might feel the urge to show off your skills with complex tricks or cryptic names.
This makes your code harder to read, debug, and extend.
You must remember that you write code for humans, not machines.
Sample Code π
Wrong π«
function primeFactors(n) {
var f = [], i = 0, d = 2;
for (i = 0; n >= 2; ) {
if(n % d == 0) {
f[i++]=(d);
n /= d;
}
else {
d++;
}
}
return f;
}
Right π
function primeFactors(numberToFactor) {
var factors = [],
divisor = 2,
remainder = numberToFactor;
while(remainder>=2) {
if(remainder % divisor === 0) {
factors.push(divisor);
remainder = remainder / divisor;
}
else {
divisor++;
}
}
return factors;
}
Detection π
[X] Semi-Automatic
Automatic detection is possible in some languages.
Look for warnings about complexity, bad names, post-increment variables, and similar patterns.
Exceptions π
- Optimized code for low-level operations.
Tags π·οΈ
- Complexity -
Level π
[X] Intermediate
Why the Bijection Is Important πΊοΈ
When you keep a clear bijection between your program and the MAPPER, other developers can understand it quickly.
Clever tricks break this mapping and force future readers to guess instead of reading.
AI Generation
AI models sometimes generate clever one-liners or compressed solutions.
They might look smart but lack readability and semantics.
AI Detection π§²
AI assistants can rewrite clever code into readable code if you instruct them to prefer clarity to optimization.
Try Them! π
Remember: AI Assistants make lots of mistakes
Suggested Prompt: correct=Remove cleverness from code
| Without Proper Instructions | With Specific Instructions |
| ChatGPT | ChatGPT |
| Claude | Claude |
| Perplexity | Perplexity |
| Copilot | Copilot |
| You | You |
| Gemini | Gemini |
| DeepSeek | DeepSeek |
| Meta AI | Meta AI |
| Grok | Grok |
| Qwen | Qwen |
Conclusion π
Clever developers write cryptic code to brag.
Smart developers write clean code.
Clear beats clever.
Relations π©ββ€οΈβπβπ¨
More Information π
Also Known as
- Obfuscator
Credits π
Photo by NeONBRAND on Unsplash
Programming can be fun, so can cryptography; however they should not be combined.
Kreitzberg & Shneiderman
This article is part of the CodeSmell Series.





