'''How is a code smell defined?''' A CodeSmell is an attribute of code that frequently needs to be debugged, or is hard to add features to. In practice, a CodeSmell is a warning sign. It is an alarm that says, "investigate more carefully and proceed with caution". It is not a guarantee that something is wrong, but merely a hint that problems may be brewing. It is like when your children are quiet for too long a period. Children are generally not quiet unless they are up to something suspicious or fall asleep. '''How are new types of code smells identified?''' Code smells often show up in debugging process flow charts. For example, if a CeePlusPlus program ought to compile, but does not, the problem is probably related to a code smell listed in CeePreprocessorStatements. '''How are specific instances of code smells identified?''' A programmer identifies a smell in particular code by (mentally) running through a catalog of known smells, and checking for matches. Three catalogs of code smells are: * Martin Fowler. ''Refactoring: Improving the Design of Existing Code.'' [ISBN: 0201485672]. http://www.refactoring.com * Arthur J. Riel. ObjectOrientedDesignHeuristics. Riel doesn't use the term smelly, but his Heuristics are a good catalog of what smells and what doesn't. * The CodeSmell page. Good descriptions of code smells include practical tests for "sniffing" pieces of code. For example, ThreeStrikesAndYouRefactor is a practical test for code duplication. '''How does one learn and become proficient in detecting smells? WhatIsRefactoring and what part does it play?''' The best explanation is probably in the book "Refactoring: Improving the Design of Existing Code" (ISBN: 0201485672) by MartinFowler. Also see http://www.refactoring.com The WhatIsRefactoring page defines refactoring. As you refactor code, you will get practice detecting smells, and fixing their underlying causes. Fowler's book provides a great deal of practice. Refactoring can be used several ways: * To repair an architecture that has deteriorated due to patchwork changes that ignored the overall architecture. * To adapt an existing design to changed requirements. * To change the overall architecture of the program. * To discover a suitable architecture for previously unorganized legacy code. ---- ---- '''Rough[er] drafts:''' CodeSmell is used quite extensively in pages to describe a software imperfection or other symptom of a DesignFlaw. Often, a better, faster, stronger, or more appropriate method or means can be devised to "take away the smell". However used, it seems that software that smells, does not smell like a rose. * The words "scent" or "fragrance" are used when one desires a positive connotation. Most "smells" are bad. ---- Is it a subtractive or additive process? ---- ---- Tentative definition: : A smell is a symptom that something is wrong, but not the cause. Don't fix the smell; look deeper for the cause. For example, people might say : If your code is hard to UnitTest, that's a smell that your code is poorly factored. Having code that's difficult to UnitTest, then, is the smell. PoorlyFactoredCode is the cause. ---- Smell is the experience of a difference which depends on movement. That is you have to move into and out of an area to experience the smell that is there. If you're there too long then you no longer smell the smell that is there. For example, here is an article describing a scene that reeks to me, that wouldn't reek to someone immersed in the Agile Movement. It reeks to me because they've been talking about the same things for 5 years now. They haven't moved. http://story.news.yahoo.com/news?tmpl=story&ncid=1209&e=2&u=/infoworld/20050315/tc_infoworld/57717&sid=96742532 ---- '''Discussion:''' Thanks