Friday, August 4, 2023

Code Smell

"A code smell is a surface indication that usually corresponds to a deeper problem in the system. The term was first coined by Kent Beck while helping me with my [Martin Fowler] Refactoring book.

The quick definition above contains a couple of subtle points. Firstly a smell is by definition something that's quick to spot - or sniffable as I've recently put it. A long method is a good example of this.

The second is that smells don't always indicate a problem. Some long methods are just fine. You have to look deeper to see if there is an underlying problem there - smells aren't inherently bad on their own - they are often an indicator of a problem rather than the problem themselves." ~ Martin Fowler

source: https://martinfowler.com/bliki/CodeSmell.html

During code reviews, when you sniff a smell, link to the 'Smells and Heuristics' chapter from Bob Martin's excellent book: Clean Code

Clean Code: Smells and Heuristics

Suggested:


 

No comments:

Post a Comment