<?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>while coding &#187; humane</title>
	<atom:link href="http://www.youell.com/matt/writing/?cat=15&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.youell.com/matt/writing</link>
	<description>simplify</description>
	<lastBuildDate>Wed, 31 Oct 2018 04:08:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>A Simple Rewrite (How I Code)</title>
		<link>http://www.youell.com/matt/writing/?p=84</link>
		<comments>http://www.youell.com/matt/writing/?p=84#comments</comments>
		<pubDate>Mon, 20 Feb 2012 02:58:05 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[How I Code]]></category>
		<category><![CDATA[humane]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.youell.com/matt/writing/?p=84</guid>
		<description><![CDATA[Note: I just found this unpublished post from a couple of years ago. I think I wanted to polish it a bit before publishing, but it looks fine to me now.

I&#8217;m taking another shot at the &#8220;How I Code&#8221; series of posts. This isn&#8217;t a preachy &#8220;How everyone should code&#8221; post. Instead, this is a [...]]]></description>
			<content:encoded><![CDATA[<p><em>Note: I just found this unpublished post from a couple of years ago. I think I wanted to polish it a bit before publishing, but it looks fine to me now.<br />
</em><br />
I&#8217;m taking another shot at the &#8220;How I Code&#8221; series of posts. This isn&#8217;t a preachy &#8220;How everyone should code&#8221; post. Instead, this is a snapshot of how I look at code now, at this point in time. Next week I could be doing things differently. </p>
<p>Here&#8217;s an example from Satchmo, the web shopping cart software that is built on the Django framework. A bug involving MySQL was recently patched in the Satchmo code base. The bug fix itself isn&#8217;t very interesting, but the remaining code is. Here&#8217;s the post-fix code:</p>
<pre class="syntax-highlight:python">
def payments_completed(self):
    q = self.payments.exclude(transaction_id__isnull = False, transaction_id = &quot;PENDING&quot;)
    result = [p for p in q if p.amount]
    return result
</pre>
<p>Naturally, I have questions.</p>
<p>Why does the &#8216;result&#8217; variable exist? </p>
<pre class="syntax-highlight:python">
def payments_completed(self):
    q = self.payments.exclude(transaction_id__isnull = False, transaction_id = &quot;PENDING&quot;)
    return [p for p in q if p.amount]
</pre>
<p>What are &#8216;p&#8217; and &#8216;q&#8217;?</p>
<pre class="syntax-highlight:python">
def payments_completed(self):
    query_set = self.payments.exclude(transaction_id__isnull = False, transaction_id = &quot;PENDING&quot;)
    return [payment for payment in query_set if payment.amount]
</pre>
<p>Would a non-programmer understand this?</p>
<pre class="syntax-highlight:python">
def payments_completed(self):
    payments = self.payments.exclude(transaction_id__isnull = False, transaction_id = &quot;PENDING&quot;)
    return [payment for payment in payments if payment.amount]
</pre>
<p>Don&#8217;t we already have a &#8216;payments&#8217; variable?</p>
<pre class="syntax-highlight:python">
def payments_completed(self):
	return self.payments.exclude(transaction_id__isnull = False, transaction_id = &quot;PENDING&quot;, amount__isnull = false)
</pre>
<p>I think that&#8217;s better. What do you think?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.youell.com/matt/writing/?feed=rss2&amp;p=84</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An Inconvenient Fat</title>
		<link>http://www.youell.com/matt/writing/?p=219</link>
		<comments>http://www.youell.com/matt/writing/?p=219#comments</comments>
		<pubDate>Tue, 24 Feb 2009 12:24:38 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[culture]]></category>
		<category><![CDATA[health]]></category>
		<category><![CDATA[humane]]></category>
		<category><![CDATA[not good enough]]></category>
		<category><![CDATA[rants]]></category>

		<guid isPermaLink="false">http://www.youell.com/matt/writing/?p=219</guid>
		<description><![CDATA[Disclaimer: I am not a medical doctor, nutritionist, herbalist, doula, or massage therapist. I am just some guy with a blog. Consult your own medical professional and/or megacorporate lobbyist before determining what is right for you, your heart, and your arteries.
Few topics irk me more than trans fats. Trans fats (specifically artificial trans fats which [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>Disclaimer: I am not a medical doctor, nutritionist, herbalist, doula, or massage therapist. I am just some guy with a blog. Consult your own medical professional and/or megacorporate lobbyist before determining what is right for you, your heart, and your arteries.</p></blockquote>
<p>Few topics irk me more than <a href="http://en.wikipedia.org/wiki/Trans_fat">trans fats</a>. Trans fats (specifically <em>artificial</em> trans fats which are my focus in this post) are what give tasty junk food an incredible shelf life. Chances are good that if you eat fattening prepackaged foods with creaminess or super smooth texture, you&#8217;re enjoying the wonders of trans fats. Many commercially fried foods, like chicken and donuts also contain trans fats.</p>
<h3>What&#8217;s Wrong With Trans Fats?</h3>
<p>There are an overwhelming number of things to worry about in my diet every day. There&#8217;s <a href="http://en.wikipedia.org/wiki/High_fructose_corn_syrup">high fructose corn syrup</a> (HFCS) in just about everything these days. There&#8217;s even <a href="http://www.epa.gov/waterscience/fish/advice/">mercury in fish</a>. What the hell am I supposed to eat?</p>
<p>Grocery shopping in our household is difficult. We&#8217;ve had to make compromises from time to time. There are several things we don&#8217;t eat. HFCS is one we absolutely avoid. We&#8217;re less radical about other ingredients, but still shy away from prepared foods with nitrates or soy-based ingredients. If you are in the habit of looking at the ingredients while shopping, you can imagine how many items we put back on the shelf.</p>
<p>Trans fats have a special place on our no-fly list though. Unlike many other troubling ingredients in foods, trans fats accumulate in the body. For example, if I eat something with HFCS I may have a crazy sugar high but then I&#8217;m done. The HFCS is metabolized and will leave my body. (Or turn into fat on my ass, whichever.) Trans fats, however, have a hard time leaving the bloodstream and even worse, trans fat molecules like to wedge into arterial walls, contributing to <a href="http://www.nhlbi.nih.gov/health/dci/Diseases/Cad/CAD_WhatIs.html">coronary heart disease</a>.</p>
<p>This is very frustrating to me. From the time I had my own money to spend as a kid up until a few years ago, not a day passed where I wasn&#8217;t pounding trans fat crap into my pie-hole. Which means that not only was I eating poorly and packing on the pounds, I was doing direct, permanent harm to my arteries and my heart!</p>
<h3>How to Spot a Trans Fat</h3>
<p><img class="alignnone size-full wp-image-232" title="transfat" src="http://www.youell.com/matt/writing/wp-content/uploads/2009/02/transfat.gif" alt="transfat" width="288" height="154" align="center" /></p>
<p>Trans fats are delivered primarily in hydrogenated oils. Most often you&#8217;ll see the ingredient listed as &#8220;partially hydrogenated vegetable oil&#8221;, although sometimes the particular variety of oil will differ (palm, sunflower, canola, etc.). A few years back the FDA added a separate line item on the Nutrition Facts panel for trans fats. So now if you want to know if a product has trans fats you can just look at the Nutrition Facts and it will tell you. Well, sort of. See, there&#8217;s a catch.</p>
<h3>The FDA Gets Metaphysical</h3>
<p>Unfortunately the Nutrition Facts doesn&#8217;t tell the whole story. While it is true that trans fats have their own line item in the Nutrition Facts panel, it doesn&#8217;t tell the entire truth. I don&#8217;t know the full story, so I&#8217;ll try not to be judgmental of the FDA (see my disclaimer above). What I know is that the food industry was rightly concerned that no one would buy products with trans fats in them. Also, they were having a hard time eliminating trans fats from their products while retaining product consistency and shelf life. So the FDA made a compromise. Food manufacturers can claim that their food has &#8220;0g trans fats per serving&#8221; if the food has less than 0.5g of trans fats per serving. I think the FDA sees this as just a matter of rounding numbers down. As a numerate consumer it means zero != 0. Which is more than a little confusing.</p>
<p>Products can now proclaim &#8220;zero trans fats!&#8221; on the package, and what they actually mean is that their product has less than 0.5g of trans fats per serving. I&#8217;ve had several conversations over the past few years with people who tell me I&#8217;m crazy for not eating a product because the package clearly says &#8220;no trans fats&#8221;. When I point at the partially hydrogenated oil in the ingredients I just get a blank stare.</p>
<p><strong>SOYLENT GREEN IS TRANS FATS!!</strong></p>
<p style="text-align: center;"><img class="size-medium wp-image-236 aligncenter" title="soylent-green" src="http://www.youell.com/matt/writing/wp-content/uploads/2009/02/soylent-green-237x300.jpg" alt="soylent-green" width="237" height="300" /></p>
<p>Can you imagine if the FDA had an equivalent rule for ingredients that caused allergies?</p>
<blockquote><p>&#8220;0g wheat gluten!&#8221;<br />
&#8220;no peanuts&#8221;</p>
<p>&#8220;I can&#8217;t imagine why I had an allergic reaction to these chips. They said no peanuts!&#8221;.</p>
<p>&#8220;Ah, that&#8217;s no peanuts *per serving*, sir!&#8221;</p></blockquote>
<h3>Where Is the Point of Diminishing Returns?</h3>
<p>Certainly there are safe or near-safe levels of consumption for just about any bad thing. What is the safe level for trans fats? I don&#8217;t think it is 0.5g per serving. That&#8217;s just a hunch. Again, I refer you to my disclaimer above.</p>
<p>The real problem with the FDA rules for labeling is that we don&#8217;t get to find out how much trans fat is in any given product that claims to be &#8220;trans fat free&#8221;. All we are allowed to know is that the quantity is under 0.5g per serving. So it could be 0.4999g or it could be 0.0001g per serving. There is no way for the consumer to know.</p>
<h3>My Wife Thinks I&#8217;m Crazy</h3>
<p>And you may think I&#8217;m a bit crazy also. But I&#8217;m not alone. The country of <a href="http://www.msnbc.msn.com/id/15307763">Denmark</a> is crazy too. Denmark outlawed trans fats 5 years ago. Switzerland is apparently also crazy, since they followed Denmark&#8217;s lead. And now local governments around the US are starting to ban foods with trans fats. So I may be crazy, but the crazy is spreading.</p>
<h3>Let&#8217;s Zero In on the Problem</h3>
<p>In a perfect world we wouldn&#8217;t be forced to ferret out fake food from our diet. Since we have to live with fake food for now, it would be nice if we could have a system where the exact amount of artificial trans fats per serving could be stated. It would also be nice if the &#8220;zero&#8221; was returned to it&#8217;s rightful state of literally meaning &#8220;none&#8221; instead of &#8220;a little bit&#8221;. At the very least we should make food manufacturers declare &#8220;very low trans fats&#8221; instead of &#8220;zero trans fats&#8221;. Specific numbers about trans fat content would be nice too. Then we would be on the right track.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.youell.com/matt/writing/?feed=rss2&amp;p=219</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finally, someone says it</title>
		<link>http://www.youell.com/matt/writing/?p=131</link>
		<comments>http://www.youell.com/matt/writing/?p=131#comments</comments>
		<pubDate>Thu, 22 Jan 2009 13:44:29 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[How I Code]]></category>
		<category><![CDATA[humane]]></category>
		<category><![CDATA[not good enough]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[software industry]]></category>

		<guid isPermaLink="false">http://www.youell.com/matt/writing/?p=131</guid>
		<description><![CDATA[Null references are a bad idea. When I try to say things like this, people blow me off. I suppose that is understandable. I&#8217;m just another opinionated programmer, never mind the bruises and scars. 
I think it&#8217;s a little harder to blow off C.A.R. Hoare. Thanks Tony!
]]></description>
			<content:encoded><![CDATA[<p><a href="http://qconlondon.com/london-2009/presentation/Null+References:+The+Billion+Dollar+Mistake">Null references are a bad idea</a>. When I try to say things like this, people blow me off. I suppose that is understandable. I&#8217;m just another opinionated programmer, never mind the bruises and scars. </p>
<p>I think it&#8217;s a little harder to blow off <a href="http://en.wikipedia.org/wiki/C._A._R._Hoare">C.A.R. Hoare</a>. Thanks Tony!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.youell.com/matt/writing/?feed=rss2&amp;p=131</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Heads and Tails in Functional Programming</title>
		<link>http://www.youell.com/matt/writing/?p=101</link>
		<comments>http://www.youell.com/matt/writing/?p=101#comments</comments>
		<pubDate>Mon, 05 Jan 2009 09:48:16 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[functional programming]]></category>
		<category><![CDATA[humane]]></category>
		<category><![CDATA[programming languages]]></category>

		<guid isPermaLink="false">http://www.youell.com/matt/writing/?p=101</guid>
		<description><![CDATA[The other night I went to the first meeting of the PDX SICP Study Group down the road in The Beave. It was nice to finally be minutes away from a programmers meeting! (I live in the boonies.) I&#8217;m sure all future meetings will be on the east side now that I&#8217;ve said that. 
I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>The other night I went to the first meeting of the <a href="http://groups.google.com/group/pdx-sicp-studygroup/">PDX SICP Study Group</a> down the road in <a href="http://en.wikipedia.org/wiki/Beaverton,_Oregon">The Beave</a>. It was nice to finally be minutes away from a programmers meeting! (I live in the boonies.) I&#8217;m sure all future meetings will be on the east side now that I&#8217;ve said that. </p>
<p>I&#8217;m still a functional programming n00b. Which is funny to think about, because I probably know more about FP at this point than I knew about OOP many years ago when I was a junior programmer and considered myself something of an OO expert.</p>
<p>FP newbie or not, I&#8217;m still an experienced programmer with my own aesthetic sense of what qualifies as good code. One of the things that has always annoyed me about LISPs is their antiquated use of <code>car</code> and <code>cdr</code> as function names. Certainly once you&#8217;ve seen them enough you know exactly what they are and what they do. But as far as skimming code goes, they are awful. They aren&#8217;t clear or intuitive to new or casual readers. Even pronouncing <code>cdr</code> annoys me. (I want it to be &#8216;cedar&#8217;.  Instead it is &#8216;could-er&#8217; which sounds like a character from the Dukes of Hazzard.) I feel compelled to wrap them in my own functions just to make friendlier names like &#8216;first&#8217; and &#8216;rest&#8217;, or &#8216;head&#8217; and &#8216;tail&#8217;.</p>
<p>Other languages do use the head and tail metaphor directly. Erlang, which I enjoy programming with quite a bit, has an idiom where the head and tail metaphor shows up in the naming convention but not directly in syntax or function names. Instead of extracting the first item in a list with car and the rest of the items with cdr, you unpack the list with a pattern:</p>
<pre class="syntax-highlight:c">
Eshell V5.5.5  (abort with ^G)
1&gt; [H|T]=[1, 2, 3].
[1,2,3]
2&gt; H.
1
3&gt; T.
[2,3]
</pre>
<p>(Btw, Erlang&#8217;s pattern matching is far more powerful than I&#8217;m letting on here, and it makes this simple head/tail stuff look like child&#8217;s play.)</p>
<p>By convention it is understood that H stands for Head, and T for Tail.  And that&#8217;s fine, but what this idiom often means is that you end up declaring two or three variables for what essentially are views on a list. For example, during the SICP study group we solved a &#8220;change making&#8221; <a href="http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-11.html#%_sec_1.2.2">problem from Ch. 1</a>. Here&#8217;s the code I wrote in Erlang. I opted to replace H and T with domain-specific names:</p>
<pre class="syntax-highlight:c">
-module(change3).
-export([find_variations/2]).
-export([count_change/1]).

find_variations(0, _) -&gt; 1;		% No amount given.
find_variations(_, []) -&gt; 0;	% No coins given.
find_variations(Amount, _) 		% Amount is impossible.
	when Amount &lt; 0 -&gt; 0;

find_variations(Amount, [Coin|Rest]=Coins) -&gt;
	find_variations(Amount, Rest) + find_variations( (Amount - Coin),  Coins).

count_change(Amount) -&gt;
		find_variations(Amount, [50, 25, 10, 5, 1]).
</pre>
<p>The spot of interest here is the <code>find_variations</code> method matching <code>[Coin|Rest]=Coins</code>. This creates 3 variables which are, respectively, the first item from the list, the remaining list, and the original list itself. All of which get used in the function.</p>
<p>While I *looooove* the pattern matching in Erlang which allows these fairly clear variables to exist, I wonder if there might be a symbolic way to decorate the list variable to yield a particular view instead of requiring three separate variables to deal with. I came up with a few ideas, but I&#8217;m not sure I like any of these. Feedback is appreciated.</p>
<p><strong>Idea 1 &#8211; Graphically show head and tail</strong></p>
<p>Head:  <code><< List</code><br />
Tail: <code>List <<</code></p>
<p><strong>Idea 2 - Borrow from Regex Anchors</strong></p>
<p>Head:  <code>^List</code><br />
Tail: <code>List$</code></p>
<p><strong>Idea 3 - Misappropriate Perl's sigils</strong></p>
<p>Head: <code>$List</code>  (since the head is basically a scalar)<br />
Tail: <code>@List </code> (since the tail is a list)</p>
<p>All of these suck in their own way, but I think I like Idea #3 the best because it gives you the opportunity to treat a list in reverse without having to reverse it first:</p>
<p>Last item in list: <code>List$</code><br />
All items in list except last: <code>List@</code></p>
<p>If Erlang had a syntax like this (and thank god it doesn't), here's what that earlier function would look like, rewritten using syntax #3:</p>
<pre class="syntax-highlight:c">
find_variations(Amount, Coins) -&gt;
	find_variations(Amount, @Coins) + find_variations( (Amount - $Coins),  Coins).
</pre>
<p>I'd like to know what others think about this.</p>
<p>In closing, I'd like to note that Python, my day-to-day language, already has this flexibility using list slices:</p>
<pre class="syntax-highlight:python">
def find_variations(amount, coins):
	return find_variations(amount, coins[1:]) + find_variations( (amount - coins[0]),  coins)
</pre>
<p>Unfortunately, Python is designed to discourage recursion so this is sort of misleading. You wouldn't write a real solution this way in Python.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.youell.com/matt/writing/?feed=rss2&amp;p=101</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>I Don&#8217;t Use Bookmarks</title>
		<link>http://www.youell.com/matt/writing/?p=30</link>
		<comments>http://www.youell.com/matt/writing/?p=30#comments</comments>
		<pubDate>Mon, 24 Nov 2008 22:27:48 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[humane]]></category>
		<category><![CDATA[problem solving]]></category>

		<guid isPermaLink="false">http://www.youell.com/matt/writing/?p=30</guid>
		<description><![CDATA[I don&#8217;t believe in bookmarking things. I used to bookmark websites in my browser like crazy. Then one day I realized that I was never using those bookmarks. Even worse was the realization that with my bookmarks I was building a private index of the Internet. And there was already this really good index out [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t believe in bookmarking things. I used to bookmark websites in my browser like crazy. Then one day I realized that I was never using those bookmarks. Even worse was the realization that with my bookmarks I was building a private index of the Internet. And there was already this really good index out there called Google&#8230; So I stopped bookmarking. My life became much simpler. My collection of bookmarks dropped to almost zero.</p>
<p>Instead of digging through bookmarks (which I wasn&#8217;t doing anyway) I&#8217;d google for a term that I remembered had given me the results I wanted in the past. If that sounds like more work than using bookmarks, let me assure you that it isn&#8217;t. Once you collect a non-trivial number of bookmarks you have to categorize them and remember that hierarchy. Which is directly equivalent to just remembering what you typed in. If you think of your bookmark category and bookmark name as a key to lookup your desired results, then you can think of your search term in the same way. And generally your search term is easier to remember. In fact, you don&#8217;t even have to remember it: For whatever reason, when I find myself googling for a piece of information I invariably type in the same query or nearly the same query that I typed in last time. Even if months or years have transpired. When your &#8220;key&#8221; is so directly and humanely tied to what you want it works so much better.</p>
<p>My google-not-bookmarks strategy has served me well for about 6 or 7 years. Lately though, I&#8217;ve noticed that Google results have begun to fluctuate dramatically from day to day depending on the topic and the query I provide. So while my search terms haven&#8217;t changed much, the results have changed. Lucky for me that my browser remembers (and highlights) which links I&#8217;ve already visited, otherwise this system may have broken down for me a long time ago.</p>
<p>I don&#8217;t think anything crazy has happened at Google. Instead, the things I tend to repeatedly search for are in a narrow niche of geekdom. I&#8217;m sure this has been a problem for a long time for people who regularly google more popular topics. Only as the size of the Internet has increased &#8211; and therefore the size of the searchable content &#8211; has my neck of the woods finally been impacted.</p>
<p>To some extent this constant change is a good thing. Google offers a hybrid of fresh content and relevant results. So you can watch a topic for changes. You can even google yourself. In fact the how-to-blog crowd widely recommends that you google yourself often to see what people are saying about you online. (They don&#8217;t mention how unsatisfying that act is when no one knows who the hell you are and therefore no one is talking about you. Still, were someone to talk about me, Google would tell me all about it.)</p>
<p>On the other hand, I&#8217;m losing my auxiliary brain a little bit more every day. For instance, I sometimes have trouble remembering how to make a tarball. I don&#8217;t like the two-step process where you make a tar file then you compress it. Instead, I like a nice clean one-liner. Modern <em>tar</em> provides a compression option and will kick out a tidy *.tgz file for you. If only you know the magic command-line options and parameter sequence to get it to do that. Sadly, I never remember. So this is something I google for fairly often. Just in the past week I&#8217;ve had to google for this twice. And I know I googled for it a month or two back. And each time found markedly different results. I don&#8217;t even know where the site I found a few months ago is, but it isn&#8217;t in my search results anymore. At least not on that first page. Sadly, that site from a few months ago had the best instructions for making a tarball.</p>
<p>I guess I should have bookmarked it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.youell.com/matt/writing/?feed=rss2&amp;p=30</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trailer Park Software</title>
		<link>http://www.youell.com/matt/writing/?p=24</link>
		<comments>http://www.youell.com/matt/writing/?p=24#comments</comments>
		<pubDate>Wed, 03 Sep 2008 18:07:54 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[humane]]></category>
		<category><![CDATA[not good enough]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[rants]]></category>

		<guid isPermaLink="false">http://www.youell.com/matt/writing/?p=24</guid>
		<description><![CDATA[It takes money to make money. Right? Isn&#8217;t that the saying? Everyone seems to know it.
Everyone except the Business Journal. It&#8217;s bad enough they have an ugly site design (clean yes, but poorly organized, uninspired, and dull), but they also apparently have some kind of Soviet-era site management software on the backend. Just to make [...]]]></description>
			<content:encoded><![CDATA[<p>It takes money to make money. Right? Isn&#8217;t that the saying? Everyone seems to know it.</p>
<p>Everyone except the <a href="http://www.bizjournals.com/">Business Journal</a>. It&#8217;s bad enough they have an ugly site design (clean yes, but poorly organized, uninspired, and dull), but they also apparently have some kind of Soviet-era site management software on the backend. Just to make changes to your website account you end up digging around in long screens packed with demographic questions. Not fun. I usually stay away.</p>
<p>This morning they sent an email invitation to join their new &#8220;social network&#8221;. Because we NEED the fucking <a href="http://networking.bizjournals.com/community/app/nf/vistafs.aspx">Business Journal&#8217;s social network</a>! Life just isn&#8217;t complete without it. Heaven forbid they just piggyback on <a href="http://www.facebook.com">Facebook</a> or do something innovative like a <a href="http://reddit.oregonlive.com/">custom Reddit</a>. But I digress.</p>
<p><a href="http://networking.bizjournals.com/community/app/nf/vistafs.aspx">This thing</a> is a mess. You get in there and you have no idea what is going on. As a developer, I can see what is happening. They are handcuffed by the software that controls their site. That software wasn&#8217;t created with a social network in mind. Far from it. So to compensate they have to hang new functionality off the side of the site, so to speak. Kind of like the guy in the trailer park who puts an &#8220;addition&#8221; on his house by connecting a smaller trailer to his big trailer with some sheet metal, green fiberglass shingles, and (of course) duct tape.</p>
<p>This is more than a look-and-feel thing though. By trying to squirm around their handcuffs, they&#8217;ve had to split up where your user information is. Some of it is in your Account Settings, and some of it is in your &#8220;Dashboard&#8221;. (Protip: software isn&#8217;t <a href="http://blueballfixed.ytmnd.com/">enterprisey</a> enough unless you call it a dashboard.) That might sound like nitpicking, but it isn&#8217;t. If you look at every single one of the &#8220;newest members&#8221; on the site, you&#8217;ll see a shadow icon in place of where their profile photo (aka mugshot) should be. Except for me. As far as I can tell I&#8217;m the only user with a mugshot because I&#8217;m the only dumb bastard stubborn enough to dig around in the site for 15 minutes to figure out where I can upload my pic. And it&#8217;s not like these users don&#8217;t know how to upload a pic. There&#8217;s a whole photo gallery filled with 8&#215;10 <a href="http://www.glamourshots.com/">Glamour Shots</a> scans that users have uploaded. But no pics on user profiles!</p>
<p>The striking thing about this social networking attempt is how many features they&#8217;ve tried to pack into it without actually adding much value. They clearly put some thought into what they would provide, but not any thought into how it would actually <strong>work</strong> or what <em>true value</em> it would bring to their users. So you can upload some photos or even &#8220;start a blog&#8221; on their site. But you can&#8217;t have a simple URL to your company in your profile or link off to your own blog outside of their site. So it&#8217;s a walled garden. And walled gardens don&#8217;t work so well on the interwebs.</p>
<p>My advice? Begin with a simple goal which will genuinely serve your users. And get some budget before you try to do this shit. Don&#8217;t go in half-assed. Remove all but the most needed new features from the social part of the site. Trim it down so you can build it back up. Add only features that you can prove are valuable. (Hint: Your users will ask for most of them.) Consolidate your information into one place. Every account on the site should have the same type of profile options available to them (mugshot, url, etc.). And consolidate the information in your database too! I can tell that you keep the same pieces of information in several different databases. That&#8217;s crazy.</p>
<p>And if your website management or CMS software won&#8217;t let you do these things, throw it out and write your own. You&#8217;re obviously already doing some of that. Why not go all the way? It&#8217;s not hard. There are plenty of open source CMS systems out there to get you started, not to mention <a href="http://www.djangoproject.com/">wonderful software  platforms</a> that <a href="http://www.lawrence.com/">other</a> <a href="http://www.washingtonpost.com/">newspapers</a> are already using.</p>
<p>Otherwise, just pack it in. No one needs another annoying/useless &#8220;social&#8221; website that isn&#8217;t bringing its &#8216;A&#8217; game.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.youell.com/matt/writing/?feed=rss2&amp;p=24</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Names Matter (How I Code)</title>
		<link>http://www.youell.com/matt/writing/?p=19</link>
		<comments>http://www.youell.com/matt/writing/?p=19#comments</comments>
		<pubDate>Tue, 05 Aug 2008 00:24:06 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[How I Code]]></category>
		<category><![CDATA[essays]]></category>
		<category><![CDATA[humane]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.youell.com/matt/writing/?p=19</guid>
		<description><![CDATA[I&#8217;ve had this website for about 11 years. I&#8217;ve been aware of blogging, in one form or another for about 8 years. But it wasn&#8217;t until this year that I started blogging. I resisted for many years. There were just so many ass-clowns with blogs. Why be another? Still, when I sit and code there [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had this website for about 11 years. I&#8217;ve been aware of blogging, in one form or another for about 8 years. But it wasn&#8217;t until this year that I started blogging. I resisted for many years. There were just so many ass-clowns with blogs. Why be another? Still, when I sit and code there are often ideas which will come to me and I want to get them out. And yet the topics I&#8217;ve talked about on this site (so far) are technical in topic but not in detail. There&#8217;s a reason for this. It&#8217;s hard to document the mental process you go through when you&#8217;re programming. I tried once this past spring when I was working on a small project with LINQ. But even though I typed out a lot of material, it was very hard to pull together something readable out of it and I eventually gave up. This time I&#8217;m trying a simpler topic and we&#8217;ll see how it goes. The writing is still rough because I wrote it on the spot and backtracked over code I had just written. Hopefully I&#8217;ll figure out how to do this more smoothly in the future because there are ideas and notions, both small and large, which I&#8217;m uncovering every day and would like to share and discuss.</p>
<p align="center">***</p>
<p>I work with several different technologies on a regular basis. Lately I&#8217;ve been working on a .NET Windows app. It&#8217;s one I created originally in 2004 and have been maintaining for a client ever since. I&#8217;ve been adding some new database searching functionality to the app.</p>
<p>To display the search data in the app I have a series of tabs, all of which contain a customized listview. Each listview has a Display() method which takes in a list of things to display. The difference between each list view is the subset of the data shown and how each column is treated. (There are some columns with special handling.)</p>
<p>After a while I notice this pattern where I&#8217;m going to update only the currently visible list view, so I end up with a dispatch table which abstracts away exactly which Display() method I&#8217;m going to call.<br />
I started off with a List for doing dispatch, with each tab&#8217;s index pointing into the table. But that bothered me.</p>
<p>Mainly, I wondered, what would happen if I added or removed tabs in the future? I didn&#8217;t savor the idea of mixed up tabs or a null pointer exception.</p>
<p>At first I thought a hashtable would have the same problem, but that&#8217;s because I was &#8220;complifying&#8221; it, and thinking about using a string for the lookup &#8211; either the tab name or tab text.</p>
<p>Then, &#8220;Duh&#8221;, I thought, &#8220;just use the tab itself as the key&#8221;.</p>
<p>And it really is a duh, because I&#8217;m pretty sure I&#8217;ve gone through this exact same internal dialog many times in the past. Oy.<br />
So eventually I ended up with this:</p>
<pre class="syntax-highlight:csharp">
protected delegate void ListProcessor(List&lt;Item&gt; list);
protected Dictionary&lt;TabPage, ListProcessor&gt; listViews = new Dictionary&lt;TabPage, ListProcessor&gt;();
</pre>
<p>I&#8217;m still not so happy with the delegate since it is almost the signature for map(), and that seems like a smell. Also bugging me is some vague nag about polymorphism which won&#8217;t quite bubble all the way to the top of my brain.<br />
So, anyway, I go on to set up my event handler which captures a tab change. Except there seems to be some kind of retardation here. If you handle TabIndexChanged, that doesn&#8217;t fire if you change the selected tab. You have to handle SelectedIndexChanged instead. Which, in retrospect, makes total sense. But the naming could be a lot better here. I&#8217;m still not entirely sure what TabIndexChanged does, although I suspect it has to do with tab-reordering. Still, <strong>names matter</strong>, and that one naming choice is confusing. Speaking of how names matter, here&#8217;s the handler I created for SelectedIndexChanged:</p>
<pre class="syntax-highlight:csharp">
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
    UpdateCurrentListView();
}
</pre>
<p>I wish VS would let you enter the function name as soon as you break it out. I&#8217;m going to have to rename it anyway, might as well.<br />
Since I&#8217;m calling UpdateCurrentListView() from another place, without the event signature, I can&#8217;t just point to UpdateCurrentListView(),<br />
but I can give it the same name.</p>
<pre class="syntax-highlight:csharp">
private void UpdateCurrentListView(object sender, EventArgs e)
{
    UpdateCurrentListView();
}
</pre>
<p>Better? Worse? I don&#8217;t know. Ok, yes, I do know. Better. Just not WOW better. Anyway, onto the meat and potatoes of what I&#8217;m doing. Here&#8217;s UpdateCurrentListView():</p>
<pre class="syntax-highlight:csharp">
private void UpdateCurrentListView()
{
    listViews[tabControl1.SelectedTab](foundItems);
}
</pre>
<p>It&#8217;s just one line of code, but even though I *just wrote it*, I knew I wasn&#8217;t going to know what it did in about 5 mins. I try really hard<br />
not to let things like that go by. People have to read this stuff, and more often than not those people are me!</p>
<p>The name &#8220;listViews&#8221; made sense for the dispatch table when I was first setting it up and inserting functions into it. Actually *using* it didn&#8217;t make sense at all: &#8220;listViews&#8221; sounds like a *list* of *views*. In reality this is a list of functions.</p>
<p>I also am not a big fan of the automatically generated names VS gives things. It works well enough, but it doesn&#8217;t scale at all. You can only have so many textBox15&#8217;s before you gouge our your eyes and swear you&#8217;ll stop programming forever.</p>
<p>Then there&#8217;s the list of items that will be displayed. That list is shared among all of the views in the containing class. When I originally created it, &#8220;foundItems&#8221; seemed like a friendly name. But down here (at this level in the code) you&#8217;re not thinking in terms of things being found. You want to have a more generic idea of what you&#8217;re dealing with.</p>
<p>Some refactoring gave me:</p>
<pre class="syntax-highlight:csharp">
private void UpdateCurrentListView()
{
    displayOnTab[tabs.SelectedTab](SearchResults);
}
</pre>
<p>I realized that while my dispatch table was technically a list or collection, the way I&#8217;m using it is as a multi-dimensional function. So why not just name it like a function?</p>
<p>So that&#8217;s what I did. Also, I&#8217;m only using one TabControl. Might as well go with a friendly name like &#8220;tabs&#8221;. And SearchResults is generic enough so that I don&#8217;t stop and think about the data but specific enough so I have a mental picture of what is happening in the UI when this code executes.</p>
<p>This reads fairly well, is only moderately redundant, and it has a decent English flavor: there&#8217;s a subject acting with a verb upon an object.</p>
<p>Good times.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.youell.com/matt/writing/?feed=rss2&amp;p=19</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>It&#8217;s OK to make things pretty</title>
		<link>http://www.youell.com/matt/writing/?p=17</link>
		<comments>http://www.youell.com/matt/writing/?p=17#comments</comments>
		<pubDate>Tue, 29 Jul 2008 23:43:22 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[essays]]></category>
		<category><![CDATA[humane]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.youell.com/matt/writing/?p=17</guid>
		<description><![CDATA[I have an announcement to make.
It&#8217;s OK to like pretty things. And you know what else? It&#8217;s OK to make pretty things too.
That&#8217;s right. And not just pretty things others make for you. Not just the candy coated interface you see on your latest OS or on your phone. It&#8217;s OK to make your programs [...]]]></description>
			<content:encoded><![CDATA[<p>I have an announcement to make.</p>
<p>It&#8217;s OK to like pretty things. And you know what else? It&#8217;s OK to make pretty things too.</p>
<p>That&#8217;s right. And not just pretty things others make for you. Not just the candy coated interface you see on your latest OS or on your phone. It&#8217;s OK to make your programs pretty too. It&#8217;s OK to make your docs pretty. It&#8217;s OK to make your website pretty. Pretty pretty pretty.</p>
<p>Aesthetics are important. How you feel about the tools you work with matters. It matters a lot.But making things pretty isn&#8217;t just about aesthetics.</p>
<p>Bear with me here.</p>
<p>Beauty is a form of wealth. And wealth comes in many more forms than we imagine. I&#8217;m not talking tangible wealth &#8211; cars, yachts, bling. I&#8217;m talking about something a little more intangible but still very valuable.</p>
<p>I create wealth all the time when I&#8217;m programming. Again, I&#8217;m not talking about money or the literal value of the code I&#8217;ve written. I&#8217;m talking about the good stuff that just *falls out* while I&#8217;m working. And this isn&#8217;t because I&#8217;m particularly awesome, it just happens. I  think it happens to anyone who works in a creative field.</p>
<p>For instance, say I am writing some code, and I realize that I&#8217;m essentially repeating the same 4 lines of code in several different functions. So I Extract Method and boom, I&#8217;ve created some new wealth which wasn&#8217;t there before. Of course that is more intentional. What I&#8217;m getting at is directly related, but a little different. I&#8217;m talking about a sort of accidental wealth. For instance, say I&#8217;m doing a lot of work with lists. And I realize after a while that I have several places in my program where I am iterating over lists in the same way. So I pull out that code and consolidate it into one spot. Pretty soon I realize that the iteration function I created is handy in a LOT more places. And not just in this one project, but in all of my projects. Pretty soon I&#8217;m coding in a whole new way and I actually start to *think* in a whole new and more powerful way.</p>
<p>I don&#8217;t know what you&#8217;d call this. There&#8217;s probably some huge German word for it which would roughly translate as &#8220;the thing that gets you more things without you seeing it at first&#8221;.</p>
<p>Beauty can work in this same way. For one thing, there is just the simple aesthetic pleasure of working on something pretty. I remember back in the dotcom days I was working on a site that had a pretty UI designed by some skilled graphic designers. I had to start building out the site with placeholder HTML before we had the UI and it was an OK project. Nothing thrilling, kind of ho-hum. But then the designer&#8217;s UI came in and WOW, I suddenly liked working on that project a whole lot more. Of course one of my coworkers was working on an even prettier website, and after a while I really wanted to work on *that* instead, even though I knew that the technology under the hood was awful to work with. Apparently sometimes the grass is always greener, even if the green comes from a spray can. So working on something pretty can definitely improve your attitude about your work, and I would argue that a better attitude improves the quality of your work too.</p>
<p>But that&#8217;s not where all the wealth comes from. It&#8217;s not just the good feeling you get working on it. It&#8217;s the way things play out in your mind. Imagine you&#8217;re building an application and you have some objects that get manipulated. I don&#8217;t know about you, but for me, when I create new objects, especially ones that live in the database, it takes me a while to <em>believe</em> in the thing I&#8217;ve created. Not just believe in whether it will work or not, but to actually think of the thing I&#8217;ve created as <em>real</em>. But when you allow yourself to make things beautiful, to make that a priority on par with functionality and correctness, the things you create become tangible. Icons are a great example of this. Icons &#8211; <em>good icons</em> &#8211; can look great and really add something to your application. I&#8217;m not just talking about the icon for your program, I&#8217;m talking about the icons you pick to represent things within your program.</p>
<p>Think about a personnel database. The typical app that comes to mind is some byzantine Windows app or maybe a clunky web app which dumps out people&#8217;s stats in row after row of icky blandness. Now imagine that instead of row after row of text, there is a thumbnail image of the <em>actual person</em>. And imagine that you can click on that person to get more information about them. Imagine that you can drag that person around by their image. That you can transfer Tricia from Accounting to Distribution Support by literally dragging her from one department to another. Certainly you can do those same things with just text in a list, but it doesn&#8217;t feel the same way. You wouldn&#8217;t see Tricia as a real person. You wouldn&#8217;t *believe* in the idea of Tricia.</p>
<p>And it&#8217;s the same way with any entity in your application. Why should only the user-visible objects in your app have icons? Why should only the user-visible screens look nice? It&#8217;s very common to have programmers build out apps that look great to the customer, but when the programmer needs to get under the hood everything is fugly and lacks imagination.</p>
<p>That&#8217;s not right. That doesn&#8217;t serve anyone. And there are unseen opportunities missed! I&#8217;m not saying to spend all of your time making things pretty. I still stick by my Big 3: Make it Work, Make it Right, Make it Pretty. But making things pretty is definitely allowed and maybe even downright necessary.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.youell.com/matt/writing/?feed=rss2&amp;p=17</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yahoo Doesn&#8217;t Need A Fail Whale</title>
		<link>http://www.youell.com/matt/writing/?p=13</link>
		<comments>http://www.youell.com/matt/writing/?p=13#comments</comments>
		<pubDate>Tue, 15 Jul 2008 02:43:22 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[humane]]></category>
		<category><![CDATA[not good enough]]></category>
		<category><![CDATA[rants]]></category>

		<guid isPermaLink="false">http://www.youell.com/matt/writing/?p=13</guid>
		<description><![CDATA[I haven&#8217;t posted in a while. I&#8217;ve been crazy busy. But it&#8217;s more than that: I don&#8217;t want to post just to hate on people. And every single time I think I have a good thing to write about, it comes out negative. And that has kept me away. But, apparently I can&#8217;t deny what [...]]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t posted in a while. I&#8217;ve been crazy busy. But it&#8217;s more than that: I don&#8217;t want to post just to hate on people. And every single time I think I have a good thing to write about, it comes out negative. And that has kept me away. But, apparently I can&#8217;t deny what I am.</p>
<p>I&#8217;m a hater.</p>
<p>I just can&#8217;t help it.</p>
<p>Maybe it is the heat, I don&#8217;t know. But shit like this just pisses me off, and has for *far too long*:</p>
<p style="text-align: center"><img src="/matt/writing/lib/images/YahooFail.jpg" height="524" width="451" /></p>
<hr />A gentle note to Yahoo:</p>
<p>I DO <strong>NOT</strong> LIVE IN MOTHERFUCKING <strong>FRANCE</strong>!</p>
<p>And dammit, Yahoo, you know this. You&#8217;ve known me forever. Look &#8211; I&#8217;m logged in! Read my profile. Or see that I&#8217;m connected from a well known ISP in the US, with an IP address which simply *does not roam*. And cookies! You&#8217;ve got the cookies.  You can look at those and see every place I&#8217;ve asked about. None of those places is in France, or Mexico, or anywhere else you&#8217;ve asked me about.</p>
<p>I can&#8217;t believe this fail has lasted as long as it has. Why not just go all the way and give me a pulldown list with every country in the world on it. (Be sure to put Afghanistan first on the list and the US way down past Uganda too. Bonus points!)</p>
<p>See how negative I&#8217;m being? Feel the hate? It just seems so wrong.</p>
<p>But man, it *feels* <em>so right</em>.</p>
<p>Still, maybe I should be more compassionate. Maybe Yahoo US is underfunded and just can&#8217;t make it better. Hey! I know: Maybe the guys at Yahoo Japan can make it better. Seems like they have some extra budget over there&#8230;<br />
<center><br />
<object height="344" width="425"><param name="movie" value="http://www.youtube.com/v/-tWwMSM4OZQ&amp;hl=en&amp;fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/-tWwMSM4OZQ&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" height="344" width="425"></embed></object><br />
</center></p>
]]></content:encoded>
			<wfw:commentRss>http://www.youell.com/matt/writing/?feed=rss2&amp;p=13</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
