<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="http://wiki.apidesign.org/skins/common/feed.css?116"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.apidesign.org/index.php?action=history&amp;feed=atom&amp;title=CumulativeFactory</id>
		<title>CumulativeFactory - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.apidesign.org/index.php?action=history&amp;feed=atom&amp;title=CumulativeFactory"/>
		<link rel="alternate" type="text/html" href="http://wiki.apidesign.org/index.php?title=CumulativeFactory&amp;action=history"/>
		<updated>2026-05-01T21:42:31Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.12.0rc1</generator>

	<entry>
		<id>http://wiki.apidesign.org/index.php?title=CumulativeFactory&amp;diff=1654&amp;oldid=prev</id>
		<title>JaroslavTulach: APIDesignPatterns:CumulativeFactory moved to CumulativeFactory: Shorter names for use with categories</title>
		<link rel="alternate" type="text/html" href="http://wiki.apidesign.org/index.php?title=CumulativeFactory&amp;diff=1654&amp;oldid=prev"/>
				<updated>2008-11-15T12:30:24Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;a href=&quot;/wiki/APIDesignPatterns:CumulativeFactory&quot; class=&quot;mw-redirect&quot; title=&quot;APIDesignPatterns:CumulativeFactory&quot;&gt;APIDesignPatterns:CumulativeFactory&lt;/a&gt; moved to &lt;a href=&quot;/wiki/CumulativeFactory&quot; title=&quot;CumulativeFactory&quot;&gt;CumulativeFactory&lt;/a&gt;: Shorter names for use with categories&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 12:30, 15 November 2008&lt;/td&gt;
			&lt;/tr&gt;
		&lt;/table&gt;</summary>
		<author><name>JaroslavTulach</name></author>	</entry>

	<entry>
		<id>http://wiki.apidesign.org/index.php?title=CumulativeFactory&amp;diff=1646&amp;oldid=prev</id>
		<title>JaroslavTulach at 11:07, 15 November 2008</title>
		<link rel="alternate" type="text/html" href="http://wiki.apidesign.org/index.php?title=CumulativeFactory&amp;diff=1646&amp;oldid=prev"/>
				<updated>2008-11-15T11:07:50Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 11:07, 15 November 2008&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 13:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 13:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This pattern is based on one ''real'' factory method that creates base version of the object and many instance ''cloning'' methods that take the values in provided ''prototype'' instance, copy them and modify just one attribute, returning new clone. The usage can then chain the cloning to obtain instances with all desired attributes:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This pattern is based on one ''real'' factory method that creates base version of the object and many instance ''cloning'' methods that take the values in provided ''prototype'' instance, copy them and modify just one attribute, returning new clone. The usage can then chain the cloning to obtain instances with all desired attributes:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;java&amp;quot; snippet=&amp;quot;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;aserverinfo&lt;/del&gt;.cumulative.creation&amp;quot;/&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;java&amp;quot; snippet=&amp;quot;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;ServerConnector&lt;/ins&gt;.cumulative.creation&amp;quot;/&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This pattern keeps the [[Declarative Programming]] benefits, while eliminating many overloaded factory methods. &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This pattern keeps the [[Declarative Programming]] benefits, while eliminating many overloaded factory methods. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Similar patterns include [[APIDesignPatterns:Builder]] or plain [[APIDesignPatterns:Factory]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;comments/&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;comments/&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;[[Category:APIDesignPatterns]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;[[Category:APIDesignPatterns:Creational]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>JaroslavTulach</name></author>	</entry>

	<entry>
		<id>http://wiki.apidesign.org/index.php?title=CumulativeFactory&amp;diff=1632&amp;oldid=prev</id>
		<title>JaroslavTulach at 17:44, 9 November 2008</title>
		<link rel="alternate" type="text/html" href="http://wiki.apidesign.org/index.php?title=CumulativeFactory&amp;diff=1632&amp;oldid=prev"/>
				<updated>2008-11-09T17:44:43Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 17:44, 9 November 2008&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;java&amp;quot; snippet=&amp;quot;aserverinfo.api&amp;quot;/&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;java&amp;quot; snippet=&amp;quot;aserverinfo.api&amp;quot;/&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Now you may want to let the API users modify these fields. One option is to provide setters for each getter. However that immediately turns instances of the '''AServerInfo''' class into mutable objects. As lifecycle of mutable objects is more complicated and as the simpler API the better, it may make sense to search for alternatives. One of &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;the &lt;/del&gt;is regular factory with a single factory method:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Now you may want to let the API users modify these fields. One option is to provide setters for each getter. However that immediately turns instances of the '''AServerInfo''' class into mutable objects. As lifecycle of mutable objects is more complicated and as the simpler API &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;semantics &lt;/ins&gt;the better, it may make sense to search for alternatives. One of &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;them &lt;/ins&gt;is regular factory with a single factory method:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;java&amp;quot; snippet=&amp;quot;aserverinfo.regularcreate&amp;quot;/&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;java&amp;quot; snippet=&amp;quot;aserverinfo.regularcreate&amp;quot;/&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>JaroslavTulach</name></author>	</entry>

	<entry>
		<id>http://wiki.apidesign.org/index.php?title=CumulativeFactory&amp;diff=1629&amp;oldid=prev</id>
		<title>JaroslavTulach: New page: Cumulative Factory is pattern that allows the API Designers get benefits of getters and setters while explorin...</title>
		<link rel="alternate" type="text/html" href="http://wiki.apidesign.org/index.php?title=CumulativeFactory&amp;diff=1629&amp;oldid=prev"/>
				<updated>2008-11-09T15:27:38Z</updated>
		
		<summary type="html">&lt;p&gt;New page: &lt;a href=&quot;/wiki/APIDesignPatterns:CumulativeFactory&quot; class=&quot;mw-redirect&quot; title=&quot;APIDesignPatterns:CumulativeFactory&quot;&gt;Cumulative Factory&lt;/a&gt; is pattern that allows the API Designers get benefits of &lt;a href=&quot;/wiki/APIDesignPatterns:GetterAndSetter&quot; class=&quot;mw-redirect&quot; title=&quot;APIDesignPatterns:GetterAndSetter&quot;&gt;getters and setters&lt;/a&gt; while explorin...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[APIDesignPatterns:CumulativeFactory|Cumulative Factory]] is pattern that allows the API Designers get benefits of [[APIDesignPatterns:GetterAndSetter|getters and setters]] while exploring the benefits of [[Declarative Programming]]. Imagine that you have an API with getters and few callable methods:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot; snippet=&amp;quot;aserverinfo.api&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you may want to let the API users modify these fields. One option is to provide setters for each getter. However that immediately turns instances of the '''AServerInfo''' class into mutable objects. As lifecycle of mutable objects is more complicated and as the simpler API the better, it may make sense to search for alternatives. One of the is regular factory with a single factory method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot; snippet=&amp;quot;aserverinfo.regularcreate&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is indeed acceptable solution, yet it suffers from enormous duplication of factory methods. As the API is evolving, it adds more and more getters and each such addition requires new overloaded version of the factory method. This proliferation of many methods with same name and different arguments may not be fully desirable. In such case, one can benefit from using [[APIDesignPatterns:CumulativeFactory|Cumulative Factory]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot; snippet=&amp;quot;aserverinfo.cumulative.factory&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This pattern is based on one ''real'' factory method that creates base version of the object and many instance ''cloning'' methods that take the values in provided ''prototype'' instance, copy them and modify just one attribute, returning new clone. The usage can then chain the cloning to obtain instances with all desired attributes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot; snippet=&amp;quot;aserverinfo.cumulative.creation&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This pattern keeps the [[Declarative Programming]] benefits, while eliminating many overloaded factory methods. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;comments/&amp;gt;&lt;/div&gt;</summary>
		<author><name>JaroslavTulach</name></author>	</entry>

	</feed>