DEV Community

loading...
Cover image for Code Smell 06 - Too Clever Programmer

Code Smell 06 - Too Clever Programmer

mcsee profile image Maxi Contieri Originally published at maximilianocontieri.com Updated on ・1 min read

Code difficult to read, tricky with names without semantic. Sometimes using language's accidental complexity.

Problems

  • Readability

  • Maintainability

  • Code Quality

  • Premature Optimization

Solutions

Examples

  • Optimized loops

Exceptions

  • Code that must be optimized for low level operations.

Sample Code

Wrong

Right

Detection

Automatic detection is possible in some languages related to complexity, bad names, post increment variables.

Relations

Also Known as

  • Obfuscator

More info

Tags

  • Declarative

Credits

Photo by NeONBRAND on Unsplash

Discussion (6)

pic
Editor guide
Collapse
tayyabtalha profile image
Tayyab Talha

There is no difference between wrong and right code.

Collapse
oloryn profile image
Ben Coleman

Refresh the page. This appears to be a bug in (at least) the Android DEV app.

Collapse
tayyabtalha profile image
Tayyab Talha

Yep you are right

Collapse
mcsee profile image
Maxi Contieri Author

From a machine point of view it isn't. The semantic parsing trees are equivalent

Collapse
dakujem profile image
Andrej Rypo

The code in the "wrong" example is not being clever at all. It's just obfuscated. That kind is typically written by juniors trying to look smart.
I'd swap the "A.K.A." section with the headline.

Collapse
bn_geek profile image
Mohcin Bounouara

In the point.