<?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: Python wanderings, part one</title>
	<atom:link href="http://www.tenshu.net/archives/2009/12/23/python-wanderings-part-one/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tenshu.net/archives/2009/12/23/python-wanderings-part-one/</link>
	<description>Pondering the mystery...</description>
	<lastBuildDate>Tue, 07 Sep 2010 21:09:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: cmsj</title>
		<link>http://www.tenshu.net/archives/2009/12/23/python-wanderings-part-one/comment-page-1/#comment-628</link>
		<dc:creator>cmsj</dc:creator>
		<pubDate>Fri, 25 Dec 2009 21:31:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.tenshu.net/?p=360#comment-628</guid>
		<description>Jamu: yeah I&#039;ve cheated a bit with my testing for my Borg class, in that I haven&#039;t yet thought about how I&#039;m going to fire off tests - right now I&#039;m just abusing __main__ in .py files that otherwise don&#039;t get called directly to import doctest, do any setup and kick off the tests.

I really appreciate you commenting with what you would do in this situation - that&#039;s exactly the kind of thing I want to come out of these posts. Professionals can come and tell anyone who reads this (me included) why I&#039;m wrong :)</description>
		<content:encoded><![CDATA[<p>Jamu: yeah I&#8217;ve cheated a bit with my testing for my Borg class, in that I haven&#8217;t yet thought about how I&#8217;m going to fire off tests &#8211; right now I&#8217;m just abusing __main__ in .py files that otherwise don&#8217;t get called directly to import doctest, do any setup and kick off the tests.</p>
<p>I really appreciate you commenting with what you would do in this situation &#8211; that&#8217;s exactly the kind of thing I want to come out of these posts. Professionals can come and tell anyone who reads this (me included) why I&#8217;m wrong :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jamu Kakar</title>
		<link>http://www.tenshu.net/archives/2009/12/23/python-wanderings-part-one/comment-page-1/#comment-627</link>
		<dc:creator>Jamu Kakar</dc:creator>
		<pubDate>Fri, 25 Dec 2009 19:20:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.tenshu.net/?p=360#comment-627</guid>
		<description>The Borg pattern is cool, but it makes it very hard to create a fake instance of a Borg object for use in tests.  Basically, it&#039;s a global variable in a jumpsuit.  At first glance it seems to be *super cool*, but in the end you have basically the same set of problems as you do with global variables.  In this kind of situation I would pass around object references (since you have only 4 core objects, the __init__ overhead isn&#039;t something worth working around) or I provide a function, such as get_terminator, that returns a singleton.

It&#039;s not only in tests that this kind of thing matters.  Consider a user that wants to replace Config with a version that backs onto SQLite, for example.  This is quite hard with the Borg pattern, because it hard-codes dependencies.  All that said, it is a cool pattern, and it does have a certain simplicity to it that is appealing.

Thanks for the post, it&#039;s nice to read about the thought process you&#039;ve gone through to get to a nice solution.</description>
		<content:encoded><![CDATA[<p>The Borg pattern is cool, but it makes it very hard to create a fake instance of a Borg object for use in tests.  Basically, it&#8217;s a global variable in a jumpsuit.  At first glance it seems to be *super cool*, but in the end you have basically the same set of problems as you do with global variables.  In this kind of situation I would pass around object references (since you have only 4 core objects, the __init__ overhead isn&#8217;t something worth working around) or I provide a function, such as get_terminator, that returns a singleton.</p>
<p>It&#8217;s not only in tests that this kind of thing matters.  Consider a user that wants to replace Config with a version that backs onto SQLite, for example.  This is quite hard with the Borg pattern, because it hard-codes dependencies.  All that said, it is a cool pattern, and it does have a certain simplicity to it that is appealing.</p>
<p>Thanks for the post, it&#8217;s nice to read about the thought process you&#8217;ve gone through to get to a nice solution.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
