随笔分类 -  Refactoring

Improving the Design of Existing Code-------Martin Fowler All rights belongs to Martin Fowler. Click this link for detail:http://www.refactoring.com/catalog/
摘要: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 南守拥 阅读(148) 评论(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 南守拥 阅读(172) 评论(0) 推荐(0)
摘要:The code assigns to a parameter. Use a temporary variable instead. 阅读全文
posted @ 2007-04-28 14:49 南守拥 阅读(178) 评论(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 南守拥 阅读(145) 评论(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 南守拥 阅读(134) 评论(0) 推荐(0)
摘要:You are using a temporary variable to hold the result of an expression. Extract the expression into a method. Replace all references to the temp with the expression. The new method can then be used in... 阅读全文
posted @ 2007-04-20 17:12 南守拥 阅读(224) 评论(0) 推荐(0)
摘要:You have a temp that is assigned to once with a simple expression, and the temp is getting in the way of other refactoring.Sample: BeforeCode highlighting produced by Actipro CodeHighlighter (freewar... 阅读全文
posted @ 2007-04-20 16:58 南守拥 阅读(196) 评论(0) 推荐(0)
摘要:A method's body is just as clear as its name. Put the method’s body into the body of its callers and remove the method.Sample: BeforeRefactorCode highlighting produced by Actipro CodeHighlighter (fr... 阅读全文
posted @ 2007-04-20 16:49 南守拥 阅读(201) 评论(0) 推荐(0)
摘要:You have a code fragment that can be grouped together.Turn the fragment into a method whose name explains the purpose of the method. Why: First, it increases the chances that other methods can use a ... 阅读全文
posted @ 2007-04-20 15:03 南守拥 阅读(196) 评论(0) 推荐(0)