摘要: 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 ... 阅读全文
posted @ 2007-04-28 15:54 南守拥 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 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. 阅读全文
posted @ 2007-04-28 15:54 南守拥 阅读(134) 评论(0) 推荐(0) 编辑
摘要: A class is doing too much simple delegation. Get the client to call the delegate directly. 阅读全文
posted @ 2007-04-28 15:53 南守拥 阅读(132) 评论(0) 推荐(0) 编辑
摘要: A client is calling a delegate class of an object. Create methods on the server to hide the delegate. 阅读全文
posted @ 2007-04-28 15:41 南守拥 阅读(136) 评论(0) 推荐(0) 编辑
摘要: A class isn’t doing very much. Move all its features into another class and delete it. 阅读全文
posted @ 2007-04-28 15:25 南守拥 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 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. 阅读全文
posted @ 2007-04-28 15:23 南守拥 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 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. 阅读全文
posted @ 2007-04-28 15:20 南守拥 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 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... 阅读全文
posted @ 2007-04-28 14:59 南守拥 阅读(120) 评论(0) 推荐(0) 编辑
摘要: You want to replace an algorithm with one that is clearer. Replace the body of the method with the new algorithm. 阅读全文
posted @ 2007-04-28 14:52 南守拥 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 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 ... 阅读全文
posted @ 2007-04-28 14:51 南守拥 阅读(167) 评论(0) 推荐(0) 编辑
摘要: The code assigns to a parameter. Use a temporary variable instead. 阅读全文
posted @ 2007-04-28 14:49 南守拥 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 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. 阅读全文
posted @ 2007-04-28 14:40 南守拥 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 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. 阅读全文
posted @ 2007-04-28 13:56 南守拥 阅读(124) 评论(0) 推荐(0) 编辑