Advanced Refactoring & FDT 5

From FDT Documentation

Jump to: navigation, search

With FDT 5, the team has added powerful refactoring to your workflow. These refactorings have been integrated into our Quick Assist workflow, so you won't be slowed down at all - in fact you'll see how quickly you can restructure your code.



Extract Method

EM 001.png Perhaps the most powerful, and fun, refactoring is Extract Method.

This allows you to select a block of code and convert it to a method. FDT automatically infers the method arguments and return types. This is useful when a method is too big and you want to subdivide blocks of it into different methods or if you are executing a computation several times in your code.

The default keystroke for this is CMD+1.

EM 002.png EM 003.png File:EM 004.png EM 005.png EM 006.png

Extract Local Variable

ELV 001.png The Extract Local Variable refactoring takes an expression that is being used directly and assigns it to a local variable first. This variable is then used where the expression used to be.

To use it press Ctrl+1 and select assign statement to a local variable.

ELV 002.png ELV 003.png ELV 004.png

Extract Contant

EC 001.png Extract Contant enables developers to quickly assign strings, colors, object literals and numbers to a static value. This makes renaming ( refactoring ) and changing these values much easier, increases performance and improves readability.

The default binding is CMD+1.

EC 002.png

EC 003.png

Convert Local Variable to Field Variable

Convert Local Variable To Field Header.png

This refactoring takes a local variable and converts it to a private field of the class. After invoked, FDT will create a statement at the top of your class and refactor all references so they reference the field declaration.

This refactoring is available via CMD+1

Split local var start.png Split local var proposal.png Split local var end.png

Split Local Variable Declaration

Split Local Variable Declaration.png This refactoring allows you to split a variable (with initialization) into two separate statements: a variable declaration and a variable initialization.

Like all Quick Assists, this invoked by pressing CMD+1.

Before Split Local Var.png After Split Local Var.png

Get FDT5