Revision as of 06:07, 18 October 2001 editBjorn Elenfors (talk | contribs)1 editmNo edit summary | Revision as of 15:43, 25 February 2002 edit undoConversion script (talk | contribs)10 editsm Automated conversionNext edit → | ||
Line 1: | Line 1: | ||
To <b>refactor</b> programming ] is to rewrite the code, to "clean it up." | To <b>refactor</b> programming ] is to rewrite the code, to "clean it up." | ||
Refactoring is the process of rewriting something to improve readability and comprehension with the explicit purpose of not changing the meaning. In the case of software, a refactoring is part of the cycle of create code, test code, refactor, test code, maintain code, test code, refactor, maintain code... and so on. Testing ensures that the code does what it is supposed to. Refactoring is the part of code maintenance which doesn't fix bugs or add new functionality. Rather it is designed to improve the understandability of the code, in order to make it easier for human maintenance in the future. | Refactoring is the process of rewriting something to improve readability and comprehension with the explicit purpose of not changing the meaning. In the case of software, a refactoring is part of the cycle of create code, test code, refactor, test code, maintain code, test code, refactor, maintain code... and so on. Testing ensures that the code does what it is supposed to. Refactoring is the part of code maintenance which doesn't fix bugs or add new functionality. Rather it is designed to improve the understandability of the code, in order to make it easier for human maintenance in the future. | ||
An example of a simple refactoring is to change the name of a variable to something more meaningful, such as from a single letter 'i' to 'interestRate'. A more complex refactoring is to turn the code within an if block into a function. An even more complex refactoring is to replace an if conditional with polymorphism. | An example of a simple refactoring is to change the name of a variable to something more meaningful, such as from a single letter 'i' to 'interestRate'. A more complex refactoring is to turn the code within an if block into a function. An even more complex refactoring is to replace an if conditional with polymorphism. | ||
⚫ | Many refactorings are meant to cure the ills listed in "How to Write Unmaintainable Code" by ]. This is the best single reference for smelly code, I've ever seen. | ||
⚫ | Many refactorings are meant to cure the ills listed in "How to Write Unmaintainable Code" by ] |
||
This is the best single reference for smelly code, I've ever seen. | |||
The book <b>Refactoring</b> by ], in collaboration with ], ], ], and ] (ISBIN 0-201-48567-2, 1999 Addison Wesley Longman, Inc.) is | The book <b>Refactoring</b> by ], in collaboration with ], ], ], and ] (ISBIN 0-201-48567-2, 1999 Addison Wesley Longman, Inc.) is | ||
the classic reference. Martin Fowler also has a website, http://www.refactoring.org. Several good discussions are found at the WikiWeb at c2.org. | the classic reference. Martin Fowler also has a website, http://www.refactoring.org. Several good discussions are found at the WikiWeb at c2.org. | ||
To <b>refactor</b> text, in a WikiWiki, is to rewrite and often to reorganize the text completely or radically, sometimes dramatically shortening it, but in a way that preserves all the important, relevant content. In a <nowiki>WikiWiki</nowiki>, it is usually ''discussions'' that are refactored--with the purpose of making the discussion accessible to someone who is interested in the arguments made in the discussion, and the information to be gleaned from it, rather than the history of the discussion itself. | To <b>refactor</b> text, in a WikiWiki, is to rewrite and often to reorganize the text completely or radically, sometimes dramatically shortening it, but in a way that preserves all the important, relevant content. In a <nowiki>WikiWiki</nowiki>, it is usually ''discussions'' that are refactored--with the purpose of making the discussion accessible to someone who is interested in the arguments made in the discussion, and the information to be gleaned from it, rather than the history of the discussion itself. | ||
Obviously, refactoring is difficult to do in such a way that will make all participants in a discussion happy. It requires ], tact, excellent reading comprehension skills, good writing skills, and a lack of bias. | Obviously, refactoring is difficult to do in such a way that will make all participants in a discussion happy. It requires ], tact, excellent reading comprehension skills, good writing skills, and a lack of bias. | ||
---- | ---- | ||
For policy on refactoring in Misplaced Pages, see ]. In the context of Misplaced Pages, usually ]s are refactored, but occasionally, when an article has been developed in a particularly haphazard way, it needs to be changed so radically that the resulting change can be called a refactoring. | For policy on refactoring in Misplaced Pages, see ]. In the context of Misplaced Pages, usually ]s are refactored, but occasionally, when an article has been developed in a particularly haphazard way, it needs to be changed so radically that the resulting change can be called a refactoring. | ||
Links: | Links: | ||
Revision as of 15:43, 25 February 2002
To refactor programming code is to rewrite the code, to "clean it up."
Refactoring is the process of rewriting something to improve readability and comprehension with the explicit purpose of not changing the meaning. In the case of software, a refactoring is part of the cycle of create code, test code, refactor, test code, maintain code, test code, refactor, maintain code... and so on. Testing ensures that the code does what it is supposed to. Refactoring is the part of code maintenance which doesn't fix bugs or add new functionality. Rather it is designed to improve the understandability of the code, in order to make it easier for human maintenance in the future.
An example of a simple refactoring is to change the name of a variable to something more meaningful, such as from a single letter 'i' to 'interestRate'. A more complex refactoring is to turn the code within an if block into a function. An even more complex refactoring is to replace an if conditional with polymorphism.
Many refactorings are meant to cure the ills listed in "How to Write Unmaintainable Code" by Roedy Green. This is the best single reference for smelly code, I've ever seen.
The book Refactoring by Martin Fowler, in collaboration with Kent Beck, John Brant, Wililam Opdyke, and Don Roberts (ISBIN 0-201-48567-2, 1999 Addison Wesley Longman, Inc.) is the classic reference. Martin Fowler also has a website, http://www.refactoring.org. Several good discussions are found at the WikiWeb at c2.org.
To refactor text, in a WikiWiki, is to rewrite and often to reorganize the text completely or radically, sometimes dramatically shortening it, but in a way that preserves all the important, relevant content. In a WikiWiki, it is usually discussions that are refactored--with the purpose of making the discussion accessible to someone who is interested in the arguments made in the discussion, and the information to be gleaned from it, rather than the history of the discussion itself.
Obviously, refactoring is difficult to do in such a way that will make all participants in a discussion happy. It requires intelligence, tact, excellent reading comprehension skills, good writing skills, and a lack of bias.
For policy on refactoring in Misplaced Pages, see editing policy. In the context of Misplaced Pages, usually talk pages are refactored, but occasionally, when an article has been developed in a particularly haphazard way, it needs to be changed so radically that the resulting change can be called a refactoring.