Talk:CumulativeFactory
From APIDesign
(Difference between revisions)
(Comment provided by paulo - via ArticleComments extension) |
m (Reverted edits by 94.100.25.194 (Talk); changed back to last version by JaroslavTulach) |
||
(3 intermediate revisions not shown.) | |||
Line 10: | Line 10: | ||
--paulo 12:20, 10 November 2008 (CET) | --paulo 12:20, 10 November 2008 (CET) | ||
+ | </div> | ||
+ | == Radim said ... == | ||
+ | |||
+ | <div class='commentBlock'> | ||
+ | Cf. Item 2 in Effective Java 2nd edition (also you can see it here - | ||
+ | http://rwhansen.blogspot.com/2007/07/theres-builder-pattern-that-joshua.html). The idea is the same but moving this into Builder seems like nicer solution. | ||
+ | |||
+ | --Radim 01:27, 11 November 2008 (CET) | ||
</div> | </div> |
Current revision
Comments on APIDesignPatterns:CumulativeFactory <comments />
paulo said ...
Radim said ...
Cf. Item 2 in Effective Java 2nd edition (also you can see it here - http://rwhansen.blogspot.com/2007/07/theres-builder-pattern-that-joshua.html). The idea is the same but moving this into Builder seems like nicer solution.
--Radim 01:27, 11 November 2008 (CET)
The problem with these declarative methods is always leaving the object in a incomplete state. I prefer factory methods with private constructor myself. Hide the instance, so that immutable object tricks can be used, but still use descritive function names. Plus if you're using generics you can use the limited type inference that java has. Do you prefer new Tuple<Int,Int>(a,b); or Tuples.pair(a,b) ?
--paulo 12:20, 10 November 2008 (CET)