摘要: 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 南守拥 阅读(214) 评论(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 南守拥 阅读(190) 评论(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 南守拥 阅读(197) 评论(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 南守拥 阅读(174) 评论(0) 推荐(0) 编辑