-The first scenario is the typical case in which it is - -2
-recommended to use the extract method refactoring, when there is duplicated code - -3
-in two or more methods and we want to take this - -4
-code and factor is out, and basically have the two methods called - -5
-a third method, which is the one we create using the - -6
-refactoring. When a class is too large, normally we don't want to - -7
-apply the extract. Extract method. Instead, in this cases, it is - -8
-usually more appropriate to use the - -9
-extract class or extract subclass refactorings. - -10
-Analogously, when the names of two classes are too similar, extracting a - -11
-method will normally not help much. And all we need to do - -12
-in case having too similar names is actually a problem. Is to - -13
-rename one of the two classes, or both, if we wish. Finally, - -14
-it is definitely appropriate to apply the extract method of refactoring in - -15
-cases in which a method is highly coupled with a class other - -16
-than the one where it is defined. In this case, which we - -17
-will discuss also later in the lesson, the extract method of refactoring - -18
-allows us to extract part of the metal to With the other class. - -19
-Then we can take the matter that we just extracted and move it - -20
-to the class where it actually belongs. So the extract method is one - -21
-of the two refactorings that it is appropriate to apply in these cases. -- cgit 1.4.1