Extract Method
From CSSEMediaWiki
Revision as of 00:22, 27 July 2009 by Brett Ward (Talk | contribs)
Turn the fragment into a method whose name explains the purpose of the method.
printOwing() { printBanner(); //print details System.out.println ("name: " + _name); System.out.println ("amount " + getOutstanding()); }
becomes
void printOwing() { printBanner(); printDetails(getOutstanding()); }
void printDetails (double outstanding) { System.out.println ("name: " + _name); System.out.println ("amount " + outstanding); }
See Also