4 ms·
This is my thought. I LIKE to read clever code. Most often than not it teaches me something. Some neat way to do x. It teaches how to write terse code and I'm p
by gaastonsr 10y ago
This is my thought. I LIKE to read clever code. Most often than not it teaches me something. Some neat way to do x. It teaches how to write terse code and I'm probably going to learn how to apply that to other areas of my code.
I would be worried if my code is being reviewed by somebody who doesn't appreciate clever code.
Now, clever is different than complex, or confusing code. Clever code is a neat way to do something. Complex and confusing code can be spotted immediately because it does one or many of the following things:
- Functions get too nested
- Tries to do too much
- Function is too long
- Function is not broken into logical parts
- Confusing parts don't have their own function
- Long conditionals
- Non descriptive variable names
- Modifies state all over the place
And I could go on. Those are the things I would watch out for and that really take a cognitive load on me.
Also, clever code is different than tricky code. To try to use a programming language quirk is crazy. You're asking for your code to be hard to read. Using a little known useful feature is good way to extend your team knowledge of a PL.