Difference between revisions of "Code refactoring"
Karl Jones (Talk | contribs) |
Karl Jones (Talk | contribs) (→External links) |
||
Line 55: | Line 55: | ||
* [https://en.wikipedia.org/wiki/Code_refactoring Code refactoring] @ Wikipedia | * [https://en.wikipedia.org/wiki/Code_refactoring Code refactoring] @ Wikipedia | ||
+ | |||
+ | [[Category:Computer programming]] | ||
+ | [[Category:Computer science]] | ||
+ | [[Category:Intellectual property]] |
Latest revision as of 18:06, 21 April 2016
In computer programming, code refactoring is the process of restructuring existing source code without changing its external behavior.
Contents
Benefits
Refactoring improves nonfunctional attributes of the software.
The goals of refactoring include:
- Improved code readability
- Reduced Cyclomatic complexity
These can improve source code maintainability and create a more expressive internal architecture or object model to improve extensibility.
Process
Typically, refactoring applies a series of standardised 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.
Development environments
Many development environments provide automated support for performing the mechanical aspects of these basic refactorings.
See Integrated development environment.
If done extremely well
If done extremely well, code refactoring may also resolve hidden, dormant, or undiscovered computer bugs or vulnerabilities in the system by simplifying the underlying logic and eliminating unnecessary levels of complexity.
If done poorly
If done poorly it may fail the requirement that external functionality not be changed, and/or introduce new bugs.
Quotations
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 adding 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
Factoring (decomposition)
In computer science, factoring (or decomposition) is the similar, broader principle of breaking a complex problem or system into parts that are easier to conceive, understand, program, and maintain.
See also
- Computer program
- Computer science
- Integrated development environment
- Maintainability
- Software maintenance
- Software quality
- Source code
- Spaghetti code
External links
- Code refactoring @ Wikipedia