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 refactoring
(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!
{{short description|Restructuring existing computer code without changing its external behavior}} {{Redirect|Refactoring|its use on Wikipedia|Wikipedia:Refactoring talk pages|selfref = true}} {{About-distinguish|a behaviour-preserving change|Rewrite (programming)}} In [[computer programming]] and [[software design]], '''code refactoring''' is the process of restructuring existing [[source code]]—changing the ''[[decomposition (computer science)|factoring]]''—without changing its external behavior. Refactoring is intended to improve the design, structure, and/or implementation of the [[software]] (its ''[[non-functional requirement|non-functional]]'' attributes), while preserving its [[functional requirement|functionality]]. Potential advantages of refactoring may include improved code [[readability]] and reduced [[cyclomatic complexity|complexity]]; these can improve the source code's [[maintainability]] and create a simpler, cleaner, or more expressive internal [[software architecture|architecture]] or [[object model]] to improve [[extensibility]]. Another potential goal for refactoring is improved performance; software engineers face an ongoing challenge to write programs that perform faster or use less memory. Typically, refactoring applies a series of standardized basic ''micro-refactorings'', each of which is (usually) a tiny change in a computer program's source code that either preserves the behavior of the software, or at least does not modify its conformance to functional requirements. Many [[Development environment (software development process)|development environments]] provide automated support for performing the mechanical aspects of these basic refactorings. If done well, code refactoring may help software developers discover and fix hidden or dormant [[software bug|bugs]] or [[vulnerability (computing)|vulnerabilities]] in the system by simplifying the underlying logic and eliminating unnecessary levels of complexity. If done poorly, it may fail the requirement that external functionality not be changed, and may thus introduce new bugs. {{Blockquote|By continuously improving the design of code, we make it easier and easier to work with. This is in sharp contrast to what typically happens: little refactoring and a great deal of attention paid to expediently add new features. If you get into the hygienic habit of refactoring continuously, you'll find that it is easier to extend and maintain code.|Joshua Kerievsky, ''Refactoring to Patterns''<ref name=kerievsky>{{cite book | last = Kerievsky | first = Joshua | title = Refactoring to Patterns | publisher = Addison Wesley | year = 2004 }}</ref>}}
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)