DEV Community

Discussion on: Explain "Code Smells" like I'm five

Collapse
 
mnmnotmail profile image
TMTP messaging protocol • Edited

It's a simplistic, insulting way to criticize someone else's work, often stemming from an inconsequential difference of opinion. You should never tell someone that.

If you have a considered critique, explain politely why a solution may not meet its known requirements, or could break down in future conditions. (You may be wrong, after all.)

There is far too much arrogance and mean-spiritedness in online software communities.

Collapse
 
mcsee profile image
Maxi Contieri

I agree there's certain arrogance. But good of bad code is not just a matter of opinion.

There so much written about it.

I've written a series of 56 code smells (so far). They all show the problems and all of them show solutions. It is not just criticizing others work but to build amazing software

Collapse
 
ashleyjsheridan profile image
Ashley Sheridan

I don't know if that's entirely fair, but I must assume that that has been your experience so far?

Personally, I dislike the term "code smell", but I appreciate the concept it's trying to convey. Yes, it can be a blunt tool used by developers who blindly follow coding standards dogmatically, but even Robert Martin himself argues against that.

In terms of the code review usage, I take the approach that anything I make a comment on is something that I would be ok if someone left the same (or equivalent) comment on some of my own code during a review. Code reviews should never be used by a senior (either in general development terms or in a specific language) developer to try and show up one who is less senior. They're a place to learn, and that goes both ways. They should also be treated like any face-to-face conversation in that rudeness should be unacceptable. Besides, being civil to people always gets better results than rudeness.

So, I hope you're not completely put off by the concept of a "code smell" (again, I think it's a poor naming choice) because it really can lead any developer to be better when the concept is used appropriately.