<?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>500null</title>
	<atom:link href="http://www.500null.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.500null.com</link>
	<description>thine stack overfloweth</description>
	<lastBuildDate>Mon, 01 Mar 2010 21:00:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>New Project: photo&#160;blog</title>
		<link>http://www.500null.com/life/new-project-photo-blog/</link>
		<comments>http://www.500null.com/life/new-project-photo-blog/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 19:13:31 +0000</pubDate>
		<dc:creator>Adam Detrick</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Creativity]]></category>

		<guid isPermaLink="false">http://www.500null.com/?p=64</guid>
		<description><![CDATA[I&#8217;ve started a new photo blog project, &#8220;52 photos&#8220;.
The premise is that I&#8217;m posting somewhat interesting and original photos of Brooklyn and beyond at least once a week (for an indefinite amount of time, but at least 52 weeks).

I&#8217;ve finally decided to create a space to not only showcase random photos I take while I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve started a new photo blog project, &#8220;<a href="http://52photos.tumblr.com">52 photos</a>&#8220;.</p>
<p>The premise is that I&#8217;m posting somewhat interesting and original photos of Brooklyn and beyond at least once a week (for an indefinite amount of time, but <em>at least</em> 52 weeks).</p>
<p><a href="http://52photos.tumblr.com"><div class="wp-caption alignnone" style="width: 510px"><img alt="city of steeples, from 52photos.tumblr.com" src="http://25.media.tumblr.com/tumblr_kym8b8gMWg1qbnu3uo1_500.jpg" title="city of steeples, from 52photos.tumblr.com" width="500" height="375" /><p class="wp-caption-text">city of steeples, from 52photos.tumblr.com</p></div></a></p>
<p>I&#8217;ve finally decided to create a space to not only showcase random photos I take while I&#8217;m out and about, but to give me a reason to take the photos in the first place. This is part of a larger effort to develop my creativity this year; I&#8217;m looking forward to adding more content as I go (hopefully not all of these will be from my phone camera)!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.500null.com/life/new-project-photo-blog/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Object Property Maps for Higher Levels of&#160;Abstraction</title>
		<link>http://www.500null.com/development/using-object-property-maps-for-higher-levels-of-abstraction/</link>
		<comments>http://www.500null.com/development/using-object-property-maps-for-higher-levels-of-abstraction/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 21:32:26 +0000</pubDate>
		<dc:creator>Adam Detrick</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Abstraction]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Reuse]]></category>

		<guid isPermaLink="false">http://www.500null.com/?p=44</guid>
		<description><![CDATA[&#8220;Object property maps&#8221; are nothing more than normal Javascript objects, but they really have a lot to offer when it comes to writing nicely abstracted, reusable, and maintainable code. They can be used to separate conditions and configuration from the &#8220;moving parts&#8221; of a program, making it much easier to modify, reuse, or interface with [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;Object property maps&#8221; are nothing more than normal Javascript objects, but they really have a lot to offer when it comes to writing nicely abstracted, reusable, and maintainable code. They can be used to separate conditions and configuration from the &#8220;moving parts&#8221; of a program, making it much easier to modify, reuse, or interface with parts of your code later on.</p>
<p><span id="more-44"></span></p>
<p>For the purposes of this post, let&#8217;s imagine we have a product review that can receive a letter grade rating (&#8220;A&#8221;, &#8220;B&#8221;, &#8220;C&#8221;, &#8220;D&#8221;, or &#8220;F&#8221;). The designers decided to have a bit of fun with this one and mocked up the rating area so that all grades are visible and grey. The grade letter rating of the product gets highlighted in this list with a color specific to the grade. This is something CSS by itself should handle, but let&#8217;s assume that for this post that we only receive the grade rating via javascript.</p>
<p>Here&#8217;s what the markup looks like:</p>
<pre><code class="html">&lt;ul id=&quot;grade&quot;&gt;
	&lt;li id=&quot;A&quot;&gt;A&lt;/li&gt;
	&lt;li id=&quot;B&quot;&gt;B&lt;/li&gt;
	&lt;li id=&quot;C&quot;&gt;C&lt;/li&gt;
	&lt;li id=&quot;D&quot;&gt;D&lt;/li&gt;
	&lt;li id=&quot;F&quot;&gt;F&lt;/li&gt;
&lt;/ul&gt;</code></pre>
<p>One approach to writing a javascript function to handle this would be to check which grade is being highlighted, and set a &#8220;color&#8221; variable accordingly:</p>
<pre><code class="javascript">function highlightGrade(sGrade) {
    var element = document.getElementById(sGrade);
    var color;

    if (sGrade === "A") {
        color = '#009933';
    } else if (sGrade === "B") {
        color = '#009933';
    } else if (sGrade === "C") {
        color = '#ff9933';
    } else if (sGrade === "D") {
        color = '#cc0000';
    } else if (sGrade === "F") {
        color = '#cc0000';
    };

    element.style.backgroundColor = color;
}
</code></pre>
<p>The problem with the above example is that the color for each grade rating is hard coded within the function. Suppose that later on, someone decides to add an &#8220;C+&#8221; rating (or an &#8220;E&#8221;, for that matter). Better yet, imagine that the colors all change as well. You&#8217;d have to edit the original function and add/remove conditions to it as needed. While it isn&#8217;t hard to do so in this specific example, this is not a good coding habit to have &#8211; as complexity increases, functions get bloated and hard to maintain, and the possibility of reuse is thrown by the wayside. </p>
<p>This is where the idea of property maps come in &#8211; by storing all the possibilities for grade colors in an object rather than conditions in the function, we create a maintainable configuration outside the moving parts of the function:</p>
<pre><code class="javascript">/**
* "colors" is our property map
*/
var colors = {
    &quot;A&quot; : &#39;#009933&#39;,
    &quot;B&quot; : &#39;#009933&#39;,
    &quot;C&quot; : &#39;#ff9933&#39;,
    &quot;D&quot; : &#39;#cc0000&#39;,
    &quot;F&quot; : &#39;#cc0000&#39;
};

function highlightGrade(sGrade) {
    var element = document.getElementById(sGrade);

    element.style.backgroundColor = colors[sGrade];
};
</code></pre>
<h3>Further Abstraction</h3>
<p>As long as we&#8217;re considering abstraction, let&#8217;s think about the reusability of this function. We may have other elements we may want to highlight with conditional colors&#8230;</p>
<pre><code class="javascript">function highlightElementByCondition(sElementId, sCondition, oMap) {
    var element = document.getElementById(sElementId);

    element.style.backgroundColor = oMap[sCondition];
};

//calling it to highlight a letter grade (element, condition, map)
highlightElementByCondition(myId, myGradeLetter, {
    // property map
    &quot;A&quot;     : &#39;#009933&#39;,
    &quot;B&quot;     : &#39;#009933&#39;,
    &quot;C&quot;     : &#39;#ff9933&#39;,
    &quot;D&quot;     : &#39;#cc0000&#39;,
    &quot;F&quot;     : &#39;#cc0000&#39;
});
</code></pre>
<p>Of course, there are two sides to every design pattern &#8211; as always, it comes down to a judgement call. Are the conditions for a function unusually complicated? Will the conditions be likely to change? Does your function have wider applications than the specific problem you&#8217;re trying to solve? </p>
<p>If you make a habit of asking these questions while writing code, your coworkers and/or clients may thank you later.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.500null.com/development/using-object-property-maps-for-higher-levels-of-abstraction/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Black, White, and Visited Links All&#160;Over</title>
		<link>http://www.500null.com/development/black-white-and-visited-links-all-over/</link>
		<comments>http://www.500null.com/development/black-white-and-visited-links-all-over/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 00:53:16 +0000</pubDate>
		<dc:creator>Adam Detrick</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Readability]]></category>
		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://www.500null.com/?p=21</guid>
		<description><![CDATA[The first widespread use of CSS had everything to do with links. It wasn&#8217;t long before it seemed like a standard to overwrite the &#8220;ugly&#8221; default styling of links with colorful, non-underlined, stateless link styles. Now in 2010, old habits are still hard to break. It remains unusually hard to convince designers, developers, and clients [...]]]></description>
			<content:encoded><![CDATA[<p>The first widespread use of CSS had everything to do with links. It wasn&#8217;t long before it seemed like a standard to overwrite the &#8220;ugly&#8221; default styling of links with colorful, non-underlined, stateless link styles. Now in 2010, old habits are still hard to break. It remains unusually hard to convince designers, developers, and clients that visited link styles exist for good reason.</p>
<p>The state of the web has changed considerably since people first started overriding default link styles. We have fluid layouts, frameworks, progressive enhancement, AJAX, accessibility standards, cloud applications, and the rumored death of flash in favor of standards-based development, but for some reason many websites still fail to give their users a way to see which links they&#8217;ve visited already. As usual, the devil is in the details.</p>
<p><span id="more-21"></span></p>
<h3>A Webpage Is Just an Interface</h3>
<p>We know that visited links can show us where we&#8217;ve been, but in the context of the page, it can also show us where we haven&#8217;t been (yes, this is important). Consider the success of reader applications like <a href="http://reader.google.com" class="external">Google Reader</a>. It gives the user a list of posts to read from RSS feeds, and allows the user to mark things as &#8220;read&#8221;, taking them off the main page of the application. </p>
<p>The interesting thing is that we have a mechanism for doing this on any webpage with just one CSS selector. While the web has benefited greatly from translating print design best practices to interaction design, we often forget the nature of the web as being an interactive medium (and we forget why our users visit websites in the first place). A website is just a human-computer interface for delivering content. The more that people realize this, the less we&#8217;ll all fret over each little pixel and underline.</p>
<h3>Example: Visited Links as a Visual Checklist on nytimes.com</h3>
<p>Using <a href="http://www.nytimes.com" class="external">The New York Times website</a> as an example, we can add a really simple CSS rule or two that leverages visited links to create a sort of &#8220;visual checklist&#8221; for what I have or haven&#8217;t read. Here&#8217;s a segment of their website, without any of the links visited:</p>
<p><img class="alignnone size-full wp-image-25" title="none_visited" src="http://www.500null.com/wp-content/uploads/2010/02/none_visited.jpg" alt="" width="407" height="280" /></p>
<p>The New York Times was smart enough to add a visited link style, although it&#8217;s subtle (most likely to preserve design consistency):</p>
<p><img src="http://www.500null.com/wp-content/uploads/2010/02/top_visited.jpg" alt="" title="top_visited" width="407" height="280" class="alignnone size-full wp-image-31" /></p>
<p>If we shift our thinking from visual design to interface design, this may not be the easiest way to discern visited from non-visited links. I&#8217;ll start by adding a simple CSS rule to clearly mark the link as visited:</p>
<pre><code class="css">a:visited {
    background: pink;
    font-weight: normal;
    color: #000;
    opacity: 0.3;
}
</code></pre>
<p><img src="http://www.500null.com/wp-content/uploads/2010/02/visited_marked.jpg" alt="" title="visited_marked" width="407" height="280" class="alignnone size-full wp-image-32" /></p>
<p>This is better, but the associated image is taking up space when we don&#8217;t really need it. Because images are often wrapped in links, we can again make use of the visited pseudo selector for images as well:</p>
<pre><code class="css">a:visited img { display: none; }</code></pre>
<p><img src="http://www.500null.com/wp-content/uploads/2010/02/visited_noimg.jpg" alt="" title="visited_noimg" width="407" height="280" class="alignnone size-full wp-image-37" /></p>
<p>Note that in the above example, the next headline is brought into view. While I would argue that <a href="http://www.thereisnopagefold.com/" class="external">There is No Fold</a>, bringing unseen content into view while fading seen content into the background noise is certainly a good thing.</p>
<h3>Read All Over</h3>
<p>It may seem trivial at a single link level, but the effect can be significant on a page full of headlines, links, and images. Here&#8217;s the before and after on the home page:</p>
<p>Before:<br />
<a href="http://www.500null.com/wp-content/uploads/2010/02/home_before.jpg"><img src="http://www.500null.com/wp-content/uploads/2010/02/home_before-300x261.jpg" alt="" title="home_before" width="300" height="261" class="alignnone size-medium wp-image-38" /></a></p>
<p>After:<br />
<a href="http://www.500null.com/wp-content/uploads/2010/02/home_after.jpg"><img src="http://www.500null.com/wp-content/uploads/2010/02/home_after-300x261.jpg" alt="" title="home_after" width="300" height="261" class="alignnone size-medium wp-image-39" /></a></p>
<h3>But It&#8217;s So Ugly!</h3>
<p>Ok, so my example may not be beautiful, but from an interaction standpoint I think it merits some exploration. Imagine that if this idea gains popularity, we&#8217;d see some design conventions eventually emerge just as we have with so many other things over the last 10 years. I don&#8217;t expect they would involve a pink background, but sometimes designers can surprise us.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.500null.com/development/black-white-and-visited-links-all-over/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Priorities</title>
		<link>http://www.500null.com/life/priorities/</link>
		<comments>http://www.500null.com/life/priorities/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 23:10:20 +0000</pubDate>
		<dc:creator>Adam Detrick</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[Creativity]]></category>
		<category><![CDATA[Process]]></category>

		<guid isPermaLink="false">http://www.500null.com/?p=10</guid>
		<description><![CDATA[Nothing kills an idea faster than waiting for everything to be perfect. This is singularly what has kept me from updating my personal site for so long.
Calculation and planning only get you so far; it&#8217;s time to begin creating again. If there&#8217;s anything I&#8217;ve learned over the last 6 months, it&#8217;s that I am my [...]]]></description>
			<content:encoded><![CDATA[<p>Nothing kills an idea faster than waiting for everything to be perfect. This is singularly what has kept me from updating my personal site for so long.</p>
<p>Calculation and planning only get you so far; it&#8217;s time to begin creating again. If there&#8217;s anything I&#8217;ve learned over the last 6 months, it&#8217;s that I am my own worst client. It&#8217;s been an incredible relief to let go of certain expectations for my site, and get down to business writing content. Wish me luck.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.500null.com/life/priorities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
