<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.tachyony.co.uk/w/index.php?action=history&amp;feed=atom&amp;title=Code_refactoring</id>
	<title>Code refactoring - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.tachyony.co.uk/w/index.php?action=history&amp;feed=atom&amp;title=Code_refactoring"/>
	<link rel="alternate" type="text/html" href="https://wiki.tachyony.co.uk/w/index.php?title=Code_refactoring&amp;action=history"/>
	<updated>2026-06-27T17:26:42Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://wiki.tachyony.co.uk/w/index.php?title=Code_refactoring&amp;diff=32274&amp;oldid=prev</id>
		<title>imported&gt;Florian Blaschke: MOS:ANDOR</title>
		<link rel="alternate" type="text/html" href="https://wiki.tachyony.co.uk/w/index.php?title=Code_refactoring&amp;diff=32274&amp;oldid=prev"/>
		<updated>2026-05-15T23:20:36Z</updated>

		<summary type="html">&lt;p&gt;&lt;a href=&quot;/w/index.php?title=MOS:ANDOR&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;MOS:ANDOR (page does not exist)&quot;&gt;MOS:ANDOR&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{short description|Restructuring existing computer code without changing its external behavior}}&lt;br /&gt;
{{Redirect|Refactoring|its use on Wikipedia|Wikipedia:Refactoring talk pages|selfref = true}}&lt;br /&gt;
{{About-distinguish|a behaviour-preserving change|Rewrite (programming)}}&lt;br /&gt;
&lt;br /&gt;
In [[computer programming]] and [[software design]], &amp;#039;&amp;#039;&amp;#039;code refactoring&amp;#039;&amp;#039;&amp;#039; is the process of restructuring existing [[source code]]—changing the &amp;#039;&amp;#039;[[decomposition (computer science)|factoring]]&amp;#039;&amp;#039;—without changing its external behavior. Refactoring is intended to improve the design, structure, or implementation of the [[software]] (its &amp;#039;&amp;#039;[[non-functional requirement|non-functional]]&amp;#039;&amp;#039; 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&amp;#039;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. Despite the availability of metrics intended to assess such attributes, developers often do not rely on them when making refactoring decisions due to concerns about its practical usefulness.&amp;lt;ref&amp;gt;{{Citation |last=Tempero |first=Ewan |title=Making Software Metrics Useful |date=2026-03-16 |url=http://arxiv.org/abs/2603.16012 |access-date=2026-03-20 |publisher=arXiv |doi=10.48550/arXiv.2603.16012 |id=arXiv:2603.16012 |last2=Ralph |first2=Paul}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Typically, refactoring applies a series of standardized basic &amp;#039;&amp;#039;micro-refactorings&amp;#039;&amp;#039;, each of which is (usually) a tiny change in a computer program&amp;#039;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.&lt;br /&gt;
&lt;br /&gt;
{{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&amp;#039;ll find that it is easier to extend and maintain code.|Joshua Kerievsky, &amp;#039;&amp;#039;Refactoring to Patterns&amp;#039;&amp;#039;&amp;lt;ref name=kerievsky&amp;gt;{{cite book | last = Kerievsky | first = Joshua | title = Refactoring to Patterns | publisher = Addison Wesley | year = 2004  }}&amp;lt;/ref&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
Refactoring is usually motivated by noticing a [[code smell]].&amp;lt;ref name=&amp;quot;fowler&amp;quot;/&amp;gt; For example, the method at hand may be very long, or it may be a near [[duplicate code|duplicate]] of another nearby method. Once recognized, such problems can be addressed by &amp;#039;&amp;#039;refactoring&amp;#039;&amp;#039; the source code, or transforming it into a new form that behaves the same as before but that no longer &amp;quot;smells&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
For a long routine, one or more smaller subroutines can be extracted. For duplicate routines, the duplication can be removed and replaced with one shared function. Failure to perform refactoring can result in accumulating [[technical debt]]; on the other hand, refactoring is one of the primary means of repaying technical debt.&amp;lt;ref&amp;gt;{{cite book|last1=Suryanarayana|first1=Girish|title=Refactoring for Software Design Smells|date=November 2014|publisher=Morgan Kaufmann|isbn=978-0-12-801397-7|page=258}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Benefits==&lt;br /&gt;
There are two general categories of benefits to the activity of refactoring.&lt;br /&gt;
# [[Maintainability]]. It is easier to fix bugs because the source code is easy to read and the intent of its author is easy to grasp.&amp;lt;ref name=martin&amp;gt;{{cite book | last = Martin | first = Robert |title = Clean Code | publisher = Prentice Hall | year = 2009}}&amp;lt;/ref&amp;gt; This might be achieved by reducing large monolithic routines into a set of individually concise, well-named, single-purpose methods. It might be achieved by moving a method to a more appropriate class or by removing misleading comments.&lt;br /&gt;
# [[Extensibility]]. It is easier to extend the capabilities of the application if it uses recognizable [[design pattern (computer science)|design patterns]], and it provides some flexibility where none before may have existed.&amp;lt;ref name=kerievsky/&amp;gt;&lt;br /&gt;
[[Performance engineering]] can remove inefficiencies in programs, known as software bloat, arising from traditional software-development strategies that aim to minimize an application&amp;#039;s development time rather than the time it takes to run. Performance engineering can also tailor [[software]] to the [[Hardware security module|hardware]] on which it runs, for example, to take advantage of parallel processors and vector units.&amp;lt;ref&amp;gt;{{Cite journal|doi=10.1126/science.aam9744|doi-access=free|title=There&amp;#039;s plenty of room at the Top: What will drive computer performance after Moore&amp;#039;s law?|year=2020|last1=Leiserson|first1=Charles E.|last2=Thompson|first2=Neil C.|last3=Emer|first3=Joel S.|last4=Kuszmaul|first4=Bradley C.|last5=Lampson|first5=Butler W.|last6=Sanchez|first6=Daniel|last7=Schardl|first7=Tao B.|journal=Science|volume=368|issue=6495|article-number=eaam9744|pmid=32499413 |bibcode=2020Sci...368m9744L }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Timing and responsibility==&lt;br /&gt;
There are two possible times for refactoring.&lt;br /&gt;
# Preventive refactoring – the original developer of the code makes the code more robust when it is still free of [[Code smell|smells]] to prevent the formation of smells in the future.&amp;lt;ref name=&amp;quot;fraivert2022&amp;quot;&amp;gt;&lt;br /&gt;
{{Cite conference&lt;br /&gt;
|last1=Fraivert|first1=Dov&lt;br /&gt;
|last2=Lorenz|first2=David H.&lt;br /&gt;
|title=Language Support for Refactorability Decay Prevention&lt;br /&gt;
|date=2022&lt;br /&gt;
|book-title=Proceedings of the 21st ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences&lt;br /&gt;
|pages=122–134&lt;br /&gt;
|doi=10.1145/3564719.3568688&lt;br /&gt;
|isbn=978-1-4503-9920-3&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Corrective refactoring – a subsequent developer performs refactoring to correct [[code smell]]s as they occur.&amp;lt;ref name=&amp;quot;fraivert2022&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A method that balances preventive and corrective refactoring is &amp;quot;shared responsibility for refactoring&amp;quot;.&lt;br /&gt;
This approach splits the refactoring action into two stages and two&lt;br /&gt;
roles. The original developer of the code just prepares the code for refactoring, and when the [[code smell]]s form, a subsequent developer carries out the actual refactoring action.&amp;lt;ref name=&amp;quot;fraivert2022&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Challenges==&lt;br /&gt;
Refactoring requires extracting the software system structure, data models, and intra-application dependencies to get back knowledge of an existing software system.&amp;lt;ref&amp;gt;&lt;br /&gt;
{{Cite conference&lt;br /&gt;
|last1=Haendler|first1=Thorsten&lt;br /&gt;
|last2=Neumann|first2=Gustaf&lt;br /&gt;
|book-title=Proceedings of the 11th International Joint Conference on Knowledge Discovery, Knowledge Engineering and Knowledge Management&lt;br /&gt;
|title=A Framework for the Assessment and Training of Software Refactoring Competences&lt;br /&gt;
|s2cid=204754665&lt;br /&gt;
|date=2019&lt;br /&gt;
|pages=307–316&lt;br /&gt;
|doi=10.5220/0008350803070316&lt;br /&gt;
|isbn=978-989-758-382-7&lt;br /&gt;
|doi-access=free&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
The turnover of teams implies missing or inaccurate knowledge of the current state of a system and about design decisions made by departing developers. Further code refactoring activities may require additional effort to regain this knowledge.&amp;lt;ref&amp;gt;&lt;br /&gt;
{{Cite conference&lt;br /&gt;
|last1=Nassif|first1=Matthieu&lt;br /&gt;
|last2=Robillard|first2=Martin P.&lt;br /&gt;
|conference=2017 IEEE International Conference on Software Maintenance and Evolution (ICSME)&lt;br /&gt;
|title=Revisiting Turnover-Induced Knowledge Loss in Software Projects&lt;br /&gt;
|s2cid=13147063&lt;br /&gt;
|date=November 2017&lt;br /&gt;
|pages=261–272&lt;br /&gt;
|doi=10.1109/ICSME.2017.64&lt;br /&gt;
|isbn=978-1-5386-0992-7&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
Refactoring activities generate architectural modifications that deteriorate the structural architecture of a software system. Such deterioration affects architectural properties such as maintainability and comprehensibility, which can lead to a complete re-development of software systems.&lt;br /&gt;
&amp;lt;ref&amp;gt;&lt;br /&gt;
{{Cite journal&lt;br /&gt;
|last1=van Gurp|first1=Jilles&lt;br /&gt;
|last2=Bosch|first2=Jan&lt;br /&gt;
|date=March 2002&lt;br /&gt;
|title= Design erosion: problems and causes&lt;br /&gt;
|journal=Journal of Systems and Software&lt;br /&gt;
|volume=61&lt;br /&gt;
|issue=2&lt;br /&gt;
|pages=105–119&lt;br /&gt;
|doi=10.1016/S0164-1212(01)00152-2&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
Automatic [[unit tests]] should be set up before refactoring to ensure routines still behave as expected.&amp;lt;ref&amp;gt;{{Cite book |title=Refactoring: improving the design of existing code |last=Fowler |first=Martin |date=1999 |publisher=Addison-Wesley |isbn=978-0-201-48567-7 |location=Reading, MA |oclc=41017370 |url=https://archive.org/details/isbn_9780201485677 }}&amp;lt;/ref&amp;gt; Unit tests can bring stability to even large refactors when performed with a single [[Atomic commit#Revision control|atomic commit]]. A common strategy to allow safe and atomic refactors spanning multiple projects is to store all projects in a single [[repository (version control)|repository]], known as [[monorepo]].&amp;lt;ref&amp;gt;{{cite book |last1=Smart |first1=John Ferguson |title=Java Power Tools |date=2008 |publisher=O&amp;#039;Reilly Media, Inc. |isbn=978-1-4919-5454-6 |page=301 |url=https://books.google.com/books?id=kE0UDQAAQBAJ&amp;amp;q=visual+sourcesafe+atomic+commit&amp;amp;pg=PA301 |access-date=26 July 2018 |language=en}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With unit testing in place, refactoring is then an iterative cycle of making a small [[program transformation]], testing it to ensure correctness, and making another small transformation. If at any point a test fails, the last small change is undone and repeated in a different way. Through many small steps the program moves from where it was to where you want it to be. For this very iterative process to be practical, the tests must run very quickly, or the programmer would have to spend a large fraction of their time waiting for the tests to finish. Proponents of [[extreme programming]] and other [[agile software development]] describe this activity as an integral part of the [[software development cycle]]. Refactoring applies to [[test code]] as well as production code; empirical studies show that test refactoring primarily targets low-quality test code exhibiting [[test smell]]s, and improves test code coupling, cohesion, and size, though it does not necessarily improve code coverage.&amp;lt;ref&amp;gt;{{cite journal |last1=Martins |first1=Luana |last2=Pontillo |first2=Valeria |last3=Costa |first3=Heitor |last4=Ferrucci |first4=Filomena |last5=Palomba |first5=Fabio |last6=Machado |first6=Ivan |title=Test code refactoring unveiled: where and how does it affect test code quality and effectiveness? |journal=Empirical Software Engineering |date=2024 |volume=30 |issue=1 |pages=27 |doi=10.1007/s10664-024-10577-y}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Techniques==&lt;br /&gt;
Here are some examples of micro-refactorings; some of these may only apply to certain languages or language types. A longer list can be found in [[Martin Fowler (software engineer)|Martin Fowler]]&amp;#039;s refactoring book&amp;lt;ref name=&amp;quot;fowler&amp;quot;&amp;gt;{{cite book|title=Refactoring. Improving the Design of Existing Code|last=Fowler|first=Martin|publisher=Addison-Wesley|year=1999|isbn=978-0-201-48567-7|pages=[https://archive.org/details/isbn_9780201485677/page/63 63ff]|author-link=Martin Fowler (software engineer)|url=https://archive.org/details/isbn_9780201485677/page/63}}&amp;lt;/ref&amp;gt;{{page needed|date=July 2018}} and website.&amp;lt;ref name=&amp;quot;refactoring.com&amp;quot;&amp;gt;(these are only about OOP however).[http://refactoring.com/catalog/index.html Refactoring techniques in Fowler&amp;#039;s refactoring Website]&amp;lt;/ref&amp;gt; Many development environments provide automated support for these micro-refactorings. For instance, a programmer could click on the name of a variable and then select the &amp;quot;Encapsulate field&amp;quot; refactoring from a [[context menu]]. The IDE would then prompt for additional details, typically with sensible defaults and a preview of the code changes. After confirmation by the programmer, it would carry out the required changes throughout the code.&lt;br /&gt;
===Static analysis===&lt;br /&gt;
[[Static program analysis]] (called &amp;quot;linting&amp;quot; when performed on less strict interpreted languages) detects problems in a valid but substandard program.&lt;br /&gt;
&lt;br /&gt;
* [[Program dependence graph]] - explicit representation of data and control dependencies &amp;lt;ref&amp;gt;&lt;br /&gt;
{{Cite journal&lt;br /&gt;
|last1=Ferrante|first1=Jeanne&lt;br /&gt;
|last2=Ottenstein|first2=Karl J.&lt;br /&gt;
|last3=Warren|first3=Joe D.&lt;br /&gt;
|date=July 1987&lt;br /&gt;
|title= The program dependence graph and its use in optimization&lt;br /&gt;
|journal=ACM Transactions on Programming Languages and Systems &lt;br /&gt;
|volume=9&lt;br /&gt;
|issue=3&lt;br /&gt;
|pages=319–349&lt;br /&gt;
|publisher=ACM&lt;br /&gt;
|doi=10.1145/24039.24041&lt;br /&gt;
|s2cid=505075&lt;br /&gt;
|doi-access=free&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
* System dependence graph - representation of procedure calls between PDG &amp;lt;ref&amp;gt;&lt;br /&gt;
{{Cite conference&lt;br /&gt;
|last1=Donglin|first1=Linag&lt;br /&gt;
|last2=Harrold|first2=M. J.&lt;br /&gt;
|book-title=Proceedings, International Conference on Software Maintenance (Cat. No. 98CB36272)&lt;br /&gt;
|title=Slicing objects using system dependence graphs&lt;br /&gt;
|date=November 2008&lt;br /&gt;
|pages=319–349&lt;br /&gt;
|publisher=IEEE&lt;br /&gt;
|doi=10.1109/ICSM.1998.738527&lt;br /&gt;
|isbn=978-0-8186-8779-2&lt;br /&gt;
|s2cid=18160599&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
* [[Cyclometric complexity]] analysis.&lt;br /&gt;
* [[Software intelligence]] - reverse engineers the initial state to understand existing intra-application dependencies&lt;br /&gt;
&lt;br /&gt;
===Transformations===&lt;br /&gt;
Transformations modify the syntactic representation of a program. Some modifications alter the semantics or structure of the program in a way that improves its flexibility or robustness.  Such modifications require knowledge of the problem domain and intended logic, and thus are infeasible to automate. Modifications exist that make the program easier to read and modify, but which do not alter the underlying logic of the program; these transformations can be automated.&lt;br /&gt;
&lt;br /&gt;
* Techniques that allow for more [[Abstraction (computer science)|abstraction]]&lt;br /&gt;
** [[Field encapsulation|Encapsulate field]] – force code to access the field with getter and setter methods&lt;br /&gt;
** [[Type generalization|Generalize type]] – create more general types to allow for more code sharing&lt;br /&gt;
** Replace type-checking code with state/strategy&amp;lt;ref&amp;gt;{{cite web| url = http://refactoring.com/catalog/replaceTypeCodeWithStateStrategy.html| title = Replace type-checking code with State/Strategy}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
** Replace conditional with [[Polymorphism (computer science)|polymorphism]]&amp;lt;ref&amp;gt;{{cite web| url = http://refactoring.com/catalog/replaceConditionalWithPolymorphism.html| title = Replace conditional with polymorphism}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Techniques for breaking code apart into more logical pieces&lt;br /&gt;
** Componentization breaks code down into reusable semantic units that present clear, well-defined, simple-to-use interfaces.&lt;br /&gt;
** [[Extract class]] moves part of the code from an existing class into a new class.&lt;br /&gt;
** Extract method, to turn part of a larger [[method (computer science)|method]] into a new method. By breaking down code in smaller pieces, it is more easily understandable. This is also applicable to [[Function (programming)|function]]s.&lt;br /&gt;
* Techniques for improving names and location of code&lt;br /&gt;
** Move method or move field – move to a more appropriate [[Class (programming)|class]] or source file&lt;br /&gt;
** Rename method or rename field – changing the name into a new one that better reveals its purpose&lt;br /&gt;
** Pull up – in [[object-oriented programming]] (OOP), move to a [[Superclass (computer science)|superclass]]&lt;br /&gt;
** Push down – in OOP, move to a [[Subclass (computer science)|subclass]]&amp;lt;ref name=&amp;quot;refactoring.com&amp;quot;/&amp;gt;&lt;br /&gt;
* Automatic [[clone detection]]&amp;lt;ref&amp;gt;{{cite conference |first1=M. |last1=Bruntink |first2=A. |last2=van Deursen |first3=T. |last3=Tourwe |first4=R. |last4=van Engelen |title=An evaluation of clone detection techniques for crosscutting concerns |book-title=Proceedings, 20th IEEE International Conference on Software Maintenance |publisher=IEEE |date=2004 |doi=10.1109/ICSM.2004.1357804}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Hardware refactoring==&lt;br /&gt;
While the term &amp;#039;&amp;#039;refactoring&amp;#039;&amp;#039; originally referred exclusively to refactoring of software code, in recent years code written in [[hardware description language]]s has also been refactored. The term &amp;#039;&amp;#039;hardware refactoring&amp;#039;&amp;#039; is used as a shorthand term for refactoring of code in hardware description languages. Since hardware description languages are not considered to be [[programming language]]s by most hardware engineers,&amp;lt;ref&amp;gt;[[Hardware description languages#HDL and programming languages]]&amp;lt;/ref&amp;gt; hardware refactoring is to be considered a separate field from traditional code refactoring.&lt;br /&gt;
&lt;br /&gt;
Automated refactoring of analog hardware descriptions (in [[VHDL-AMS]]) has been proposed by Zeng and Huss.&amp;lt;ref&amp;gt;Kaiping Zeng, Sorin A. Huss, &amp;quot;Architecture refinements by code refactoring of behavioral VHDL-AMS models&amp;quot;. ISCAS 2006&amp;lt;/ref&amp;gt; In their approach, refactoring preserves the simulated behavior of a hardware design. The non-functional measurement that improves is that refactored code can be processed by standard synthesis tools, while the original code cannot. Refactoring of digital hardware description languages, albeit manual refactoring, has also been investigated by [[Synopsys]] [[fellow]] Mike Keating.&amp;lt;ref&amp;gt;M. Keating, &amp;quot;Complexity, Abstraction, and the Challenges of Designing Complex Systems&amp;quot;, in DAC&amp;#039;08 tutorial [http://www.dac.com/events/eventdetails.aspx?id=77-130] {{Webarchive|url=https://web.archive.org/web/20160328163412/https://dac.com/events/eventdetails.aspx?id=77-130|date=2016-03-28}}&amp;quot;Bridging a Verification Gap: C++ to RTL for Practical Design&amp;quot;&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;M. Keating, P. Bricaud: &amp;#039;&amp;#039;Reuse Methodology Manual for System-on-a-Chip Designs&amp;#039;&amp;#039;, Kluwer Academic Publishers, 1999.&amp;lt;/ref&amp;gt; His target is to make complex systems easier to understand, which increases the designers&amp;#039; productivity.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The first known use of the term &amp;quot;refactoring&amp;quot; in the published literature was in a September 1990 article by [[William Opdyke]] and [[Ralph Johnson (computer scientist)|Ralph Johnson]].&amp;lt;ref name=&amp;quot;opdyke90&amp;quot;&amp;gt;{{cite conference&lt;br /&gt;
  | first = William F.&lt;br /&gt;
  | last = Opdyke&lt;br /&gt;
  | author-link = William Opdyke&lt;br /&gt;
  |author2=Johnson, Ralph E.&lt;br /&gt;
  | title = Refactoring: An Aid in Designing Application Frameworks and Evolving Object-Oriented Systems&lt;br /&gt;
  | book-title = Proceedings of the Symposium on Object Oriented Programming Emphasizing Practical Applications (SOOPPA)&lt;br /&gt;
  | publisher = ACM&lt;br /&gt;
  |date=September 1990&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
Although refactoring code has been done informally for decades, [[Bill Griswold|William Griswold]]&amp;#039;s 1991 Ph.D. dissertation&amp;lt;ref name=&amp;quot;griswold-thesis&amp;quot;&amp;gt;{{cite thesis&lt;br /&gt;
  | first = William G&lt;br /&gt;
  | last = Griswold&lt;br /&gt;
  | author-link = Bill Griswold&lt;br /&gt;
  | title = Program Restructuring as an Aid to Software Maintenance&lt;br /&gt;
  | degree = Ph.D.&lt;br /&gt;
  | publisher = University of Washington&lt;br /&gt;
  |date=July 1991&lt;br /&gt;
  | url = https://cseweb.ucsd.edu/~wgg/Abstracts/gristhesis.pdf&lt;br /&gt;
  | access-date = 2011-12-24&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
is one of the first major academic works on refactoring functional and procedural programs, followed by [[William Opdyke]]&amp;#039;s 1992 dissertation&amp;lt;ref name=&amp;quot;opdyke-thesis&amp;quot;&amp;gt;{{cite thesis&lt;br /&gt;
  | first = William F&lt;br /&gt;
  | last = Opdyke&lt;br /&gt;
  | author-link = William Opdyke&lt;br /&gt;
  | title = Refactoring Object-Oriented Frameworks&lt;br /&gt;
  | degree = Ph.D.&lt;br /&gt;
  | publisher = University of Illinois at Urbana-Champaign&lt;br /&gt;
  | date = June 1992&lt;br /&gt;
  | url = https://dl.acm.org/doi/book/10.5555/169783&lt;br /&gt;
  | format = compressed Postscript&lt;br /&gt;
  | access-date = 2008-02-12&lt;br /&gt;
  }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
on the refactoring of object-oriented programs,&amp;lt;ref name=&amp;quot;etymology&amp;quot;&amp;gt;{{cite web| url = http://martinfowler.com/bliki/EtymologyOfRefactoring.html| title = Martin Fowler, &amp;quot;MF Bliki: EtymologyOfRefactoring&amp;quot;}}&amp;lt;/ref&amp;gt; although all the theory and machinery have long been available as [[program transformation]] systems. All of these resources provide a catalog of common methods for refactoring; a refactoring method has a description of how to apply the [[Scientific method|method]] and indicators for when you should (or should not) apply the method.&lt;br /&gt;
&lt;br /&gt;
[[Martin Fowler (software engineer)|Martin Fowler]]&amp;#039;s book &amp;#039;&amp;#039;Refactoring: Improving the Design of Existing Code&amp;#039;&amp;#039; is the canonical reference. {{According to whom|date=July 2018}}&lt;br /&gt;
&lt;br /&gt;
The terms &amp;quot;factoring&amp;quot; and &amp;quot;factoring out&amp;quot; have been used in this way in the [[Forth (programming language)|Forth]] community since at least the early 1980s. Chapter Six of [[Leo Brodie (programmer)|Leo Brodie]]&amp;#039;s book &amp;#039;&amp;#039;[[Thinking Forth]]&amp;#039;&amp;#039; (1984)&amp;lt;ref&amp;gt;{{cite book &lt;br /&gt;
 |last1=Brodie &lt;br /&gt;
 |first1=Leo &lt;br /&gt;
 |title=Thinking Forth &lt;br /&gt;
 |year=2004 &lt;br /&gt;
 |isbn=0-9764587-0-5 &lt;br /&gt;
 |pages=171–196 &lt;br /&gt;
 |publisher=Fig Leaf Press, Forth Interest &lt;br /&gt;
 |url=http://thinking-forth.sourceforge.net &lt;br /&gt;
 |access-date=3 May 2020 &lt;br /&gt;
 |url-status=live &lt;br /&gt;
 |archive-url=https://web.archive.org/web/20051216163615/http://thinking-forth.sourceforge.net/ &lt;br /&gt;
 |archive-date=16 December 2005 &lt;br /&gt;
 }}&amp;lt;/ref&amp;gt; is dedicated to the subject.&lt;br /&gt;
&lt;br /&gt;
In extreme programming, the Extract Method refactoring technique has essentially the same meaning as factoring in Forth: to break down a &amp;quot;word&amp;quot; (or [[Function (programming)|function]]) into smaller, more easily maintained functions.&lt;br /&gt;
&lt;br /&gt;
Refactorings can also be reconstructed&amp;lt;ref name=&amp;quot;What-is-code-refactoring?&amp;quot;&amp;gt;{{cite news&lt;br /&gt;
  | first = Andriy&lt;br /&gt;
  | last = Sokolov&lt;br /&gt;
  | title = What is code refactoring?&lt;br /&gt;
  | url = https://duecode.io/blog/what-is-code-refactoring/&lt;br /&gt;
  }}&amp;lt;/ref&amp;gt; posthoc to produce concise descriptions of complex software changes recorded in software repositories like [[Git]].&lt;br /&gt;
&lt;br /&gt;
==Tools==&lt;br /&gt;
{{More citations needed|section|date=July 2018}}&lt;br /&gt;
Many [[software development tool]]s have features for refactoring. Examples include:&lt;br /&gt;
; [[Android Studio]]: Supports refactoring Java and C++.&lt;br /&gt;
; [[AppCode]]: Supports refactoring [[Objective-C]], C and C++.&lt;br /&gt;
; [[Delphi (software)|Delphi]]: Supports refactoring [[Object Pascal]].&lt;br /&gt;
; [[DMS Software Reengineering Toolkit]]: Supports large-scale refactoring for [[C (programming language)|C]], [[C++]], [[C Sharp (programming language)|C#]], [[COBOL]], [[Java (programming language)|Java]], [[PHP]] and other languages.&lt;br /&gt;
; [[Eclipse (software)|Eclipse]]: Via plugins, supports refactoring Java and to a lesser extent C++, PHP, [[Ruby (programming language)|Ruby]] and [[JavaScript]]&lt;br /&gt;
; [[IntelliJ IDEA]]: Supports refactoring Java.&lt;br /&gt;
; [[JDeveloper]]: Supports refactoring Java.&lt;br /&gt;
; [[NetBeans]]: Supports refactoring Java.&lt;br /&gt;
; [[PhpStorm]]: Supports refactoring PHP.&lt;br /&gt;
; [[PyCharm]]: Supports refactoring Python.&lt;br /&gt;
; [[PyDev]]: Supports refactoring [[Python (programming language)|Python]].&lt;br /&gt;
; [[Smalltalk]]: Most dialects include powerful refactoring tools. Many use the original refactoring browser produced in the early &amp;#039;90s by [[Ralph Johnson (computer scientist)|Ralph Johnson]].&lt;br /&gt;
; [[Visual Assist]]: Supports refactoring C# and C++.&lt;br /&gt;
; [[Visual Studio]]: Supports refactoring [[.NET]] and C++.&lt;br /&gt;
; [[Visual Studio Code]]: Supports refactoring many languages via plugins&lt;br /&gt;
; [[WebStorm]]: Supports refactoring JavaScript.&lt;br /&gt;
; [[Wing IDE]]: Supports refactoring Python.&lt;br /&gt;
; [[Xcode]]: Supports refactoring C, Objective-C, and [[Swift (programming language)|Swift]].&amp;lt;ref&amp;gt;{{cite web| url = https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/WhatsNewXcode/xcode_9/xcode_9.html| title = What&amp;#039;s new in Xcode 9}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
; [[Qt Creator]]: Supports refactoring C++, Objective-C and [[QML]]&amp;lt;ref&amp;gt;{{cite web| url = https://doc.qt.io/qtcreator/creator-overview.html| title = Overview {{!}} Qt Creator Documentation}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Amelioration pattern]]&lt;br /&gt;
* [[Code review]]&lt;br /&gt;
* [[Database refactoring]]&lt;br /&gt;
* [[Decomposition (computer science)]]&lt;br /&gt;
* [[Modular programming]]&lt;br /&gt;
* [[Obfuscated code]]&lt;br /&gt;
* [[Prefactoring]]&lt;br /&gt;
* [[Rewrite (programming)]]&lt;br /&gt;
* [[Separation of concerns]]&lt;br /&gt;
* [[Software peer review]]&lt;br /&gt;
* [[Test-driven development]]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Reflist}}&lt;br /&gt;
&lt;br /&gt;
==Further reading==&lt;br /&gt;
*{{cite book&lt;br /&gt;
 | first = William C.&lt;br /&gt;
 | last = Wake&lt;br /&gt;
 | year = 2003&lt;br /&gt;
 | title = Refactoring Workbook&lt;br /&gt;
 | publisher = Addison-Wesley&lt;br /&gt;
 | isbn = 978-0-321-10929-3&lt;br /&gt;
}}&lt;br /&gt;
* {{cite journal|first1=T.|last1=Mens|first2=T.|last2=Tourwe|title=A survey of software refactoring|url=https://zenodo.org/record/848931|journal=IEEE Transactions on Software Engineering|date=February 2004|issn=0098-5589|pages=126–139|volume=30|issue=2|doi=10.1109/tse.2004.1265817|bibcode=2004ITSEn..30..126M |s2cid=206778272}}&lt;br /&gt;
*{{cite book&lt;br /&gt;
 | first = Michael C&lt;br /&gt;
 | last = Feathers&lt;br /&gt;
 | year = 2004&lt;br /&gt;
 | title = Working Effectively with Legacy Code&lt;br /&gt;
 | publisher = Prentice Hall&lt;br /&gt;
 | isbn = 978-0-13-117705-5&lt;br /&gt;
}}&lt;br /&gt;
*{{cite book&lt;br /&gt;
 | first = Joshua&lt;br /&gt;
 | last = Kerievsky&lt;br /&gt;
 | year = 2004&lt;br /&gt;
 | title = Refactoring To Patterns&lt;br /&gt;
 | publisher = Addison-Wesley&lt;br /&gt;
 | isbn = 978-0-321-21335-8&lt;br /&gt;
}}&lt;br /&gt;
*{{cite book&lt;br /&gt;
 | first = Danijel&lt;br /&gt;
 | last = Arsenovski&lt;br /&gt;
 | year = 2008&lt;br /&gt;
 | title = Professional Refactoring in Visual Basic&lt;br /&gt;
 | publisher = Wrox&lt;br /&gt;
 | isbn = 978-0-470-17979-6&lt;br /&gt;
}}&lt;br /&gt;
*{{cite book&lt;br /&gt;
 | first = Danijel&lt;br /&gt;
 | last = Arsenovski&lt;br /&gt;
 | year = 2009&lt;br /&gt;
 | title = Professional Refactoring in C# and ASP.NET&lt;br /&gt;
 | publisher = Wrox&lt;br /&gt;
 | isbn = 978-0-470-43452-9&lt;br /&gt;
}}&lt;br /&gt;
*{{cite book&lt;br /&gt;
 | first = Peter&lt;br /&gt;
 | last = Ritchie&lt;br /&gt;
 | year = 2010&lt;br /&gt;
 | title = Refactoring with Visual Studio 2010&lt;br /&gt;
 | publisher = Packt&lt;br /&gt;
 | isbn = 978-1-84968-010-3&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[http://c2.com/cgi/wiki?WhatIsRefactoring What Is Refactoring?] (c2.com article)&lt;br /&gt;
*[http://refactoring.com/ Martin Fowler&amp;#039;s homepage about refactoring]&lt;br /&gt;
&lt;br /&gt;
{{Authority control}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Code refactoring| ]]&lt;br /&gt;
[[Category:Extreme programming]]&lt;br /&gt;
[[Category:Technology neologisms]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Florian Blaschke</name></author>
	</entry>
</feed>