Refactoring
What is refactoring?
Refactoring is the process of restructuring code, while not changing its original functionality. The goal of refactoring is to improve internal code by making many small changes without altering the code's external behavior.
Computer programmers and software developers refactor code to improve the design, structure and implementation of software. Refactoring improves code readability and reduces complexities. Refactoring can also help software developers find bugs or vulnerabilities hidden in their software.
The refactoring process features many small changes to a program's source code. One approach to refactoring, for example, is to improve the structure of source code at one point and then extend the same changes systematically to all applicable references throughout the program. The thought process is that all the small, behavior-preserving changes to a body of code have a cumulative effect. These changes preserve the software's original behavior and do not modify its behavior.
Martin Fowler, considered the father of refactoring, consolidated many best practices from across the software development industry into a specific list of refactorings and described methods to implement them in his book Refactoring: Improving the Design of Existing Code.
What is the purpose of refactoring?
Refactoring improves code by making it:
- More efficient by addressing dependencies and complexities.
- More maintainable or reusable by increasing efficiency and readability.
- Cleaner so it is easier to read and understand.
- Easier for software developers to find and fix bugs or vulnerabilities in the code.
Code modification is done without changing any functions of the program itself. Many basic editing environments support simple refactorings like renaming a function or variable across an entire code base.
Comments
Post a Comment