170 likes | 354 Views
WARNING. These slides are not optimized for printing or exam preparation. These are for lecture delivery only. These slides are made for PowerPoint 2010. They may not show up well on other PowerPoint versions . You can download PowerPoint 2010 viewer from here .
E N D
WARNING • These slides are not optimized for printing or exam preparation. These are for lecture delivery only. • These slides are made for PowerPoint 2010. They may not show up well on other PowerPoint versions. You can download PowerPoint 2010 viewer from here. • These slides contain a lot of animations. For optimal results, watch in slideshow mode.
Broken Windows story Broken windows
Make it work, right, fast Make it work Make it right Make it fast Lesson: Me sy things get m r
Make it work, right, fast code Make it work Make it right Make it fast Lesson: Me sythings get m r
Refactoring: from Turkey to Peacock in thousand steps CS2103/T, Lecture 2, Part 2, [Aug 23, 2013]
Refactoring Bug fixing == Refactoring? REFACTORING [Improving structure incrementally without modifying behaviour]
Refactoring • Rewriting REFACTORING [Improving structure incrementally without modifying behaviour]
Catalog memorize
Example: Introduce Explaining Variable if ( (platform.toUpperCase().indexOf("MAC") > -1) && (browser.toUpperCase().indexOf("IE") > -1) && wasInitialized() && resize > 0 ) {…} final boolean isMacOs= platform.toUpperCase().indexOf("MAC") > -1; final boolean isIEBrowser= browser.toUpperCase().indexOf("IE") > -1; final boolean wasResized= resize > 0; if (isMacOs && isIEBrowser && wasInitialized() && wasResized) {…}
Regression test REFACTORING [Improving structure incrementally without modifying behaviour]
It’s not rocket surgery! Regression test REFACTORING [Improving structure incrementally without modifying behaviour]
Regression test REFACTORING [Improving structure incrementally without modifying behaviour]