摘要:
A server class you are using needs an additional method, but you can’t modify the class. Create a method in the client class with an instance of the server class as its first argument. 阅读全文
摘要:
A server class you are using needs several additional methods, but you can’t modify the class. Create a new class that contains these extra methods. Make this extension class a subclass or a wrapper ... 阅读全文
摘要:
A class is doing too much simple delegation. Get the client to call the delegate directly. 阅读全文
摘要:
A client is calling a delegate class of an object. Create methods on the server to hide the delegate. 阅读全文
摘要:
A class isn’t doing very much. Move all its features into another class and delete it. 阅读全文
摘要:
You have one class doing work that should be done by two. Create a new class and move to relevant fields and methods from the old class into the new class. 阅读全文
摘要:
A field is, or will be, used by another class more than the class on which It is defined. Create a new field in the target class, and change all its users. 阅读全文
摘要:
A method is, or will be, using or used by more features of another class than the class on which it is defined. Crete a new method with a similar body in the class it uses most. Either turn the old me... 阅读全文
摘要:
You want to replace an algorithm with one that is clearer. Replace the body of the method with the new algorithm. 阅读全文
摘要:
You have a long method that uses local variables in such a way that you cannot apply extract method. Turn the method into its own object so that all the local variables become fields that object. You ... 阅读全文
摘要:
The code assigns to a parameter. Use a temporary variable instead. 阅读全文
摘要:
You have a temporary variable assigned to more than once, but is not a loop variable nor a collecting temporary variable.Make a separate temporary variable for each assignment. 阅读全文
摘要:
You have a complicated expression. Put the result of the expression, or parts of the expression, in a temporary variable with a name that explains the purpose. 阅读全文