<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.visual-prolog.com/index.php?action=history&amp;feed=atom&amp;title=Abstract_factory_pattern</id>
	<title>Abstract factory pattern - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.visual-prolog.com/index.php?action=history&amp;feed=atom&amp;title=Abstract_factory_pattern"/>
	<link rel="alternate" type="text/html" href="https://wiki.visual-prolog.com/index.php?title=Abstract_factory_pattern&amp;action=history"/>
	<updated>2026-04-12T13:54:56Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://wiki.visual-prolog.com/index.php?title=Abstract_factory_pattern&amp;diff=3730&amp;oldid=prev</id>
		<title>Thomas Linder Puls: link-&gt;italics</title>
		<link rel="alternate" type="text/html" href="https://wiki.visual-prolog.com/index.php?title=Abstract_factory_pattern&amp;diff=3730&amp;oldid=prev"/>
		<updated>2013-08-22T09:04:22Z</updated>

		<summary type="html">&lt;p&gt;link-&amp;gt;italics&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 11:04, 22 August 2013&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;From [[wikipedia::Abstract factory pattern]]:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;From [[wikipedia::Abstract factory pattern]]:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:A software &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Design pattern|&lt;/del&gt;design pattern&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]]&lt;/del&gt;, the &amp;#039;&amp;#039;&amp;#039;Abstract Factory Pattern&amp;#039;&amp;#039;&amp;#039; provides a way to encapsulate a group of individual &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Factory method pattern|&lt;/del&gt;factories&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]] &lt;/del&gt;that have a common theme. In normal usage, the client software would create a concrete implementation of the abstract factory and then use the generic &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Interface|&lt;/del&gt;interface&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]]&lt;/del&gt;s to create the concrete &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Object|&lt;/del&gt;object&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]]&lt;/del&gt;s that are part of the theme. The &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[&lt;/del&gt;client&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|client]] &lt;/del&gt;does not know (nor care) about which concrete objects it gets from each of these internal factories since it uses only the generic interfaces of their products. This pattern separates the details of implementation of a set of objects from its general usage.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:A software &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#039;&amp;#039;&lt;/ins&gt;design pattern&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#039;&amp;#039;&lt;/ins&gt;, the &amp;#039;&amp;#039;&amp;#039;Abstract Factory Pattern&amp;#039;&amp;#039;&amp;#039; provides a way to encapsulate a group of individual &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#039;&amp;#039;&lt;/ins&gt;factories&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#039;&amp;#039; &lt;/ins&gt;that have a common theme. In normal usage, the client software would create a concrete implementation of the abstract factory and then use the generic &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#039;&amp;#039;&lt;/ins&gt;interface&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#039;&amp;#039;&lt;/ins&gt;s to create the concrete &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#039;&amp;#039;&lt;/ins&gt;object&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#039;&amp;#039;&lt;/ins&gt;s that are part of the theme. The &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#039;&amp;#039;&lt;/ins&gt;client&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#039;&amp;#039; &lt;/ins&gt;does not know (nor care) about which concrete objects it gets from each of these internal factories since it uses only the generic interfaces of their products. This pattern separates the details of implementation of a set of objects from its general usage.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Example ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Example ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Thomas Linder Puls</name></author>
	</entry>
	<entry>
		<id>https://wiki.visual-prolog.com/index.php?title=Abstract_factory_pattern&amp;diff=442&amp;oldid=prev</id>
		<title>Thomas Linder Puls: Initial text</title>
		<link rel="alternate" type="text/html" href="https://wiki.visual-prolog.com/index.php?title=Abstract_factory_pattern&amp;diff=442&amp;oldid=prev"/>
		<updated>2007-09-30T22:54:28Z</updated>

		<summary type="html">&lt;p&gt;Initial text&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;From [[wikipedia::Abstract factory pattern]]:&lt;br /&gt;
&lt;br /&gt;
:A software [[Design pattern|design pattern]], the &amp;#039;&amp;#039;&amp;#039;Abstract Factory Pattern&amp;#039;&amp;#039;&amp;#039; provides a way to encapsulate a group of individual [[Factory method pattern|factories]] that have a common theme. In normal usage, the client software would create a concrete implementation of the abstract factory and then use the generic [[Interface|interface]]s to create the concrete [[Object|object]]s that are part of the theme. The [[client|client]] does not know (nor care) about which concrete objects it gets from each of these internal factories since it uses only the generic interfaces of their products. This pattern separates the details of implementation of a set of objects from its general usage.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
A program must work with one of two different GUI systems: &amp;#039;&amp;#039;&amp;#039;win&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;osx&amp;#039;&amp;#039;&amp;#039;.  Each of the GUI systems provides &amp;#039;&amp;#039;&amp;#039;button&amp;#039;&amp;#039;&amp;#039;s and &amp;#039;&amp;#039;&amp;#039;edit&amp;#039;&amp;#039;&amp;#039; controls.  The controls are represented by the same interfaces in the two GUI systems, but different classes:&lt;br /&gt;
&lt;br /&gt;
:{| {{prettytable}}&lt;br /&gt;
! interface&lt;br /&gt;
! win class&lt;br /&gt;
! osx class&lt;br /&gt;
|-&lt;br /&gt;
| button&lt;br /&gt;
| winButton : button&lt;br /&gt;
| osxButton : button&lt;br /&gt;
|-&lt;br /&gt;
| edit&lt;br /&gt;
| winEdit : edit&lt;br /&gt;
| osxEdit : edit&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
So when we use the &amp;#039;&amp;#039;&amp;#039;win&amp;#039;&amp;#039;&amp;#039; system, we must use the win- classes; and when we use the &amp;#039;&amp;#039;&amp;#039;osx&amp;#039;&amp;#039;&amp;#039; system, we must use the osx- classes.  Rather than testing for GUI system each time we want to create a button or edit control, we use an &amp;#039;&amp;#039;abstract factory&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
The abstract factory is an object that can create (i.e. manufacture) buttons and edit controls:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;vip&amp;gt;interface guiFactory&lt;br /&gt;
    predicates&lt;br /&gt;
        createButton : () -&amp;gt; button NewButton.&lt;br /&gt;
        createEdit : () -&amp;gt; edit Edit.&lt;br /&gt;
end interface guiFactory&amp;lt;/vip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We implement two factories, one for win- controls:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;vip&amp;gt;class winFactory : guiFactory&lt;br /&gt;
end class winFactory&amp;lt;/vip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;vip&amp;gt;implement winFactory&lt;br /&gt;
    clauses&lt;br /&gt;
        createButton() = winButton::new().&lt;br /&gt;
    clauses&lt;br /&gt;
        createEdit() = winEdit::new().&lt;br /&gt;
end implement winFactory&amp;lt;/vip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and one for osx- controls:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;vip&amp;gt;class osxFactory : guiFactory&lt;br /&gt;
end class osxFactory&amp;lt;/vip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;vip&amp;gt;implement osxFactory&lt;br /&gt;
    clauses&lt;br /&gt;
        createButton() = osxButton::new().&lt;br /&gt;
    clauses&lt;br /&gt;
        createEdit() = osxEdit::new().&lt;br /&gt;
end implement osxFactory&amp;lt;/vip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we can some where create either a &amp;#039;&amp;#039;&amp;#039;win&amp;#039;&amp;#039;&amp;#039;-factory or an &amp;#039;&amp;#039;&amp;#039;osx&amp;#039;&amp;#039;&amp;#039;-factory, and in the rest of the program we will create controls using this factory.&lt;br /&gt;
&lt;br /&gt;
The goal here is just for illustrative purposes; in a real program the GUI system would have to be initialized, and the button must be drawn somewhere.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;vip&amp;gt;goal&lt;br /&gt;
    if 1 = config::getAttribute(&amp;quot;OS_TYPE&amp;quot;) then&lt;br /&gt;
        GuiFactory = winFactory::new()&lt;br /&gt;
    else&lt;br /&gt;
        GuiFactory = osxFactory::new()&lt;br /&gt;
    end if,&lt;br /&gt;
    Button = GuiFactory:createButton(),&lt;br /&gt;
    Button:setText(&amp;quot;Play&amp;quot;),&lt;br /&gt;
    Button:paint().&amp;lt;/vip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Additional Notes ==&lt;br /&gt;
&lt;br /&gt;
#In the example above we create one factory at the very start of the program and retain it throughout the entire execution. But in other setup&amp;#039;s you may create several factories for each their purpose, or create factories that are only temporarily and then disposed again. Consider for example a &amp;#039;&amp;#039;&amp;#039;print&amp;#039;&amp;#039;&amp;#039; version of the factory above.  You might create an instance of this factory, when you want to print a &amp;quot;dialog&amp;quot; and then dispose it again once you have printed the dialog.  So this factory will only live temporarily and it may coexist with one of the other factories.&lt;br /&gt;
#The client software does not have any knowledge about the concrete factories. Particularly, it does not know how many there are, the name, purpose or any other characteristics about them.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
*[[wikipedia:Abstract factory pattern]]&lt;br /&gt;
*[[wikipedia:Design_pattern_%28computer_science%29|wikipedia:Design pattern (computer science)]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Design Pattern]]&lt;/div&gt;</summary>
		<author><name>Thomas Linder Puls</name></author>
	</entry>
</feed>