Citizendia
Your Ad Here

Code refactoring is any change to a computer program's code that improves its readability or simplifies its structure without changing its results. Computer programs (also software programs, or just programs) are instructions for a Computer. In writing and typography Readability is defined as reading ease, especially as it results from a writing style

Contents

Source code

In software engineering, "refactoring" a source code module often means modifying without changing its external behavior, and is sometimes informally referred to as "cleaning it up". Software engineering is the application of a systematic disciplined quantifiable approach to the development operation and maintenance of Software. In Computer science, source code (commonly just source or code) is any sequence of statements or declarations written in some Human-readable In extreme programming and other agile methodologies, refactoring is an integral part of the software development cycle: developers alternate between adding new tests and functionality and refactoring the code to improve its internal consistency and clarity. Extreme Programming (or XP) is a Software engineering methodology (and a form of Agile software development) Proponents of Extreme Programming and agile Agile software development refers to a group of Software development methodologies that are based on similar principles A software development process is a structure imposed on the development of a software product Automatic unit testing ensures that refactoring does not make the code stop working. In Computer programming, unit testing is a method of testing that verifies the individual units of Source code are working properly

Refactoring neither fixes bugs nor adds new functionality. A software bug (or just “bug” is an error flaw mistake Failure, fault or “undocumented feature” in a Computer program that prevents it Rather it improves the understandability of the code or changes its internal structure and design, and removes dead code, to make it easier for human maintenance in the future. Understanding (also called intellection) is a psychological Process related to an abstract or physical object such as Person, situation or Structure is a fundamental and sometimes Intangible notion covering the Recognition, Observation, nature, and Stability of Design is used both as a Noun and a Verb. The term is often tied to the various Applied arts and Engineering (See design disciplines In Computer programming, unreachable code, or dead code, is code that exists in the Source code of a program but can never be executed In particular, adding new behavior to a program might be difficult with the program's given structure, so a developer might refactor it first to make it easier, and then add the new behavior. Refactoring is also a tool for removing bad code smells that exist in code. In Computer programming, code smell is any Symptom in the Source code of a Computer program that indicates something may be wrong

Code refactoring alone does not change or add functionality to a system, but it can simplify future additions, application of design patterns, and reuse through polymorphism, which otherwise could be impractical, expensive, or unmaintainable. In Software engineering, a design pattern is a general reusable solution to a commonly occurring problem in Software design. In Computer science, polymorphism is a Programming language feature that allows values of different Data types to be handled using a

An example of a trivial refactoring is to change a variable name into something more meaningful, such as from a single letter 'i' to 'interestRate' (see: identifier naming convention). In Computer programming a Naming convention is a set of rules for choosing the character sequence to be used for Identifiers in Source code and documentation In Computer programming a Naming convention is a set of rules for choosing the character sequence to be used for Identifiers in Source code and documentation A more complex refactoring is to turn the code within an if block into a subroutine. In Computer science, a subroutine ( function, method, procedure, or subprogram) is a portion of code within a larger An even more complex refactoring is to replace an if conditional with polymorphism. In Computer science, polymorphism is a Programming language feature that allows values of different Data types to be handled using a

While "cleaning up" code has happened for decades, the key insight in refactoring is to intentionally "clean up" code separately from adding new functionality, using a known catalogue of common useful refactoring methods, and then separately testing the code (knowing that any behavioral changes indicate a bug). The new aspect is explicitly wanting to improve an existing design without altering its intent or behavior. Optimization has nothing to do with refactoring. Before optimizing, one should first fully refactor the code so that code becomes easy to understand and hence easy to optimize.

Refactoring faces challenges in becoming accepted. [1] First, more study is needed on the long term effects of refactoring. Second, the people who pay the bill need to be informed about the effects, so they can see its benefit. Also, refactoring the business layer stored in a database schema is difficult or impossible, because of schema transformation and data migration that must occur while system may be under heavy use. A Business logic layer ( BLL) is a Software engineering practice of compartmentalizing the rules and calculations of a software application from its other design The schema (pronounced skee -ma) of a Database system is its structure described in a formal language supported by the Database management system Finally, refactoring that affects an interface can cause difficulties unless the programmer has access to all users of the interface. Interface generally refers to an abstraction that an entity provides of itself to the outside For example, a programmer changing the name of a method in an interface must either edit all references to the old name throughout the entire project or maintain a stub with the old method name. In Object-oriented programming, the term method refers to a Subroutine that is exclusively associated either with a class (called class methods That stub would then call the new name of the method.

Antecedents

The term is by analogy with the factorization of numbers and polynomials. In Mathematics, factorization ( also factorisation in British English) or factoring is the decomposition of an object (for A number is an Abstract object, tokens of which are Symbols used in Counting and measuring. In Mathematics, a polynomial is an expression constructed from Variables (also known as indeterminates and Constants using the operations For example, x2x − 2 can be factored as (x + 1) (x − 2), revealing an internal structure that was previously not visible (such as the two roots at −1 and +2). Similarly, in software refactoring, the change in visible structure can often reveal the "hidden" internal structure of the original code.

The above math example illustrates a problem of "refactoring". One form is not necessarily objectively or universally superior to the other. They each emphasize different aspects of the expression and thus their utility may vary depending on the situation. This issue occurs in the software field where two or more professionals may have differing opinions on the ideal form of a given algorithm.

Refactoring is done as a separate step, to simplify testing. At the end of the refactoring, any change in behavior is clearly a bug and can be fixed separately from the problem of debugging the new behavior. A software bug (or just “bug” is an error flaw mistake Failure, fault or “undocumented feature” in a Computer program that prevents it

Martin Fowler's book Refactoring: Improving the Design of Existing Code[1] is the classic reference. Martin Fowler is an author and international speaker on software architecture specializing in object-oriented analysis and design UML, patterns, and Although refactoring code has been done informally for years, William Opdyke's 1993 Ph. William Opdyke is a professor of Computer science and a co-author of Refactoring William Opdyke's homepage (North Central College Year 1993 ( MCMXCIII) was a Common year starting on Friday (link will display full 1993 Gregorian calendar) D. dissertation[2] is the first known paper to specifically examine refactoring,[3] although all the theory and machinery have long been available as Program transformation systems. A program transformation is any operation that takes a program and generates another program All of these resources provide a catalog of common methods for refactoring; a refactoring method has a description of how to apply the method and indicators for when you should (or should not) apply the method. Scientific method refers to bodies of Techniques for investigating phenomena

List of refactorings techniques

Here is a very incomplete list of code refactorings. A longer list can be found in Fowler's Refactoring book and in Fowler's Refactoring Website[4].

Forth

The term "factoring" has been used in the Forth community since at least the early 1980s. Forth is a structured, imperative, stack-based, computer Programming language and programming environment Chapter Six of Leo Brodie's book Thinking Forth (1984) is dedicated to the subject. Year 1984 ( MCMLXXXIV) was a Leap year starting on Sunday (link displays the 1984 Gregorian calendar)

In Forth, factoring has essentially the same meaning that the Extract Method refactoring does in extreme programming—to break down a function (a "word" in Forth) into smaller, more easily maintained functions. Extreme Programming (or XP) is a Software engineering methodology (and a form of Agile software development) Proponents of Extreme Programming and agile In Computer science, a subroutine ( function, method, procedure, or subprogram) is a portion of code within a larger

Automated code refactoring

Many software editors and IDEs have automated refactoring support. A text editor is a type of program used for editing plain Text files Text editors are often provided with Operating systems or software development In Computing, an integrated development environment ( IDE) is a Software application that provides comprehensive facilities to Computer programmers Here is a list of a few of these editors, or so-called refactoring browsers. A class browser is a feature of an Integrated development environment that allows the programmer to browse navigate or visualize the structure of Object-oriented

Etymology

The first known use of the term "refactoring" in the published literature was in a September, 1990 article by William F. Opdyke and Ralph E. Johnson. [5] Opdyke's Ph. D. thesis[2], published in 1992, also used this term. [3] The term "refactoring" was almost certainly used before then.

As a neologism, it is clearly a reference to mathematical factoring. A neologism (from Greek neo = "new" + logos = "word" is a word that although devised relatively recently in a specific time period has been In Mathematics, factorization ( also factorisation in British English) or factoring is the decomposition of an object (for

See also

Further reading

References

  1. ^ a b Fowler, Martin (1999). Martin Fowler is an author and international speaker on software architecture specializing in object-oriented analysis and design UML, patterns, and Refactoring. Addison-Wesley. Addison-Wesley is a Book publishing imprint of Pearson PLC, best known for computer books ISBN 0-201-48567-2.  
  2. ^ a b Opdyke, William F. William Opdyke is a professor of Computer science and a co-author of Refactoring William Opdyke's homepage (North Central College "Refactoring Object-Oriented Frameworks" (compressed Postscript). Ph. D. thesis. . University of Illinois at Urbana-Champaign Retrieved on 2008-02-12. 2008 ( MMVIII) is the current year in accordance with the Gregorian calendar, a Leap year that started on Tuesday of the Common Events 1429 - English Forces under Sir John Fastolf defend a supply convoy carrying rations to the army besieging Orleans from attack by the
  3. ^ a b Martin Fowler, "MF Bliki: EtymologyOfRefactoring"
  4. ^ Refactoring techniques in Fowler's refactoring Website
  5. ^ Opdyke, William F.; Johnson, Ralph E. William Opdyke is a professor of Computer science and a co-author of Refactoring William Opdyke's homepage (North Central College (September 1990). "Refactoring: An Aid in Designing Application Frameworks and Evolving Object-Oriented Systems". Proceedings of the Symposium on Object Oriented Programming Emphasizing Practical Applications (SOOPPA), ACM.  

External links

Google Book Search is a tool from Google that searches the full text of books that Google scans OCRs, and stores in its digital database
© 2009 citizendia.org; parts available under the terms of GNU Free Documentation License, from http://en.wikipedia.org
Dapyx Software network: MP3 Explorer | Ebook Manager | Zenithic