What is Refactoring?
- Refactoring is a disciplined technique for improving the structure of existing code without changing the observable behavior.
- In short: change the structure of your code, without changing behavior. Using Refactoring, you can easily move fields, methods or classes around without breaking things. Refactorings come as simple as Rename or more complex like Tease Apart Inheritance.
Why should I Refactor?
- Refactoring improves the design of software
- Refactoring makes software easier to understand
- Refactoring makes software easier to maintain
- Refactoring helps you find bugs
- Refactoring helps you program faster
- Rename: You can change the name of a package, class, method or field to something more meaningful. Netbeans will update all source code in your project to reference the element by its new name.
- Replace block of code with a method;
- Encapsulate Fields: Many IDEs can automatically generates a getter method and and a setter method for a field and optionally update all referencing code to access the field using the getter and setter methods.
- Move Class: Moves a class to another package or into another class. In addition, all source code in your project is updated to reference the class in its new location.
- Safely Delete: Checks for references to a code element and then automatically deletes that element if no other code references it.
- Change Method Parameters: Enables you to add parameters to a method and change the access modifier.
- Extract Interface: Creates a new interface from the selected public non-static methods in a class or interface.
- Extract Superclass: Creates a new abstract class, changes the current class to extend the new class, and moves the selected methods and fields to the new class.
- Move Inner to Outer Level: Moves an inner class one level up in hierarchy.
Sem comentários:
Enviar um comentário