<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Design patterns &#8211; Part 4: Factory method pattern</title>
	<atom:link href="http://www.lotushints.com/2008/12/design-patterns-part-4-factory-method-pattern/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lotushints.com/2008/12/design-patterns-part-4-factory-method-pattern/</link>
	<description>Lotus Notes tips &#38; tricks you always hoped you will not need</description>
	<lastBuildDate>Wed, 14 Dec 2011 20:40:09 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Kenneth</title>
		<link>http://www.lotushints.com/2008/12/design-patterns-part-4-factory-method-pattern/comment-page-1/#comment-1111</link>
		<dc:creator>Kenneth</dc:creator>
		<pubDate>Wed, 24 Aug 2011 10:51:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.lotushints.com/?p=148#comment-1111</guid>
		<description>Thanks for the code, but I have only one thing: You are not applying the factory design pattern on the STORE classes - only the SOFTWARE class and that is a bit confusing and need to be addressed/mentioned in the text. Actually, I would apply the factory design pattern even on the STORE classes:

Public Function getStore(country As String) As CSoftwareStore
	Select Case country
	Case &quot;USA&quot;
		Set getStore = New CUSASoftwareStore
	Case Else
		Set getStore = New CEUSoftwareStore
	End Select
End Function

and then in the agent I could replace the &quot;Dim storeEU&quot; and &quot;Dim storeUSA&quot; with 
Dim store As CSoftwareStore
Set store = getStore(&quot;USA&quot;)
Set sw = store.orderSoftware(&quot;basic&quot;)

or 
Set store = getStore(&quot;EU&quot;)
Set sw = store.orderSoftware(&quot;pro&quot;)

With this approach, the implementation of the different stores are hidden which is one of the main reasons for using the factory design pattern.</description>
		<content:encoded><![CDATA[<p>Thanks for the code, but I have only one thing: You are not applying the factory design pattern on the STORE classes &#8211; only the SOFTWARE class and that is a bit confusing and need to be addressed/mentioned in the text. Actually, I would apply the factory design pattern even on the STORE classes:</p>
<p>Public Function getStore(country As String) As CSoftwareStore<br />
	Select Case country<br />
	Case &#8220;USA&#8221;<br />
		Set getStore = New CUSASoftwareStore<br />
	Case Else<br />
		Set getStore = New CEUSoftwareStore<br />
	End Select<br />
End Function</p>
<p>and then in the agent I could replace the &#8220;Dim storeEU&#8221; and &#8220;Dim storeUSA&#8221; with<br />
Dim store As CSoftwareStore<br />
Set store = getStore(&#8220;USA&#8221;)<br />
Set sw = store.orderSoftware(&#8220;basic&#8221;)</p>
<p>or<br />
Set store = getStore(&#8220;EU&#8221;)<br />
Set sw = store.orderSoftware(&#8220;pro&#8221;)</p>
<p>With this approach, the implementation of the different stores are hidden which is one of the main reasons for using the factory design pattern.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

