patterns:parameter_object
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
patterns:parameter_object [2013-07-06 22:13] – created -- WIP christian | patterns:parameter_object [2021-09-02 12:18] – old revision restored (2021-03-29 15:52) 65.21.179.175 | ||
---|---|---|---|
Line 3: | Line 3: | ||
===== Alternative Names ===== | ===== Alternative Names ===== | ||
- | * Argument | + | * Arguments |
===== Context ===== | ===== Context ===== | ||
Line 11: | Line 11: | ||
===== Intent ===== | ===== Intent ===== | ||
+ | |||
+ | Group several method parameters in order to keep the number of parameters small and the interface stable. | ||
===== Problem ===== | ===== Problem ===== | ||
+ | |||
+ | * Often there are methods which take a large number of input parameters. This makes using them cumbersome and the code less readable. See [[anti-patterns: | ||
+ | * A second problem is the evolution of method signatures. There are circumstances where there is the chance that in the future further parameters will be added without all the users of the method needing the new parameter. [[glossary: | ||
===== Structure ===== | ===== Structure ===== | ||
+ | |||
+ | ===== Dynamics ===== | ||
+ | |||
+ | ===== Implementation Hints ===== | ||
===== Variations ===== | ===== Variations ===== | ||
Line 20: | Line 29: | ||
===== Origin ===== | ===== Origin ===== | ||
- | James Noble: //Arguments and Results// | + | {{page> |
===== Advantages ===== | ===== Advantages ===== | ||
+ | |||
+ | * [[principles: | ||
+ | * [[principles: | ||
===== Disadvantages ===== | ===== Disadvantages ===== | ||
+ | |||
+ | * [[principles: | ||
+ | * [[principles: | ||
===== Relations to Other Patterns ===== | ===== Relations to Other Patterns ===== | ||
- | ===== Pattern Collections ===== | + | ==== Generalizations ==== |
+ | |||
+ | ==== Specializations ==== | ||
+ | |||
+ | * [[Selector Object]] | ||
+ | * [[Curried Object]] | ||
+ | |||
+ | ==== Alternative Patterns ==== | ||
+ | |||
+ | ==== Complementary Patterns ==== | ||
+ | |||
+ | ==== Pattern Collections ==== | ||
+ | {{page> | ||
===== Examples ===== | ===== Examples ===== | ||
Line 38: | Line 65: | ||
* In .NET there is the class [[http:// | * In .NET there is the class [[http:// | ||
* In Java there is [[http:// | * In Java there is [[http:// | ||
+ | |||
+ | ==== Example 2: CreateProcess==== | ||
+ | |||
+ | The Windows API function [[http:// | ||
+ | |||
+ | On the other hand the parameter object pattern is already applied here. The parameters lpProcessAttributes, | ||
===== Description Status ===== | ===== Description Status ===== | ||
/* Choose one of the following and comment out the rest: */ | /* Choose one of the following and comment out the rest: */ | ||
- | /*[[wiki: | + | [[wiki: |
/ | / | ||
/ | / |
patterns/parameter_object.txt · Last modified: 2021-10-18 22:24 by christian