





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The concept of refactoring in software development, explaining its purpose and benefits. It provides a practical example of refactoring a method to improve its clarity and maintainability. The document also lists common refactoring techniques and the support provided by eclipse for refactoring operations. It concludes with an exercise that encourages readers to identify problems in code and apply refactoring principles.
Typology: Slides
1 / 9
This page cannot be seen from the preview
Don't miss anything!






(^) Of course, to print out a bill for a customer, we also need to include incidentals and taxes … public double getRoomCharge() { double roomCharge = 0.0; ... code to compute room charge... // now add the incidentals to roomCharge ... code to add up incidentals ... // now add the tax for the room to the charge ...several lines of code to compute the tax... return roomCharge; } (^) What’s inelegant about this method now? (^) 3 sets of calculations in one function. Method does 3 things. (^) The name is not illustrative of what the method does.
(^) Renaming (^) a package (^) a compilation unit (^) a type (^) a local variable (^) method parameters (^) Extracting (^) a constant (^) an interface from a type (^) Inlining (^) a local variable (^) a method (^) a constant (^) static members between types (^) an instance method to a component (^) Converting (^) a local variable to a field (^) an anonymous inner class to a nested class (^) a nested type to a top-level type (^) Replacing (^) references to a type with references to one of its supertypes (^) a single reference to a type with a reference to one of its supertypes (^) an expression with a method parameter (^) constructor calls with factory method invocations