cemalkilic / che

Eclipse Che: Next-generation Eclipse IDE. Open source workspace server and cloud IDE.
http://eclipse.org/che
Eclipse Public License 1.0
0 stars 0 forks source link

Extracting a method #2

Open utkuumur opened 7 years ago

utkuumur commented 7 years ago

Eclipse Che is a very versatile server and cloud based IDE. But it lacks useful refactoring tools that other IDEs offer. To make the code more modular and readable developer may want to create small methods for code fragments and the easy way to accomplish this is using a refactoring tool called extract method. In order to add this tool, a shortcut will be added to refactoring submenu in assistant menu.

Screenshot from another IDE that presents this tool.

preview

Advantages of using extract method

Simple example


void printOwing() {
  printBanner();

  //print details
  System.out.println ("name:  " + _name);
  System.out.println ("amount " + getOutstanding());
}

After extracting details part

void printOwing() {
  printBanner();
  printDetails(getOutstanding());
}

void printDetails (double outstanding) {
  System.out.println ("name:  " + _name);
  System.out.println ("amount " + outstanding);
}
cagdasgerede commented 7 years ago

Ok