<?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>refresherate.com &#187; web standards</title>
	<atom:link href="http://www.refresherate.com/category/web-standards/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.refresherate.com</link>
	<description>An invigorating splash of web geek goodness.</description>
	<lastBuildDate>Fri, 06 Aug 2010 19:13:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Refactoring your CSS &amp; XHTML/HTML</title>
		<link>http://www.refresherate.com/2009/07/16/refactoring-your-css-xhtml-html/</link>
		<comments>http://www.refresherate.com/2009/07/16/refactoring-your-css-xhtml-html/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 20:10:53 +0000</pubDate>
		<dc:creator>Sheldon Finlay</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[web standards]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.refresherate.com/?p=169</guid>
		<description><![CDATA[Refactoring is a concept that is often used in the context of programming. In fact, it&#8217;s one of the cornerstones of Test-Driven Development (TDD) in Ruby on Rails. Oddly, I rarely see refactoring discussed in the context of writing CSS and XHTML. Whether you write Ruby, PHP, Perl or CSS and HTML, refactoring your code [...]]]></description>
			<content:encoded><![CDATA[<p>Refactoring is a concept that is often used in the context of programming. In fact, it&#8217;s one of the cornerstones of Test-Driven Development (TDD) in Ruby on Rails. Oddly, I rarely see refactoring discussed in the context of writing CSS and XHTML. Whether you write Ruby, PHP, Perl or CSS and HTML, refactoring your code should be a part of your coding workflow.</p>
<p>So what is refactoring? It&#8217;s basically cleaning up your code, making it more efficient and easier to maintain. When writing prose, you bang out a first draft to get your ideas down on <img src="http://www.refresherate.com/wp-content/uploads/2009/07/refactoring-css.png" alt="refactoring-css" title="refactoring-css" width="207" height="130" class="alignright size-full wp-image-172" />paper. It&#8217;s a bunch of crap often. Then you revisit your mess and make it beautiful and worthy of submitting to your local town paper. </p>
<p>Coding is no different. When writing XHTML and CSS I am often trying out things, adding extra divs and spans, and creating a mess of CSS and XHTML. It&#8217;s called the process. It&#8217;s messy. When I finally get to the look I wanted to achieve, I take a quick break and bask in the glory of having everything aligning and looking the way I had envisioned it to look. But I am not done yet. Far from it. I must refactor my code.</p>
<p>Refactoring code removes duplication, aids in readability and maintenance of the code in the future. The goal here is to make things simpler, while continuing to achieve the layout I have designed. If you refactor and suddenly something doesn&#8217;t look right, that is not refactoring, that is breaking something. You want to refactor in small steps and test your code in the browser to ensure things are still working as intended. You should be using some form of source control management (SCM) like <a href="http://www.git-scm.com">Git</a> and regularly checking your code changes in. This way if you botch something, you can always pull a working version out of your SCM.</p>
<p>Now you might be thinking to yourself, <em>I write semantic markup, isn&#8217;t that refactoring</em>? No, that&#8217;s called doing your job as a standards aware designer. You should always strive to create meaningful markup. That&#8217;s the name of the game. Refactoring is revisiting your code and identifying areas where your code can be improved, streamlined and made simpler. In six months or a year, when you revisit this code you&#8217;ll spend less time trying to remember how this code works because you took the time to make it simpler and easier to maintain. </p>
<p>Refactoring is a huge topic and I plan on addressing it using several examples in a series of posts on the topic. We are going to take some baby steps here. For now I will leave you with a simple refactoring of CSS.</p>
<p>I ended up writing this CSS code in a site I was working on today:</p>
<p><script src="http://gist.github.com/146590.js"></script></p>
<p>Do you notice something in this code? There is a huge amount of duplication here.  The height and the padding-top attributes are the same for each of these classes. This duplication violates the DRY principle: Don&#8217;t Repeat Yourself. Duplication is a very bad thing. If we want to change the height, we have to change it in four places. This is not ideal. A better approach would be to refactor this CSS and remove the duplication and place it into a group of parent classes:</p>
<p><script src="http://gist.github.com/146592.js"></script></p>
<p>So here I  have refactored out the duplication and placed it in a group of parent classes. Now if I want to change the height of padding of these elements, I just need to deal with making the change in one place. The readability has been improved along with the maintainability. And I have saved a a few lines of CSS. While not a huge amount in the small example, the LOC saving in a large CSS file can measure in the kilobytes!</p>
<p>Thats it for now. If there is one takeaway in this lesson, it is look for and eliminate duplication whenever possible. Stay tuned for more examples of CSS &amp; XHTML refactoring.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.refresherate.com/2009/07/16/refactoring-your-css-xhtml-html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is XHTML Dead?</title>
		<link>http://www.refresherate.com/2009/07/07/is-xhtml-dead/</link>
		<comments>http://www.refresherate.com/2009/07/07/is-xhtml-dead/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 15:28:09 +0000</pubDate>
		<dc:creator>Sheldon Finlay</dc:creator>
				<category><![CDATA[web standards]]></category>
		<category><![CDATA[markup]]></category>
		<category><![CDATA[semantic]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.refresherate.com/?p=153</guid>
		<description><![CDATA[The web is always chocked full of conflicting information. As Mark Twain put it, A lie can travel halfway round the world while the truth is putting on its shoes. On the Intrawebs, the truth often wears cement shoes. There&#8217;s a great deal of confusion on the web this week with the announcement from the W3C that the [...]]]></description>
			<content:encoded><![CDATA[<p>The web is always chocked full of conflicting information. As Mark Twain put it, A <em>lie</em> can travel halfway round the world while the <em>truth</em> is putting on its shoes. On the Intrawebs, the truth often wears cement shoes.</p>
<p>There&#8217;s a great deal of confusion on the web this week with the announcement from the <a href="http://w3c.org">W3C</a> that the XHTML2 working group <a href="http://www.w3.org/News/2009#item119">will stop work</a> at the end of this year. Oh noes! So does this spell the end of XHTML?</p>
<p>There&#8217;s one surefire way to answer this question:</p>
<p><a href="http://isxhtmldead.com">http://isxhtmldead.com/</a></p>
<p>Resources:</p>
<ul>
<li><a href="http://www.zeldman.com/2009/07/07/in-defense-of-web-developers/">In Defense of Web Developers </a></li>
<li><a href="http://adactio.com/journal/1595/">Misunderstanding Markup</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.refresherate.com/2009/07/07/is-xhtml-dead/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
