<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>tony arkles blog</title>
	<atom:link href="http://blog.chilly.ca/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://blog.chilly.ca</link>
	<description>Computer Science, Electrical Engineering, Photography, Cooking, Uninspired Titles...</description>
	<lastBuildDate>Wed, 30 Sep 2009 21:07:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Language-a-month: Java! Catastrophe!</title>
		<link>http://blog.chilly.ca/?p=293</link>
		<comments>http://blog.chilly.ca/?p=293#comments</comments>
		<pubDate>Wed, 30 Sep 2009 21:07:03 +0000</pubDate>
		<dc:creator>Tony Arkles</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.chilly.ca/?p=293</guid>
		<description><![CDATA[So a good chunk of my month was spent learning a new language, but it wasn&#8217;t Clojure.  I had a large assignment in my Concurrent Programming class (that probably took me way longer than it should have), and three of the big pieces of it were in a language that was otherwise quite foreign [...]]]></description>
			<content:encoded><![CDATA[<p>So a good chunk of my month was spent learning a new language, but it wasn&#8217;t Clojure.  I had a large assignment in my Concurrent Programming class (that probably took me way longer than it should have), and three of the big pieces of it were in a language that was otherwise quite foreign to me: Java.</p>
<p>After all of that, I&#8217;m feeling relatively comfortable with it.  I got to finally try out <a href="http://www.junit.org/">JUnit</a>.  I did some work with sockets (java.net.Socket and java.net.ServerSocket), which felt pretty familiar having used sockets in C.</p>
<p>Also, I feel like I learned a lot of the &#8220;correct&#8221; ways to do things from Josh Bloch&#8217;s <a href="http://www.amazon.ca/gp/product/0321356683?ie=UTF8&#038;tag=tonyarklesblo-20&#038;linkCode=as2&#038;camp=15121&#038;creative=390961&#038;creativeASIN=0321356683">Effective Java</a>.  I don&#8217;t think I can give this book enough praise.  It&#8217;s really, really fantastic for learning the intricate ways that you can mess up when writing Java software.</p>
<p>So&#8230; about Clojure.  I&#8217;d still like to spend more time with it, but I&#8217;m not sure when I&#8217;m going to schedule that in.</p>
<p><em>[All apologies if this sounds a bit like an incoherent rant... I haven't been sleeping nearly enough and I really need to get caught up on that too]</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chilly.ca/?feed=rss2&amp;p=293</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A response to &#8220;Does Usability Really Matter?&#8221;</title>
		<link>http://blog.chilly.ca/?p=290</link>
		<comments>http://blog.chilly.ca/?p=290#comments</comments>
		<pubDate>Mon, 07 Sep 2009 21:44:00 +0000</pubDate>
		<dc:creator>Tony Arkles</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://blog.chilly.ca/?p=290</guid>
		<description><![CDATA[My friend Jeff recently wrote a blog post called &#8220;Does Usability Really Matter?&#8220;.  I found it interesting, and thought that he was on to something, but I figured I&#8217;d contribute a few extra thoughts.
He talks quite a bit about the indicator lights on his home theatre being quite mismatched.  Some are red, some [...]]]></description>
			<content:encoded><![CDATA[<p>My friend Jeff recently wrote a blog post called &#8220;<a href="http://www.ifisgeek.com/2009/09/02/does-usability-really-matter/">Does Usability Really Matter?</a>&#8220;.  I found it interesting, and thought that he was on to something, but I figured I&#8217;d contribute a few extra thoughts.</p>
<p>He talks quite a bit about the indicator lights on his home theatre being quite mismatched.  Some are red, some green, some amber, some devices showed multiple, and there was no real consistency to it.  Strictly, he&#8217;s right; this isn&#8217;t the most usable situation.  </p>
<p>The part he misses is that the indicator lights on his equipment doesn&#8217;t really play that big of a role in the big picture.  Most of the time when I&#8217;m using my TV, I&#8217;m not all that concerned about whether or not the red LED on the front is lit.  All I really care about with my TV is that there&#8217;s a picture on the screen, tuned to the correct channel.</p>
<p>He brings up the TV settings menus as well, mentioning that these don&#8217;t ever really make-or-break the sale when a person is shopping.  I agree with him here too.  It&#8217;s very rare that you need to venture into the settings menu (say, because the contrast needs adjustment).  If it&#8217;s really <i>that</i> difficult, there&#8217;s probably a bright 9-year-old nephew that can do it.</p>
<p>The really important part of the usability of a TV is the ability to change the channel and to control the volume (in my experience). I&#8217;ve used TVs before that took several seconds to change the channel each time, and the experience was brutal.  I channel surf quite a bit, and it&#8217;s really tough to do when it takes 2 minutes to get through all of the channels I don&#8217;t care about.  Some remote controls have very slow repeat rates; when a loud (<a href="http://en.wikipedia.org/wiki/Billy_Mays">R.I.P Billy Mays</a>) commercial comes on, I want to turn the volume down quickly.  If I have to hold the Vol- button for 30 seconds to get the volume low enough&#8230; well, I&#8217;ve missed my opportunity.</p>
<p>I think the most important usability idea that we need to focus on is this: &#8220;Don&#8217;t get in the way of what I&#8217;m really trying to get done.&#8221;  If there&#8217;s an activity that I need to do twice a year, it&#8217;s not a big deal if it&#8217;s a bit tricky.  If I want to do it 40 times an hour, though, it had damned well better work.  </p>
<p>A great example of getting this wrong was one of the first IPTV boxes that SaskTel rolled out (if I recall, they were Pace?).  The on-screen guide was sloooooowwwwww.  Really, really slow.  It would show 4 channels, and going to the next screen took a few seconds to refresh and redraw.  Navigating around the guide had enough latency that you&#8217;d notice it (maybe 300-500ms to move from box-to-box?)  This left a bad taste in a lot of people&#8217;s mouthes, and brought quite a bit of criticism. </p>
<p>They&#8217;ve since addressed this in two different ways: first, navigation is quite a bit quicker in the guide; second, they&#8217;ve added a picture-in-picture showing the channel that you were on when you launched the guide, giving you a good distraction to keep from noticing that it&#8217;s still not quite as snappy as it should be.</p>
<p>THIS is the kind of usability that matters; the in-our-face-everyday usability that you don&#8217;t notice.  Really, I think that is the true mark of great usability: when you can use a product naturally, without even thinking about its usability.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chilly.ca/?feed=rss2&amp;p=290</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dijkstra identifies the need for TDD&#8230;</title>
		<link>http://blog.chilly.ca/?p=287</link>
		<comments>http://blog.chilly.ca/?p=287#comments</comments>
		<pubDate>Mon, 07 Sep 2009 02:32:12 +0000</pubDate>
		<dc:creator>Tony Arkles</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[grow]]></category>
		<category><![CDATA[tdd]]></category>

		<guid isPermaLink="false">http://blog.chilly.ca/?p=287</guid>
		<description><![CDATA[I&#8217;m not sure when this was published, but in EWD 1305, Dijkstra identifies the clear need for TDD, presumably well before the phrase &#8220;Test-Driven Development&#8221; is ever used:
A programmer has to be able to demonstrate that his program has the required properties. If this comes as an afterthought, it is all but certain that he [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not sure when this was published, but in <a href="http://www.cs.utexas.edu/~EWD/transcriptions/EWD13xx/EWD1305.html">EWD 1305</a>, Dijkstra identifies the clear need for TDD, presumably well before the phrase &#8220;Test-Driven Development&#8221; is ever used:</p>
<blockquote><p>A programmer has to be able to demonstrate that his program has the required properties. If this comes as an afterthought, it is all but certain that he won&#8217;t be able to meet this obligation: only if he allows this obligation to influence his design, there is hope he can meet it. Pure a posteriori verification denies you that whole-some influence and is therefore putting the cart before the horse, but that is exactly what happens in the software houses where &#8220;programming&#8221; and &#8220;quality assurance&#8221; are done by different groups. [Needless to say, those houses deliver without warranty.]
</p></blockquote>
<p>The man never ceases to amaze me.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chilly.ca/?feed=rss2&amp;p=287</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Speed Kills&#8221; &#8211; On Being A Professional</title>
		<link>http://blog.chilly.ca/?p=285</link>
		<comments>http://blog.chilly.ca/?p=285#comments</comments>
		<pubDate>Fri, 04 Sep 2009 00:45:36 +0000</pubDate>
		<dc:creator>Tony Arkles</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.chilly.ca/?p=285</guid>
		<description><![CDATA[This article is just way too good not to link to Speed Kills.
Some choice quotes:
Frankly, the ability to be deliberate is the mark of a professional. Professionals do not rush. Professionals understand the value of cleanliness and discipline. Professionals do not write bad code — ever.
Or how about:
If you want to be a professional, if [...]]]></description>
			<content:encoded><![CDATA[<p>This article is just way too good not to link to <a href="http://programmer.97things.oreilly.com/wiki/index.php/Speed_Kills">Speed Kills</a>.</p>
<p>Some choice quotes:</p>
<blockquote><p>Frankly, the ability to be deliberate is the mark of a professional. Professionals do not rush. Professionals understand the value of cleanliness and discipline. Professionals do not write bad code — ever.</p></blockquote>
<p>Or how about:</p>
<blockquote><p>If you want to be a professional, if you want to be a craftsman, then you must not rush. You must keep your code clean. So clean it barely needs comments.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.chilly.ca/?feed=rss2&amp;p=285</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Back to School!</title>
		<link>http://blog.chilly.ca/?p=281</link>
		<comments>http://blog.chilly.ca/?p=281#comments</comments>
		<pubDate>Thu, 03 Sep 2009 14:27:47 +0000</pubDate>
		<dc:creator>Tony Arkles</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.chilly.ca/?p=281</guid>
		<description><![CDATA[I&#8217;m so excited about this that I had to write about it.  
Today I start a new journey.  I&#8217;ve left my otherwise fantastic job at VendAsta to start my M.Sc. in Computer Science. I&#8217;ve been working in industry for 2.5 years now, and I figured I&#8217;d like to spend more time focused on [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m so excited about this that I had to write about it.  </p>
<p>Today I start a new journey.  I&#8217;ve left my otherwise fantastic job at <a href="http://www.vendasta.com">VendAsta</a> to start my M.Sc. in Computer Science. I&#8217;ve been working in industry for 2.5 years now, and I figured I&#8217;d like to spend more time focused on learning and growing.  </p>
<p>I haven&#8217;t picked a thesis topic yet, but it&#8217;s likely to be related to distributed computing.  I&#8217;m going to be working in the <a href="http://www.cs.usask.ca/projects/discus/">DISCUS</a> lab at the University of Saskatchewan, with my long-time friend and mentor, <a href="http://www.cs.usask.ca/homepages/faculty/makaroff/">Dwight Makaroff</a>.  </p>
<p>It&#8217;s the first day of class, and I&#8217;m just getting settled in.  I don&#8217;t have desk space yet (turns out that no one is around the DISCUS lab at 8:00am&#8230;), but I&#8217;ve snaked a table in the lab and already it feels like home.</p>
<p>I&#8217;m going to try to be more organized this time around (some know about the chaos that was my undergrad career).  I&#8217;m going to try to incorporate some of the principles from the excellent <a href="http://www.calnewport.com/blog/">Study Hacks</a> blog; in particular, I&#8217;m going to do <a href="http://calnewport.com/blog/2009/08/25/the-unsinkable-student-organization-system/">The Unsinkable Student Organization System</a>.  For time management, I think I&#8217;m going to give <a href="http://www.pomodorotechnique.com/">The Pomodoro Technique</a> a shot, especially for writing assignments.</p>
<p>Also, like I mentioned before, I&#8217;m going to start my <a href="http://blog.chilly.ca/?p=269">Language-a-month</a> plan, and I think I&#8217;m going to start with <a href="http://clojure.org/">Clojure</a>.  </p>
<p>Well, to all the students, here&#8217;s a big &#8220;Cheers!&#8221; to a good year.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chilly.ca/?feed=rss2&amp;p=281</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How I always mess up Python logging</title>
		<link>http://blog.chilly.ca/?p=277</link>
		<comments>http://blog.chilly.ca/?p=277#comments</comments>
		<pubDate>Wed, 19 Aug 2009 20:20:08 +0000</pubDate>
		<dc:creator>Tony Arkles</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blog.chilly.ca/?p=277</guid>
		<description><![CDATA[Almost every time I try to use the logging module in Python, I end up mucking it up and then needing to refer to the documentation.
Here&#8217;s what a typical script looks like:

import logging
logging.info&#40;&#34;Hello world&#34;&#41;

Of course, when you run this, you get no output.  You need to make a call to logging.basicConfig() first:

import logging
logging.basicConfig&#40;level=logging.INFO&#41;
logging.info&#40;&#34;Hello world&#34;&#41;

This [...]]]></description>
			<content:encoded><![CDATA[<p>Almost every time I try to use the <em>logging</em> module in Python, I end up mucking it up and then needing to refer to the documentation.</p>
<p>Here&#8217;s what a typical script looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="python python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">logging</span>
<span style="color: #dc143c;">logging</span>.<span style="color: black;">info</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Hello world&quot;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Of course, when you run this, you get no output.  You need to make a call to <em>logging.basicConfig()</em> first:</p>

<div class="wp_syntax"><div class="code"><pre class="python python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">logging</span>
<span style="color: #dc143c;">logging</span>.<span style="color: black;">basicConfig</span><span style="color: black;">&#40;</span>level=<span style="color: #dc143c;">logging</span>.<span style="color: black;">INFO</span><span style="color: black;">&#41;</span>
<span style="color: #dc143c;">logging</span>.<span style="color: black;">info</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Hello world&quot;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>This time, I do actually get some output:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">INFO:root:Hello world</pre></div></div>

<p>This is ugly though.  The second thing I always forget is that you need to pass the <em>format</em> parameter to it.  All together:</p>

<div class="wp_syntax"><div class="code"><pre class="python python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">logging</span>
<span style="color: #dc143c;">logging</span>.<span style="color: black;">basicConfig</span><span style="color: black;">&#40;</span>level=<span style="color: #dc143c;">logging</span>.<span style="color: black;">INFO</span>,
                    format=<span style="color: #483d8b;">&quot;%(asctime)s - %(levelname)s - %(message)s&quot;</span><span style="color: black;">&#41;</span>
<span style="color: #dc143c;">logging</span>.<span style="color: black;">info</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Hello world&quot;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>This finally produces some nice output:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">2009-08-19 14:18:37,161 - INFO - Hello world</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.chilly.ca/?feed=rss2&amp;p=277</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use a &#8220;guard&#8221; to simplify your code structure</title>
		<link>http://blog.chilly.ca/?p=273</link>
		<comments>http://blog.chilly.ca/?p=273#comments</comments>
		<pubDate>Thu, 30 Jul 2009 19:18:01 +0000</pubDate>
		<dc:creator>Tony Arkles</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cleancode]]></category>
		<category><![CDATA[grow]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blog.chilly.ca/?p=273</guid>
		<description><![CDATA[Heavily nested code is one of my bigger pet peeves.  I&#8217;ve found that the more nesting there is in a block of code, the more likely it is that it&#8217;ll be confusing to follow.  Here&#8217;s an example:

def something&#40;request&#41;:
    if condition_a and condition_b and condition_c:
       [...]]]></description>
			<content:encoded><![CDATA[<p>Heavily nested code is one of my bigger pet peeves.  I&#8217;ve found that the more nesting there is in a block of code, the more likely it is that it&#8217;ll be confusing to follow.  Here&#8217;s an example:</p>

<div class="wp_syntax"><div class="code"><pre class="python python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> something<span style="color: black;">&#40;</span>request<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> condition_a <span style="color: #ff7700;font-weight:bold;">and</span> condition_b <span style="color: #ff7700;font-weight:bold;">and</span> condition_c:
        lots
        more
        and_even_more
        etc
        <span style="color: #ff7700;font-weight:bold;">if</span> something_else:
            etc
            etc
            etc
        etc
        etc of <span style="color: #dc143c;">code</span> here
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">True</span>
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">False</span></pre></div></div>

<p>The &#8220;return False&#8221; is pretty far-removed from the set of conditions that will cause it to execute.  An easy way to restructure this code (while still having the exact same functionality) would be to use the set of conditions as a guard:</p>

<div class="wp_syntax"><div class="code"><pre class="python python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> something<span style="color: black;">&#40;</span>request<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: black;">&#40;</span>condition_a <span style="color: #ff7700;font-weight:bold;">and</span> condition_b <span style="color: #ff7700;font-weight:bold;">and</span> condition_c<span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">False</span>
&nbsp;
    lots
    more
    and_even_more
    etc
    <span style="color: #ff7700;font-weight:bold;">if</span> something_else:
        etc
        etc
        etc
    etc
    etc of <span style="color: #dc143c;">code</span> here
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">True</span></pre></div></div>

<p><i>Preemptive comment: I&#8217;m fully aware that some people feel very strongly about only having &#8220;single return point&#8221; for a function.  I disagree.  I&#8217;d rather minimize the number of return statements from a function, but in this case I think it adds clarity.</i></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chilly.ca/?feed=rss2&amp;p=273</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Language-a-month: Idea</title>
		<link>http://blog.chilly.ca/?p=269</link>
		<comments>http://blog.chilly.ca/?p=269#comments</comments>
		<pubDate>Tue, 21 Jul 2009 12:42:15 +0000</pubDate>
		<dc:creator>Tony Arkles</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[grow]]></category>
		<category><![CDATA[programminglanguages]]></category>

		<guid isPermaLink="false">http://blog.chilly.ca/?p=269</guid>
		<description><![CDATA[I&#8217;ve been thinking that over the last few years, I&#8217;ve become a bit of a Python snob.  Python is the hammer that I use to drive (almost) all of the nails I see.  I think it&#8217;s time to branch out a bit.  
Starting in September (coincidentally, the same time I start school), [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been thinking that over the last few years, I&#8217;ve become a bit of a Python snob.  Python is the hammer that I use to drive (almost) all of the nails I see.  I think it&#8217;s time to branch out a bit.  </p>
<p>Starting in September (coincidentally, the same time I start school), I&#8217;d like to learn a different programming language each month, to the point where I can comfortably write a blog post about it.  I don&#8217;t plan on learning it in huge depth, but sufficiently that I could write a reasonable simple app.  In particular, I want to focus on the pieces that make the language special.</p>
<p>I want to have some significant breadth in this.  Some classics, some contemporary, some obscure, some mainstream.  Off the top of my head, here are some possibilities:</p>
<ul>
<li>Lisp (DrScheme maybe?  or ELisp?)</li>
<li>Forth</li>
<li>Ruby</li>
<li>Clojure? (Is this similar enough to Lisp/Scheme that it&#8217;s not necessary?)</li>
<li>Haskell (I missed CMPT 340 going through my B.Sc.)</li>
<li>Fortran</li>
<li>Erlang (this is cheating a bit&#8230; I&#8217;ve done Erlang in the past, but I just want an excuse to go through the Erlang book in more detail)</li>
<li>R</li>
<li>XUL/JS (for Firefox plugins)</li>
<li>Lua</li>
</ul>
<p>I&#8217;m going to have to think about some more.  Anyone have any recommendations?  Maybe for entire classes of languages that I might have missed?</p>
<p>[Edit: added XUL/JS, July 21, 2009 @ 7:55AM.]<br />
[Edit: added Lua, July 21, 2009 @ 9:25AM.]</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chilly.ca/?feed=rss2&amp;p=269</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Evil Python #1: Accessing the caller&#8217;s variables</title>
		<link>http://blog.chilly.ca/?p=265</link>
		<comments>http://blog.chilly.ca/?p=265#comments</comments>
		<pubDate>Thu, 16 Jul 2009 20:27:49 +0000</pubDate>
		<dc:creator>Tony Arkles</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[grow]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[scary]]></category>

		<guid isPermaLink="false">http://blog.chilly.ca/?p=265</guid>
		<description><![CDATA[There&#8217;s some pretty nasty* things you can do with Python, if you really try.  Here&#8217;s one that I came across today on the testing-in-python list.  Turns out you can programmatically access the call stack.  Here&#8217;s an example:

&#62;&#62;&#62; def foo&#40;&#41;:
...   name = &#34;Kevin&#34;
...   bar&#40;&#41;
... 
&#62;&#62;&#62; foo&#40;&#41;
Hello, Kevin

You have to [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s some pretty nasty* things you can do with Python, if you really try.  Here&#8217;s one that I came across today on the <a href="http://lists.idyll.org/pipermail/testing-in-python/2009-July/002059.html">testing-in-python list</a>.  Turns out you can programmatically access the call stack.  Here&#8217;s an example:</p>

<div class="wp_syntax"><div class="code"><pre class="python python" style="font-family:monospace;"><span style="color: #66cc66;">&gt;&gt;&gt;</span> <span style="color: #ff7700;font-weight:bold;">def</span> foo<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
...   <span style="color: black;">name</span> = <span style="color: #483d8b;">&quot;Kevin&quot;</span>
...   <span style="color: black;">bar</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
... 
<span style="color: #66cc66;">&gt;&gt;&gt;</span> foo<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
Hello, Kevin</pre></div></div>

<p>You have to ask what kind of evil person would write such an unmaintainable piece of code.  I found it sufficiently fascinating though, that I figured I&#8217;d share.  If you ever decide to use something like this in production&#8230; well, I&#8217;ll leave that to you and your conscience.</p>

<div class="wp_syntax"><div class="code"><pre class="python python" style="font-family:monospace;"><span style="color: #66cc66;">&gt;&gt;&gt;</span> <span style="color: #ff7700;font-weight:bold;">def</span> bar<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
...   <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Hello,&quot;</span>, <span style="color: #dc143c;">sys</span>._getframe<span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>.<span style="color: black;">f_locals</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'name'</span><span style="color: black;">&#93;</span></pre></div></div>

<p><em>* nasty: unmaintainable, confusing, unobvious.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chilly.ca/?feed=rss2&amp;p=265</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A Fantastic Testing Resource (Thanks Misko Hevery)</title>
		<link>http://blog.chilly.ca/?p=260</link>
		<comments>http://blog.chilly.ca/?p=260#comments</comments>
		<pubDate>Fri, 01 May 2009 01:39:14 +0000</pubDate>
		<dc:creator>Tony Arkles</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[grow]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://blog.chilly.ca/?p=260</guid>
		<description><![CDATA[On Miško Hevery&#8217;s blog, there is a pair of fantastic resources:

Guide: Writing Testable Code
PDF version

This document is such a fantastic, succinct explanation of how to write code that will be easy to work with (and test!).
[I try not to make too many posts that only consist of links, but this is so good that I [...]]]></description>
			<content:encoded><![CDATA[<p>On <a href="http://misko.hevery.com">Miško Hevery&#8217;s</a> blog, there is a pair of fantastic resources:</p>
<ul>
<li><a href="http://misko.hevery.com/code-reviewers-guide/">Guide: Writing Testable Code</a></li>
<li><a href="http://misko.hevery.com/attachments/Guide-Writing%20Testable%20Code.pdf">PDF version</a></li>
</ul>
<p>This document is such a fantastic, succinct explanation of how to write code that will be easy to work with (and test!).</p>
<p><em>[I try not to make too many posts that only consist of links, but this is so good that I couldn't help myself.]</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chilly.ca/?feed=rss2&amp;p=260</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
