首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件开发 >

设计形式-行为模式-Collecting Parameter-Java

2013-03-17 
设计模式--行为模式--Collecting Parameter--JavaCollecting Parameter场景You have a single bulky metho

设计模式--行为模式--Collecting Parameter--Java

Collecting Parameter场景You have a single bulky method that accumulates information to a local variable.
你有一个较长方法,其主要为了积累局部信息。
定义A Collecting Parameter is an object that you pass to methods in order to collect information from those methods. This pattern is often coupled with Composed Method
Collecting parameter Patterns 是通过将Collecting Parameter对象以参数形式传入到所涉及的方法中去收集信息。通常此模式会和Composed Method 偶合在一起。
A Collecting Parameter may also be passed to methods on multiple objects
Collecting Parameter 对象可以传递到不同类中的方法中。
引自《Refactoring to Patterns》中的例子:
设计形式-行为模式-Collecting Parameter-Java
优点Helps transform bulky methods into smaller, simpler, z methods.  有助于将杂乱的方法编程一些小的简单的方法。
Can make resulting code run faster.                                                       可以使生成结果信息的代码执行更快。

引自JUnit 中的例子:设计形式-行为模式-Collecting Parameter-Java
设计形式-行为模式-Collecting Parameter-Java设计形式-行为模式-Collecting Parameter-Java
设计形式-行为模式-Collecting Parameter-Java

热点排行