<?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: Old Money</title>
	<atom:link href="http://www.investigations.4-lom.com/2007/12/22/old-money/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.investigations.4-lom.com/2007/12/22/old-money/</link>
	<description>Failing better at understanding the past</description>
	<lastBuildDate>Mon, 12 Dec 2011 17:50:48 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Investigations of a Dog &#187; New Old Money</title>
		<link>http://www.investigations.4-lom.com/2007/12/22/old-money/comment-page-1/#comment-11717</link>
		<dc:creator>Investigations of a Dog &#187; New Old Money</dc:creator>
		<pubDate>Mon, 24 Dec 2007 17:02:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.investigations.4-lom.com/2007/12/22/old-money/#comment-11717</guid>
		<description>[...] previous post: Old Money &#8212; [...]</description>
		<content:encoded><![CDATA[<p>[...] previous post: Old Money &mdash; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gavin Robinson</title>
		<link>http://www.investigations.4-lom.com/2007/12/22/old-money/comment-page-1/#comment-11627</link>
		<dc:creator>Gavin Robinson</dc:creator>
		<pubDate>Sun, 23 Dec 2007 20:29:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.investigations.4-lom.com/2007/12/22/old-money/#comment-11627</guid>
		<description>For example if the pounds column is so badly damaged that it&#039;s impossible to tell anything about it, even how many digits there are (also in these documents arabic numerals aren&#039;t used consistently, sometimes you get roman numerals or even amounts written in words!). In this case it&#039;s only possible to say that the number of pounds can&#039;t be less than 0, but the shillings and pence might still be known (or they might not). I might still want to use that figure in calculations, but the knock-on effect will be that any total derived from it will also be a minimum, with no known maximum.

Anyway, I think at this level of abstraction those 3 scenarios cover everything that could possibly happen. This is only meant to deal with certainty/uncertainty at the level of performing calculations. There&#039;s scope for more subtle distinctions at other levels, such as in the XML or in the functions that pull data out of XML and put it into objects.

For example, an amount might be damaged but it might still be possible to supply the correct figure from another part of the document or by comparing with other documents. In that case the XML could indicate that the figure is supplied by an editor but believed to be correct. Then maybe you could set a parameter when importing the XML to say whether those editorial interventions should be treated as exact or unknown (depending on how pedantic you want to be).</description>
		<content:encoded><![CDATA[<p>For example if the pounds column is so badly damaged that it&#8217;s impossible to tell anything about it, even how many digits there are (also in these documents arabic numerals aren&#8217;t used consistently, sometimes you get roman numerals or even amounts written in words!). In this case it&#8217;s only possible to say that the number of pounds can&#8217;t be less than 0, but the shillings and pence might still be known (or they might not). I might still want to use that figure in calculations, but the knock-on effect will be that any total derived from it will also be a minimum, with no known maximum.</p>
<p>Anyway, I think at this level of abstraction those 3 scenarios cover everything that could possibly happen. This is only meant to deal with certainty/uncertainty at the level of performing calculations. There&#8217;s scope for more subtle distinctions at other levels, such as in the XML or in the functions that pull data out of XML and put it into objects.</p>
<p>For example, an amount might be damaged but it might still be possible to supply the correct figure from another part of the document or by comparing with other documents. In that case the XML could indicate that the figure is supplied by an editor but believed to be correct. Then maybe you could set a parameter when importing the XML to say whether those editorial interventions should be treated as exact or unknown (depending on how pedantic you want to be).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Brumfield</title>
		<link>http://www.investigations.4-lom.com/2007/12/22/old-money/comment-page-1/#comment-11626</link>
		<dc:creator>Ben Brumfield</dc:creator>
		<pubDate>Sun, 23 Dec 2007 19:57:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.investigations.4-lom.com/2007/12/22/old-money/#comment-11626</guid>
		<description>I like the reorganization!

I don&#039;t feel like I know enough about the textual issues you&#039;re dealing with to comment on your specific design, I&#039;m afraid.  What is the circumstance under which &lt;code&gt;min&lt;/code&gt; would be useful (scenario 3 above)?</description>
		<content:encoded><![CDATA[<p>I like the reorganization!</p>
<p>I don&#8217;t feel like I know enough about the textual issues you&#8217;re dealing with to comment on your specific design, I&#8217;m afraid.  What is the circumstance under which <code>min</code> would be useful (scenario 3 above)?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gavin Robinson</title>
		<link>http://www.investigations.4-lom.com/2007/12/22/old-money/comment-page-1/#comment-11621</link>
		<dc:creator>Gavin Robinson</dc:creator>
		<pubDate>Sun, 23 Dec 2007 16:48:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.investigations.4-lom.com/2007/12/22/old-money/#comment-11621</guid>
		<description>After some more thought, this could be the way to do it:

As you said, keep the OldMoney class purely for doing calculations on money, so it only has pounds, shillings, and pence member variables and the overloaded operators to do things with them.

Then another class which can have one of the following three members:

exact - a single OldMoney object showing the exact amount

range - a pair of OldMoney objects showing the minimum and maximum amount

min - a single OldMoney object showing the minimum amount (maximum is completely unknown in this case)

When adding two instances of this class I can check to see which member exists in each instance.

If left and right both have exact: the result is assigned to exact

If both have range, or one has range and one has exact: a minimum and maximum are calculated and assigned to range

If either has min: only a minimum is calculated and assigned to min

Whatever happens the same kind of object gets returned so we can do the same operations on it and check its accuracy. The actual calculations are handled by the OldMoney class, and this new class just decides what to do with the results.

I haven&#039;t tried implementing this yet, but it looks good on paper.</description>
		<content:encoded><![CDATA[<p>After some more thought, this could be the way to do it:</p>
<p>As you said, keep the OldMoney class purely for doing calculations on money, so it only has pounds, shillings, and pence member variables and the overloaded operators to do things with them.</p>
<p>Then another class which can have one of the following three members:</p>
<p>exact &#8211; a single OldMoney object showing the exact amount</p>
<p>range &#8211; a pair of OldMoney objects showing the minimum and maximum amount</p>
<p>min &#8211; a single OldMoney object showing the minimum amount (maximum is completely unknown in this case)</p>
<p>When adding two instances of this class I can check to see which member exists in each instance.</p>
<p>If left and right both have exact: the result is assigned to exact</p>
<p>If both have range, or one has range and one has exact: a minimum and maximum are calculated and assigned to range</p>
<p>If either has min: only a minimum is calculated and assigned to min</p>
<p>Whatever happens the same kind of object gets returned so we can do the same operations on it and check its accuracy. The actual calculations are handled by the OldMoney class, and this new class just decides what to do with the results.</p>
<p>I haven&#8217;t tried implementing this yet, but it looks good on paper.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gavin Robinson</title>
		<link>http://www.investigations.4-lom.com/2007/12/22/old-money/comment-page-1/#comment-11618</link>
		<dc:creator>Gavin Robinson</dc:creator>
		<pubDate>Sun, 23 Dec 2007 15:53:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.investigations.4-lom.com/2007/12/22/old-money/#comment-11618</guid>
		<description>That&#039;s a really good point. I also need to think more carefully about how to represent uncertainty in the XML. Right now money elements either have a value or no value, but I could include attributes to give minimum and maximum for missing values, and explanations of what&#039;s missing and/or how it&#039;s been filled in.</description>
		<content:encoded><![CDATA[<p>That&#8217;s a really good point. I also need to think more carefully about how to represent uncertainty in the XML. Right now money elements either have a value or no value, but I could include attributes to give minimum and maximum for missing values, and explanations of what&#8217;s missing and/or how it&#8217;s been filled in.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Brumfield</title>
		<link>http://www.investigations.4-lom.com/2007/12/22/old-money/comment-page-1/#comment-11617</link>
		<dc:creator>Ben Brumfield</dc:creator>
		<pubDate>Sun, 23 Dec 2007 15:25:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.investigations.4-lom.com/2007/12/22/old-money/#comment-11617</guid>
		<description>The more I think about this, the more I&#039;m sure you need to separate the pre-decimal system logic from the uncertainty logic.  Swapping integers with lists in your OldMoney class just mixes that logic up more.  

Think about how simple your OldMoney class would be without any uncertainty logic (especially if you add a &lt;code&gt;fromPence&lt;/code&gt; constructor).  

Now think about an UncertainOldMoney class that contains (composition is the pattern here, rather than inheritance) an OldMoney figure, plus some kind of descriptor for how, precisely it&#039;s uncertain.  You can then concentrate on what that descriptor should be on its own, separate from the pounds/pence logic.  Perhaps you represent the range with a pair of min/max OldMoney objects, perhaps a flag, perhaps my &lt;code&gt;offBy&lt;/code&gt; OldMoney logic, or perhaps something that&#039;s more representative of the text and explains which digits are illegible or missing.  The point is, you can play with that separately once you encapsulate that logic.</description>
		<content:encoded><![CDATA[<p>The more I think about this, the more I&#8217;m sure you need to separate the pre-decimal system logic from the uncertainty logic.  Swapping integers with lists in your OldMoney class just mixes that logic up more.  </p>
<p>Think about how simple your OldMoney class would be without any uncertainty logic (especially if you add a <code>fromPence</code> constructor).  </p>
<p>Now think about an UncertainOldMoney class that contains (composition is the pattern here, rather than inheritance) an OldMoney figure, plus some kind of descriptor for how, precisely it&#8217;s uncertain.  You can then concentrate on what that descriptor should be on its own, separate from the pounds/pence logic.  Perhaps you represent the range with a pair of min/max OldMoney objects, perhaps a flag, perhaps my <code>offBy</code> OldMoney logic, or perhaps something that&#8217;s more representative of the text and explains which digits are illegible or missing.  The point is, you can play with that separately once you encapsulate that logic.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gavin Robinson</title>
		<link>http://www.investigations.4-lom.com/2007/12/22/old-money/comment-page-1/#comment-11612</link>
		<dc:creator>Gavin Robinson</dc:creator>
		<pubDate>Sun, 23 Dec 2007 14:23:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.investigations.4-lom.com/2007/12/22/old-money/#comment-11612</guid>
		<description>Another thought: maybe instead of a single int for each pounds/shillings/pence value I could use a list of ints. If it only has one element it&#039;s an exact figure, and if it has two elements they&#039;re the minimum and maximum. Might create more complications than it solves though, as I haven&#039;t thought about it very carefully yet, let alone tried it. It&#039;d still have the problem of using null where the figure is unknown and there&#039;s no way of calculating any likely maximum.

Basically there are three possible cases, depending on what&#039;s missing from the documents:

1. We can calculate an exact total.
2. We can calculate a minimum and a maximum.
3. We can only calculate a minimum.

All three scenarios are likely to occur and need to be dealt with. 3 seems to be the trickiest one. My original idea of setting an exact flag was really about dealing with 3 but isn&#039;t good enough for 2. Your imprecise money object looks like the best solution to 2 but I&#039;m not sure how it would deal with 3.</description>
		<content:encoded><![CDATA[<p>Another thought: maybe instead of a single int for each pounds/shillings/pence value I could use a list of ints. If it only has one element it&#8217;s an exact figure, and if it has two elements they&#8217;re the minimum and maximum. Might create more complications than it solves though, as I haven&#8217;t thought about it very carefully yet, let alone tried it. It&#8217;d still have the problem of using null where the figure is unknown and there&#8217;s no way of calculating any likely maximum.</p>
<p>Basically there are three possible cases, depending on what&#8217;s missing from the documents:</p>
<p>1. We can calculate an exact total.<br />
2. We can calculate a minimum and a maximum.<br />
3. We can only calculate a minimum.</p>
<p>All three scenarios are likely to occur and need to be dealt with. 3 seems to be the trickiest one. My original idea of setting an exact flag was really about dealing with 3 but isn&#8217;t good enough for 2. Your imprecise money object looks like the best solution to 2 but I&#8217;m not sure how it would deal with 3.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gavin Robinson</title>
		<link>http://www.investigations.4-lom.com/2007/12/22/old-money/comment-page-1/#comment-11611</link>
		<dc:creator>Gavin Robinson</dc:creator>
		<pubDate>Sun, 23 Dec 2007 12:20:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.investigations.4-lom.com/2007/12/22/old-money/#comment-11611</guid>
		<description>Good ideas there. There is definitely a lot more scope for narrowing down uncertainty. This was just a first attempt, and I&#039;m going to keep working on it to make it better. For now I&#039;m just pleased that I&#039;ve got something that works after only a few days of working with Python.</description>
		<content:encoded><![CDATA[<p>Good ideas there. There is definitely a lot more scope for narrowing down uncertainty. This was just a first attempt, and I&#8217;m going to keep working on it to make it better. For now I&#8217;m just pleased that I&#8217;ve got something that works after only a few days of working with Python.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Brumfield</title>
		<link>http://www.investigations.4-lom.com/2007/12/22/old-money/comment-page-1/#comment-11520</link>
		<dc:creator>Ben Brumfield</dc:creator>
		<pubDate>Sat, 22 Dec 2007 21:46:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.investigations.4-lom.com/2007/12/22/old-money/#comment-11520</guid>
		<description>One other thought: you could probably take a lesson from the concept of &quot;significant digits&quot; in scientific notation to attach inexact flags to each figure.  

Say you&#039;re adding 5/4/3? to 2/1/3.  (I&#039;ll use parens for grouping here.)  Rather than get (7/5/6)?  and assume the whole figure is inexact, you should be able to get 7/5/(6?)

When you&#039;re summing, in this system you may get an estimate of how much your total is off by.

Though I suppose that if you really were serious about finding that out, you&#039;d replace your boolean &lt;code&gt;exact&lt;/code&gt; parameter with an OldMoney &lt;code&gt;off_by&lt;/code&gt; parameter that defaults to zero.  So 5/4/3? could be represented as &lt;code&gt;OldMoney(5, 4, 3, OldMoney(0,0,7))&lt;/code&gt; (7 pence since you know that your reading of 3 was correct insofar as 3 was between 0 and 9, as there was only one digit written).  

Assume furthermore that that off_by parameter has an &lt;code&gt;off_by&lt;/code&gt; accessor that returns an &lt;code&gt;OldMoney&lt;/code&gt; object.

With that setup, you&#039;d change your add method to 
&lt;code&gt;return OldMoney(self.toPence()+r.toPence, self.off_by+r.off_by)&lt;/code&gt;

That could probably stand a bit of refactoring to separate the concept of exactness from Old Money.  Remove the exact parameter from OldMoney and into its own ImpreciseMoney class, composed of two OldMoney variables.  Add a bunch of ImpreciseMoney totals and you&#039;ll get a figure and the amount it&#039;s off by pretty easily.</description>
		<content:encoded><![CDATA[<p>One other thought: you could probably take a lesson from the concept of &#8220;significant digits&#8221; in scientific notation to attach inexact flags to each figure.  </p>
<p>Say you&#8217;re adding 5/4/3? to 2/1/3.  (I&#8217;ll use parens for grouping here.)  Rather than get (7/5/6)?  and assume the whole figure is inexact, you should be able to get 7/5/(6?)</p>
<p>When you&#8217;re summing, in this system you may get an estimate of how much your total is off by.</p>
<p>Though I suppose that if you really were serious about finding that out, you&#8217;d replace your boolean <code>exact</code> parameter with an OldMoney <code>off_by</code> parameter that defaults to zero.  So 5/4/3? could be represented as <code>OldMoney(5, 4, 3, OldMoney(0,0,7))</code> (7 pence since you know that your reading of 3 was correct insofar as 3 was between 0 and 9, as there was only one digit written).  </p>
<p>Assume furthermore that that off_by parameter has an <code>off_by</code> accessor that returns an <code>OldMoney</code> object.</p>
<p>With that setup, you&#8217;d change your add method to<br />
<code>return OldMoney(self.toPence()+r.toPence, self.off_by+r.off_by)</code></p>
<p>That could probably stand a bit of refactoring to separate the concept of exactness from Old Money.  Remove the exact parameter from OldMoney and into its own ImpreciseMoney class, composed of two OldMoney variables.  Add a bunch of ImpreciseMoney totals and you&#8217;ll get a figure and the amount it&#8217;s off by pretty easily.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Brumfield</title>
		<link>http://www.investigations.4-lom.com/2007/12/22/old-money/comment-page-1/#comment-11519</link>
		<dc:creator>Ben Brumfield</dc:creator>
		<pubDate>Sat, 22 Dec 2007 21:29:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.investigations.4-lom.com/2007/12/22/old-money/#comment-11519</guid>
		<description>I don&#039;t know Python, but it seems like you&#039;d get better code re-use by creating a constructor for OldMoney that takes pence as its parameter.  Move the pounds/shillings/pence stuff into that from your add method, and replace the guts of add with something like

&lt;code&gt;return OldMoney(self.toPence()+r.toPence())&lt;/code&gt;

If you want to make sure your certainty parameter gets set, pass that down too:

&lt;code&gt;return OldMoney(self.toPence()+r.toPence(), self.exact &amp;&amp; r.exact)&lt;/code&gt;

Caveats: this is certainly not valid Python, so you may find yourself using what Java calls a static constructor method &lt;code&gt;OldMoney.fromPence(p, e=True)&lt;/code&gt; instead.  I&#039;m also presuming you want one inexact figure to make the total inexact as well, hence the boolean AND.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t know Python, but it seems like you&#8217;d get better code re-use by creating a constructor for OldMoney that takes pence as its parameter.  Move the pounds/shillings/pence stuff into that from your add method, and replace the guts of add with something like</p>
<p><code>return OldMoney(self.toPence()+r.toPence())</code></p>
<p>If you want to make sure your certainty parameter gets set, pass that down too:</p>
<p><code>return OldMoney(self.toPence()+r.toPence(), self.exact &amp;&amp; r.exact)</code></p>
<p>Caveats: this is certainly not valid Python, so you may find yourself using what Java calls a static constructor method <code>OldMoney.fromPence(p, e=True)</code> instead.  I&#8217;m also presuming you want one inexact figure to make the total inexact as well, hence the boolean AND.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

