Smart code takes complex problems and simplifies them in a way that makes them easily understandable by the whole team. Clever code, whether the original problem was complex or not, presents a complex solution that's difficult to follow.
Have you ever poured a lot of work into something only to have a coworker say "how simple - I thought that would be a lot harder?" That's smart code, but your coworker was expecting clever.
Those are the meanings people are using in the conversations about clever code.
Right, I'm completely okay with that. I guess I just don't understand why there are regularly blog posts trying to explain what should be common sense: "write code that it nice to read and maintain".
The thing is, getting to the point where you can write good code takes experience, not blog posts that say that recursion and tertiary operators are always "clever".
> Right, I'm completely okay with that. I guess I just don't understand why there are regularly blog posts trying to explain what should be common sense: "write code that it nice to read and maintain".
Because “nice to read and easy to maintain” is a goal, not something trivial to evaluate while writing (especially the easy to maintain, which, among other things, is dependent on what the actual future needs will be), and acheiving that involves balancing competing factors, opinions on how to do it conflict, experience of what works varies, and clear and applicable science about both the broad trends and what explains specific variations from the trends is sparse.
Smart code is maintainable. Clever code is not.
Smart code takes complex problems and simplifies them in a way that makes them easily understandable by the whole team. Clever code, whether the original problem was complex or not, presents a complex solution that's difficult to follow.
Have you ever poured a lot of work into something only to have a coworker say "how simple - I thought that would be a lot harder?" That's smart code, but your coworker was expecting clever.
Those are the meanings people are using in the conversations about clever code.