Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Code smell
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Definition== One way to look at smells is with respect to principles and quality: "Smells are certain structures in the code that indicate violation of fundamental design principles and negatively impact design quality".<ref>{{cite book|last1=Suryanarayana|first1=Girish|title=Refactoring for Software Design Smells|date=November 2014|publisher=Morgan Kaufmann|isbn=978-0128013977|pages=258}}</ref> Code smells are usually not [[software bug|bugs]]; they are not technically incorrect and do not prevent the program from functioning. Instead, they indicate weaknesses in design that may slow down development or increase the risk of bugs or failures in the future. Bad code smells can be an indicator of factors that contribute to [[technical debt]].<ref name="Tufano2015" /> [[Robert C. Martin]] calls a list of code smells a "value system" for software craftsmanship.<ref>{{Cite book|title = Clean Code: A Handbook of Agile Software Craftsmanship|last = Martin|first = Robert C.|publisher = Prentice Hall|year = 2009|isbn = 978-0-13-235088-4|chapter = 17: Smells and Heuristics|author-link = Robert C. Martin}}</ref> Contrary to these severe interpretations, Cunningham's original definition was that a smell is a suggestion that something may be wrong, not evidence that there is already a problem.<ref name="Cunningham"/> Often the deeper problem hinted at by a code smell can be uncovered when the code is subjected to a short [[Feedback|feedback cycle]], where it is [[Code refactoring|refactored]] in small, controlled steps, and the resulting design is examined to see if there are any further code smells that in turn indicate the need for more refactoring. From the point of view of a programmer charged with performing refactoring, code smells are [[Heuristic (computer science)|heuristics]] to indicate when to refactor, and what specific refactoring techniques to use. Thus, a code smell is a driver for refactoring. Factors such as the understandability of code, how easy it is to be modified, the ease in which it can be enhanced to support functional changes, the code's ability to be reused in different settings, how testable the code is, and code reliability are factors that can be used to identify code smells.<ref> Suryanarayana, Girish, Ganesh Samarthyam, and Tushar Sharma. Refactoring for Software Design Smells : Managing Technical Debt / Girish Suryanarayana, Ganesh Samarthyam, Tushar Sharma. 1st edition. Waltham, Massachusetts ; Morgan Kaufmann, 2015. Print.</ref> A 2015 study<ref name="Tufano2015" /> utilizing automated analysis for half a million source code [[Commit (version control)|commits]] and the manual examination of 9,164 commits determined to exhibit "code smells" found that: * There exists empirical evidence for the consequences of "technical debt", but there exists only anecdotal evidence as to ''how'', ''when'', or ''why'' this occurs. * Common wisdom suggests that urgent maintenance activities and pressure to deliver features while prioritizing time-to-market over code quality are often the causes of such smells. Tools such as [[Checkstyle]], [[PMD (software)|PMD]], [[FindBugs]], and [[SonarQube]] can automatically identify code smells.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)