





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
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