<?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>Carbon Five Community &#187; CSS</title>
	<atom:link href="http://blog.carbonfive.com/category/css/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.carbonfive.com</link>
	<description></description>
	<lastBuildDate>Fri, 27 Aug 2010 00:24:40 +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>A few experiments with HTML 5 applications</title>
		<link>http://blog.carbonfive.com/2010/07/software-design/a-few-experiments-with-html-5-applications</link>
		<comments>http://blog.carbonfive.com/2010/07/software-design/a-few-experiments-with-html-5-applications#comments</comments>
		<pubDate>Thu, 08 Jul 2010 21:30:03 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript / AJAX]]></category>
		<category><![CDATA[Software Design]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[spa]]></category>

		<guid isPermaLink="false">http://blog.carbonfive.com/?p=1052</guid>
		<description><![CDATA[I&#8217;ve had a long-standing interest in taking client-side programming beyond display logic and input validation. The new HTML 5 technologies are making full-scale application development in the browser increasingly practical. Unfortunately, the needs of Carbon Five&#8217;s clients generally exceed the capabilities of purely client-side solutions, so I don&#8217;t get to spend as much time developing [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had a long-standing interest in taking client-side programming beyond display logic and input validation.  The new <a href="http://en.wikipedia.org/wiki/HTML5">HTML 5</a> technologies are making full-scale application development in the browser increasingly practical. Unfortunately, the needs of Carbon Five&#8217;s clients generally exceed the capabilities of purely client-side solutions, so I don&#8217;t get to spend as much time developing JavaScript as I&#8217;d like. Consequently, I challenged myself to solve as many of my day-to-day issues as possible by writing applications that require only a single HTML page and a modern browser to run. So far, this has resulted in five applications; they&#8217;re available &#8212; with some additional thoughts on this style of development &#8212; below the fold.</p>
<p><span id="more-1052"></span></p>
<h2>The Applications</h2>
<ul>
<li>
  <b><label><a href="http://carbonfive.github.com/html5-playground/snowballs.html">Snowballs</a></label></b></p>
<p>Snowballs is a video game that was mostly designed by my 7 year old daughter, Ada. She started with a drawing that contained a maze filled with dots, a player and some monsters, and she explained how you throw snowballs at the monsters and build walls to block them. I convinced her we could get roughly the same effect by freezing the monsters instead of blocking them, and then I began developing. We started iterating, and she continued to contribute ideas which, somewhat surprisingly, always made the game more fun. The arrow keys move the player, and the spacebar launches a snowball. It&#8217;s implemented as a single Canvas tag using a JavaScript interval as a run loop. The maze, players, monsters, and snowballs are all drawn with JS functions using the Canvas drawing API. Since this application uses the Canvas tag, it won&#8217;t run in Internet Explorer or older versions of other browsers.
  </p>
</li>
<li>
  <b><label><a href="http://carbonfive.github.com/html5-playground/flashcards.html">Flashcards</a></label></b></p>
<p>I wrote Flashcards one evening when Ada&#8217;s teacher suggested using flash cards to help her memorize the words she shouldn&#8217;t need to sound out. The idea is that the parent clicks the spacebar when the child reads the word and they work together to reduce the time needed to read all the words. The application doesn&#8217;t need any graphics (other than some external images at the end), so it doesn&#8217;t use any HTML 5 features (browser compatibility is unknown).
  </p>
</li>
<li>
  <b><label><a href="http://carbonfive.github.com/html5-playground/timetest.html">Timetest</a></label></b></p>
<p>
    Like Flashcards, I wrote Timetest to help Ada with her schoolwork. In this case, she was getting frustrated with a lesson on analog clocks, so I wrote this application to make it more of a game. The goal is to answer as many questions as possible in the given time. The test turned out to be more difficult than it really needed to be, so I created an easier version (accessed by adding <i>#easy</i> to the URL). Since this application uses the Canvas tag, it won&#8217;t run in Internet Explorer or older versions of other browsers.
  </p>
</li>
<li>
  <b><label><a href="http://carbonfive.github.com/html5-playground/arithmetic.html">Arithmetic</a></label></b></p>
<p>
    Arithmetic is another educational application designed to drill addition that uses carrying. It provides spaces at the top, which you can click to mark a carry from the previous column. It doesn&#8217;t have any fancy HTML 5 features, but it does have a lot of stats.
  </p>
</li>
<li>
  <b><label><a href="http://carbonfive.github.com/html5-playground/surround.html">Surround</a></label></b></p>
<p>
    My wife and I had designed a fireplace surround and mantel for our living room,  but when it came to actually buying the materials and building the thing, we realized we didn&#8217;t know exactly how to scale it.  Since the design was entirely composed of rectangles, I realized it would be possible to build a simple one-off CAD program to help us agree on some dimensions.  The application makes use of the Canvas tag and the new HTML 5 slider inputs (which aren&#8217;t currently supported in Firefox). It translates between pixels and feet/inches constrained to an 8th of an inch, in order to make the measurements easier to use in the shop.
  </p>
</li>
</ul>
<p>  The goal of these exercises was to produce something simple and quick, but not entirely without polish. All the applications except Snowballs took only an evening or two. Each application (also excluding Snowballs) ended up under 300 lines of HTML, CSS, and JS combined.</p>
<h2>Developing without a JavaScript framework</h2>
<p>Limiting the applications to a single page means no importing <a href="http://jquery.com">jQuery</a> or <a href="http://www.prototypejs.org/">Prototype</a>. This might seem like a big constraint in an application written entirely in JavaScript. But these frameworks really only help out with DOM traversal/manipulation, event handling, animation, Ajax, form validation. All the applications make do with a small amount of HTML, so it&#8217;s easy enough to grab elements by ID, and a few visits to <a href="http://www.quirksmode.org/">Quirksmode</a> gave me some reasonably cross-browser event-handling code. Animation isn&#8217;t really that hard in JS, and I needed it to be more custom than frameworks allow anyway. The rest I didn&#8217;t need.  The truth is, I never miss having a framework (though I&#8217;m not about to stop using jQuery when working on client&#8217;s sites).</p>
<h2>Advantages and disadvantages</h2>
<ul>
<li>
  <b>They&#8217;re quick to start.</b>  Since it&#8217;s a single page, there&#8217;s no setup and no integration.
  </li>
<li>
    <b>They&#8217;re easy to deploy.</b>  It&#8217;s only one relatively small file, so you can e-mail it to friends, and you can host it anywhere. If you want to spend a little time making it touch-screen compatible, you can get it on all the smarter smart phones without bothering with app stores. On the other hand, there is no way prevent people from stealing the application or the code if you were developing it commercially, since the source is always just a right-click away.
  </li>
<li>
    <b>HTML+CSS is a powerful display framework.</b>  Although it lacks built-in support for some of the fancier UI widgets, there is no GUI framework that I&#8217;m aware of (and I&#8217;ve developed with quite a few) that provides the same level of design control with the same ease of development as these technologies. Of course, I&#8217;ve been swimming in HTML/CSS for years, so this opinion is a bit biased.
  </li>
<li>
    <b>Canvas has a powerful vector graphics API.</b>  I had done a fair amount of <a href="http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Introduction/Introduction.html">Cocoa programming</a> prior to these projects, so this didn&#8217;t come as a surprise. The real power of <a href="https://developer.mozilla.org/en/drawing_graphics_with_canvas">Canvas</a> lies in its transformation functions. I&#8217;d like to find an application for some more advanced spline generation. The downside is that Canvas and HTML don&#8217;t really mix, so you can have great text layout in HTML and sophisticated text animations in Canvas, but not both at the same time.
  </li>
<li>
    <b>JavaScript is a capable if not optimal language.</b>  No one is going to <a href="http://www.crockford.com/javascript/javascript.html">make the case</a> that JavaScript is the greatest language ever designed, but what it lacks in performance and language features, it partially makes up in powerful fundamentals and simplicity.  JavaScript is neither a great functional language nor a great object-oriented one, but it is sufficiently powerful to develop in either of these paradigms. Snowballs, for example, acts a lot like a simulation and benefited from stateful objects. The other applications required less state and I found several uses for <a href="http://en.wikipedia.org/wiki/Higher-order_function">higher-order functions</a>, though I wouldn&#8217;t consider any of them properly functional.
  </li>
<li>
    <b>Single-page applications are fun.</b>  These exercises have reminded me that, once the responsibilities of software engineering are stripped away, there is a joy to be found in coding for coding&#8217;s sake.
  </li>
</ul>
<p>
All of these applications are <a href="http://github.com/carbonfive/html5-playground">available on GitHub</a>, but it&#8217;s probably easier to right-click on the page and choose <i>view source</i>. <img src='http://blog.carbonfive.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.carbonfive.com/2010/07/software-design/a-few-experiments-with-html-5-applications/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Agile Practices&#8230; visualized?</title>
		<link>http://blog.carbonfive.com/2009/10/javascript-ajax/agile-practices-visualized</link>
		<comments>http://blog.carbonfive.com/2009/10/javascript-ajax/agile-practices-visualized#comments</comments>
		<pubDate>Wed, 07 Oct 2009 16:19:35 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript / AJAX]]></category>

		<guid isPermaLink="false">http://blog.carbonfive.com/?p=684</guid>
		<description><![CDATA[Only pure agile devotees will find it interesting&#8230; Revisiting agile methodologies, I wanted to solidify my understanding of the differences between agile, scrum, XP, etc. I went through a mini-research project of reviewing the &#8220;canonical&#8221; sources of these practices, and then built a quick visualization to clarify my understanding: http://ndpsoftware.com/agile_methods/agile_methods.html Hint: Try dragging around the [...]]]></description>
			<content:encoded><![CDATA[<p>Only pure agile devotees will find it interesting&#8230; Revisiting agile methodologies, I wanted to solidify my understanding of the differences between agile, scrum, XP, etc. I went through a mini-research project of reviewing the &#8220;canonical&#8221; sources of these practices, and then built a quick visualization to clarify my understanding:</p>
<p><a title="Agile Methods Visualized" href="http://ndpsoftware.com/agile_methods/agile_methods.html">http://ndpsoftware.com/agile_methods/agile_methods.html</a></p>
<p><em>Hint: Try dragging around the boxes</em> to see how practices are related to each other.</p>
<p><em>Warning: If it doesn&#8217;t draw anything interesting for you, refresh your browser&#8230;</em> there&#8217;s a large component of &#8220;randomness&#8221; to the algorithm and it can get stuck easily.</p>
<p><em>Warning II: Don&#8217;t leave it running in your browser</em>, as it&#8217;s somewhat sluggish Javascript&#8230; this was a demo thrown together in a couple hours.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.carbonfive.com/2009/10/javascript-ajax/agile-practices-visualized/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Convenient CSS and Javascript in Ruby on Rails</title>
		<link>http://blog.carbonfive.com/2009/03/javascript-ajax/convenient-css-and-javascript-in-ruby-on-rails</link>
		<comments>http://blog.carbonfive.com/2009/03/javascript-ajax/convenient-css-and-javascript-in-ruby-on-rails#comments</comments>
		<pubDate>Mon, 09 Mar 2009 00:41:11 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript / AJAX]]></category>
		<category><![CDATA[Ruby (on Rails)]]></category>
		<category><![CDATA[prototyping]]></category>
		<category><![CDATA[rapid development]]></category>
		<category><![CDATA[Software Design]]></category>

		<guid isPermaLink="false">http://blog.carbonfive.com/?p=480</guid>
		<description><![CDATA[I get tired of hunting through a hierarchy of folders and files, from the views to the public folder, to locate a certain CSS or Javascript file. It&#8217;d be convenient to have them right with the markup, but embedding these definitions within your HTML markup is a bad idea for several reasons. For our current [...]]]></description>
			<content:encoded><![CDATA[<p>I get tired of hunting through a hierarchy of folders and files, from the views to the public folder, to locate a certain CSS or Javascript file. It&#8217;d be convenient to have them right with the markup, but embedding these definitions within your HTML markup is a bad idea for several reasons. For our current project, I proposed we put everything in the view directory so they are easy to find:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">app<span style="color: #339933;">/</span>
  views<span style="color: #339933;">/</span>
    home<span style="color: #339933;">/</span>
      index.<span style="color: #006633;">html</span>.<span style="color: #006633;">rb</span>
      index.<span style="color: #006633;">css</span>
      index.<span style="color: #006633;">js</span></pre></div></div>

<p>The convention is clear: to add page-specific CSS code, just create a new file with the same name as the view, in the same folder. Easy to add, edit and remove. The alternative (using the public folder), usually leads to a parallel hierarchy and the inconvenience of that.</p>
<p>I also thought, that this being Rails and all, the files should be included automatically. It turned out to be pretty easy.<span id="more-480"></span></p>
<h2>The Implementation</h2>
<h3>Serving the Assets</h3>
<p>To serve this file, we need a route and a controller.</p>
<p>First the route:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">map.<span style="color:#9900CC;">connect</span> <span style="color:#996600;color: blue;">'/asset/:path'</span>,
    <span style="color:#ff3333; font-weight:bold;">:controller</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#996600;color: blue;">'asset'</span>, <span style="color:#ff3333; font-weight:bold;">:action</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#996600;color: blue;">'serve_asset'</span>, <span style="color:#ff3333; font-weight:bold;">:path</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#006600; font-weight:bold;">/</span>.<span style="color:#006600; font-weight:bold;">*</span>.<span style="color:#006600; font-weight:bold;">&#40;</span>js<span style="color:#006600; font-weight:bold;">|</span>css<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">/</span></pre></div></div>

<p>We need to be careful here, since we&#8217;re going to be serving files directly out of our view hierarchy&#8211; make sure the route only picks up the javascript and CSS files.</p>
<p>The corresponding controller:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> AssetController <span style="color:#006600; font-weight:bold;">&amp;</span>lt; ApplicationController
  <span style="color:#9966CC; font-weight:bold;">def</span> serve_asset
    path = params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:path</span><span style="color:#006600; font-weight:bold;">&#93;</span>
    <span style="color:#CC0066; font-weight:bold;">format</span> = path.<span style="color:#CC0066; font-weight:bold;">sub</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">/</span>.<span style="color:#006600; font-weight:bold;">*</span>.<span style="color:#006600; font-weight:bold;">&#40;</span>w<span style="color:#006600; font-weight:bold;">+</span>$<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">/</span>, <span style="color:#996600;color: blue;">'1'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    respond_to <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>format<span style="color:#006600; font-weight:bold;">|</span>
      <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">js</span> <span style="color:#006600; font-weight:bold;">&#123;</span> render <span style="color:#ff3333; font-weight:bold;">:file</span>=<span style="color:#006600; font-weight:bold;">&amp;</span>gt;<span style="color:#996600;color: blue;">&quot;#{RAILS_ROOT}/app/views/#{path}&quot;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
      <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">css</span> <span style="color:#006600; font-weight:bold;">&#123;</span> render<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:file</span>=<span style="color:#006600; font-weight:bold;">&amp;</span>gt;<span style="color:#996600;color: blue;">&quot;#{RAILS_ROOT}/app/views/#{path}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Now the assets mentioned above are served as /assets/index.css and /assets/index.js.</p>
<h3>Including the Assets</h3>
<p>With this convention, we added code to our layout that includes these files automatically, but only if they exist. First, the additional controller code:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> AssetController <span style="color:#006600; font-weight:bold;">&amp;</span>lt; ApplicationController
  ...
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">include_asset</span><span style="color:#006600; font-weight:bold;">&#40;</span>rel_path<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#996600;color: blue;">''</span> <span style="color:#9966CC; font-weight:bold;">unless</span> AssetController.<span style="color:#9900CC;">asset_exists</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>rel_path<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">case</span> rel_path
      <span style="color:#9966CC; font-weight:bold;">when</span> <span style="color:#006600; font-weight:bold;">/</span>.<span style="color:#9900CC;">js</span>$<span style="color:#006600; font-weight:bold;">/</span>
        <span style="color:#996600;color: blue;">&quot;&lt;script src=&quot;</span><span style="color:#006600; font-weight:bold;">/</span>asset<span style="color:#006600; font-weight:bold;">/</span><span style="color:#008000; font-style:italic;">#{rel_path}&quot; type=&quot;text/javascript&quot;&gt;&lt;!--mce:0--&gt;&lt;/script&gt;&quot;</span>
      <span style="color:#9966CC; font-weight:bold;">when</span> <span style="color:#006600; font-weight:bold;">/</span>.<span style="color:#9900CC;">css</span>$<span style="color:#006600; font-weight:bold;">/</span>
        <span style="color:#996600;color: blue;">&quot;
&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">asset_exists</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>rel_path<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#CC00FF; font-weight:bold;">FileTest</span>.<span style="color:#9900CC;">exists</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>RAILS_ROOT <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;color: blue;">&quot;/app/views/#{rel_path}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>And the code needed in the (Erector) layout:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">head <span style="color:#9966CC; font-weight:bold;">do</span>
  c = <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9966CC; font-weight:bold;">class</span>
  rawtext AssetController.<span style="color:#9900CC;">include_asset</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;color: blue;">&quot;#{c.name.underscore}.js&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  rawtext AssetController.<span style="color:#9900CC;">include_asset</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;color: blue;">&quot;#{c.name.underscore}.css&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Actually, since it&#8217;s Erector, the views are Ruby classes, so there is a hierarchy. These assets may be specific to any one of these:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">c = <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9966CC; font-weight:bold;">class</span>
<span style="color:#9966CC; font-weight:bold;">while</span> c != <span style="color:#CC00FF; font-weight:bold;">Object</span>
  rawtext AssetController.<span style="color:#9900CC;">include_asset</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;color: blue;">&quot;#{c.name.underscore}.js&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  rawtext AssetController.<span style="color:#9900CC;">include_asset</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;color: blue;">&quot;#{c.name.underscore}.css&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  c = c.<span style="color:#9900CC;">superclass</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<h2>Discussion</h2>
<p>Although some people will bristle at the proliferation of files, I have used this technique repeatedly over the last five years (in Java and PHP projects). I find it leads to sound, modular development. With Ruby, it&#8217;ll be pretty straightforward to concat the assets together later on, to reduce requests, or even embed the code directly in the served HTML files, if it&#8217;s small enough. It&#8217;s also convenient to add page caching in the controller, when the time comes. Adding</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  caches_page<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:serve_asset</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>copies all these files into public/assets (as they are accessed), which conveniently takes your mongrel (or whatever) out of the picture.</p>
<p>You might imagine this keeps you from organizing and structuring your CSS and Javascript; it doesn&#8217;t do that. It lowers the barier to using a &#8220;local&#8221; scope for the CSS and Javascript. It allows you to write page-specific CSS and Javascript, which if you&#8217;re developing code quickly, is a lifesaver. We have repeatedly opened a view-specific Javascript file, seen that it no longer applies to the code, and removed it&#8211; safely. It&#8217;s easy to edit scripts when you know they only effect one page. Without this, I tend to lump things together that don&#8217;t really belong, and it becomes hard to tease them apart later.</p>
<p>Thoughts?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.carbonfive.com/2009/03/javascript-ajax/convenient-css-and-javascript-in-ruby-on-rails/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Compass, the 960 CSS framework, and Semantic Markup</title>
		<link>http://blog.carbonfive.com/2009/03/html/compass-960-semantics</link>
		<comments>http://blog.carbonfive.com/2009/03/html/compass-960-semantics#comments</comments>
		<pubDate>Mon, 02 Mar 2009 18:08:21 +0000</pubDate>
		<dc:creator>Aaron Brown</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[960]]></category>
		<category><![CDATA[Compass]]></category>
		<category><![CDATA[Grids]]></category>

		<guid isPermaLink="false">http://blog.carbonfive.com/?p=347</guid>
		<description><![CDATA[Finding your way to meaningful grid layouts using the Compass framework My problem: Grid layouts &#8211; crazy, sexy, cool. Presentation classes in my semantic markup &#8211; neither sexy nor cool, and arguably crazy. These days I can&#8217;t help but notice a burgeoning awareness regarding seasoned typographical principles and practices and lively discussions around the best [...]]]></description>
			<content:encoded><![CDATA[<h2>Finding your way to meaningful grid layouts using the Compass framework</h2>
<h3>My problem: Grid layouts &#8211; crazy, sexy, cool. Presentation classes in my semantic markup &#8211; neither sexy nor cool, and arguably crazy.</h3>
<p>These days I can&#8217;t help but notice a burgeoning awareness regarding seasoned typographical principles and practices and lively discussions around the best way to bring these ideas and procedures to bear in the realm of web design. One area of these discussions that dovetails with my own interests is the subject of grid layouts. Grid systems are the architectonic foundation of a well structured and holistically interrelated design. They originated during the reign of the International Typographic Style, a primarily Swiss graphic arts movement which occurred after World War II. Grid layouts were cultivated and matured in the hands of such legendary designers as  Emil Ruder and Josef Müller-Brockmann, acknowledged masters of simultaneously presenting information in a functional and stylistic manner. As web designers, I feel we should constantly strive for these same goals &#8211; the presentation of information in a readily understandable way, yet also striving for an elegance in our presentation. Grids can help us accomplish this goal.</p>
<p>Over the past few years much headway has been made in cultivating an online consciousness of Grid Systems. <a title="Koi Vinh's on grid layouts" href="http://www.subtraction.com/2004/12/31/grid-computi">Khoi Vinh</a> and <a title="Cameron Moll on grid layouts" href="http://cameronmoll.com/archives/2006/12/gridding_the_960/">Cameron Moll</a> have shown us the benefits of using grid systems for web layouts, and Antonio Carusone from <a href="http://www.aisleone.net">AisleOne</a> has recently pieced together the awesome grid oriented hub, <a title="The Grid System" href="http://www.thegridsystem.org/">The Grid System</a>. Further, a number of CSS based grid frameworks have been popping up on the scene. Those that have much traction in the blogosphere&#8211;Blueprint, YUI Grids, 960 grid system&#8211;are only the tip of the iceberg.</p>
<p>I&#8217;ve been interested in experimenting with one of these frameworks for a while, but I have a single nagging concern with the way they are structured. All of the frameworks I have looked at use CSS class definitions which possess names that reek of presentational concerns. For example, Blueprint requires class names like &#8220;span-7 last&#8221; or &#8220;span-8&#8243;; 960 favors the equally presentational &#8220;grid_1 prefix_1&#8243; or &#8220;grid_7 alpha.&#8221; I just can&#8217;t get on board with this approach. I&#8217;m a firm adherent to notions of lean, minimal, and semantically vaible (X)HTML markup. The web development community has made great strides in separating out presentational concerns from the meaning inherent in well-crafted (X)HTML, divorcing the two orthogonal axes of style and semantics. And while I am a firm believer in the power of the grid to unify these two axes, as has been so well exhibited in the world of print, I cannot support said unification if it comes at the cost of reintroducing presentational markers into our markup &#8211; even something as ostensibly innocuous as a &#8216;mere&#8217; presentational class.</p>
<p>So, where does that leave us? Is it possible to get the best of both worlds? Can we simultaneously develop semantic markup while leveraging those tried and true grid layout principles common enough to be packaged into a framework?</p>
<h3>A potential solution to my problem: Compass &#8211; crazy? sexy? cool? To be determined&#8230;</h3>
<p>Much to my pleasure, I am alone in neither my conviction nor my desire. Enter Compass, a ruby based application which provides Sass based APIs to many of the most prominent CSS frameworks, including those concerned with providing grid layouts. Compass sits on top of Sass, a domain specific language (DSL) for programmatically crafting CSS. The power of Sass derives from the fact that it is a real programming language, replete with all the benefits of such a thing: pragmatic tools such variable declarations, control structures, and method invocations, as well as more theoretical, but no less useful, concepts like abstraction, DRY-ness, encapsulation, modularity, and code re-use. I&#8217;ll admit, I&#8217;m new to Sass, having used it only superficially on a small work project. I have barely scratched the surface of its capabilities. And while some feel its application <a href="http://fecklessmind.com/2009/01/28/fuck-sass/">fails</a> when applied to large scale projects, I can&#8217;t help but favor the programmatic benefits Sass brings to the table given my software engineering background.</p>
<p>Armed with Sass, developers can effectively write small libraries of code which will ultimately be translated into CSS. And Compass provides them with a mechanism for collecting these Sass libraries together and incorporating multiple APIs to into their own projects.</p>
<h4>So, how does Compass help preserve semantic markup?</h4>
<p>One of Sass&#8217;s most compelling features is known as a &#8216;mixin&#8217;. A mixin is a small module of Sass code, <em>defined but once</em>, that can be included into a Sass file and then referenced throughout. You can see where this is going. Imagine that in your application&#8217;s Sass file, you can gain access to, for example, 960&#8242;s grid layout API. You can &#8216;mixin&#8217; these snippets of Sass code <em>directly into your own semantic class definitions</em> forgoing the need to use 960&#8242;s presentational class names anywhere in your (X)HTML. In short, Compass grants you the power to marry a tightly structured grid-layout with the beauty of lean, semantic markup. Pretty nifty, no?</p>
<p>So I decided to put all this to the test. I needed to learn more Sass, I wanted to play with the 960 grid system, and I wanted to vet Compass&#8217;s claim that it can help you eat a grid-layout cake iced with sugary semantic goodness. Follow along if you will&#8230;</p>
<h3>Sussin&#8217; the Solution: My first Compass-960 project</h3>
<h4>Installing Compass and the 960 plug-in</h4>
<p>Since I already had Ruby and RubyGems installed, I was ready to start straight away with the installation of Compass.</p>
<p>First, I installed the bleeding edge of Haml, which includes Sass:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ git clone git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>nex3<span style="color: #000000; font-weight: bold;">/</span>haml.git
$ <span style="color: #7a0874; font-weight: bold;">cd</span> haml
$ rake <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>I verified my Sass installation:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ sass <span style="color: #660033;">-v</span>
Haml 2.1.0</pre></div></div>

<p>Good to go. Next, I installed Compass and the 960 plug-in:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ gem <span style="color: #c20cb9; font-weight: bold;">install</span> chriseppstein-compass
$ gem <span style="color: #c20cb9; font-weight: bold;">install</span> chriseppstein-compass-<span style="color: #000000;">960</span>-plugin</pre></div></div>

<h4>Creating a Compass-960 website project</h4>
<p>Time to create a template Compass-960 project:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ compass <span style="color: #660033;">-r</span> ninesixty <span style="color: #660033;">-f</span> <span style="color: #000000;">960</span> the_obscurantist</pre></div></div>

<p>Now I had my template project, which comprised:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">find</span> the_obscurantist<span style="color: #000000; font-weight: bold;">/</span>
the_obscurantist<span style="color: #000000; font-weight: bold;">/</span>config.rb
the_obscurantist<span style="color: #000000; font-weight: bold;">/</span>src
the_obscurantist<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>grid.sass
the_obscurantist<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>text.sass
the_obscurantist<span style="color: #000000; font-weight: bold;">/</span>stylesheets
the_obscurantist<span style="color: #000000; font-weight: bold;">/</span>stylesheets<span style="color: #000000; font-weight: bold;">/</span>grid.css
the_obscurantist<span style="color: #000000; font-weight: bold;">/</span>stylesheets<span style="color: #000000; font-weight: bold;">/</span>text.css</pre></div></div>

<p>Out of the box, the 960 plug-in produced two Sass files, grid.sass and text.sass. These two files mirrored the CSS files that come with the 960 framework, 960.css and text.css respectively. Whe I inspected the *.sass files, I noticed they already contained  code to get me up and running with a basic 960 grid layout.</p>
<p>At this point I took some time to finagle things into a state commensurate with my overall goal &#8211; the elimination of 960&#8242;s presentational class names. First, I wasn&#8217;t interested in 960&#8242;s typography, so I ditched text.sass and text.css. Second, I also ditched grid.sass and grid.css, because those files provide access to styles designated with presentational class names, for example: &#8216;.container_12&#8242;, &#8216;.grid_4&#8242;, etc. Next, as learning exercise, I converted my variation on Eric Meyer&#8217;s CSS reset to Sass. Finally, I set up an application.sass file, being sure to include the 960 API and Compass&#8217;s clearfix module.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #a1a100;">@import compass/utilities/general/clearfix.sass</span>
<span style="color: #a1a100;">@import 960/grid.sass</span></pre></div></div>

<p>Ok, cool. I had some Sass files, but where were my CSS files? Simply enough, I had to run Compass to generate them.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ compass
   exists stylesheets
  compile src<span style="color: #000000; font-weight: bold;">/</span>application.sass
identical stylesheets<span style="color: #000000; font-weight: bold;">/</span>application.css
  compile src<span style="color: #000000; font-weight: bold;">/</span>reset.sass
identical stylesheets<span style="color: #000000; font-weight: bold;">/</span>reset.css</pre></div></div>

<p>Manually regenerating your CSS files everytime you make a change is burdensome. Compass can be run as a process that detects changes to your source files and automatically regenerates your css. I&#8217;ve found that leaving this process running in its own shell is useful so I can keep an eye on the Sass log for parsing errors.</p>
<p>So I ran compass as a daemon to forgo manual re-generation:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ compass <span style="color: #660033;">--watch</span></pre></div></div>

<p>Great. Setting up a basic Compass project went off with out a hitch. I added in the remaining requisite files &#8212; an index page and the jQuery javascript library &#8212; and was ready to&#8230; Oh wait, what am I building?!</p>
<h4>Using 960&#8242;s handy design resources to brainstorm &#8216;The Obscurantist&#8217; daily newspaper</h4>
<p>Because my whole endeavor was motivated by an intuitive yearning for transparent and easily interpretable semantic information, I decided to tip a hat to my favorite muse, Bittersweet Irony, and design a newspaper that had but one purpose &#8211; proffering the opaque and the impenetrable. Enter, The Obscurantist! As newspapers traditionally adhere to very strict grid layouts, the Obscurantist would allow me to learn the basics of the 960 framework.</p>
<p>In my view, some of the most useful resources provided by the 960 framework are the sketchsheets and grid templates. The sketchsheets were great for quickly thumbnailing rough ideas.</p>
<p>Here&#8217;s an example of a sketchsheet, marred only by my attempt at artistic expression:</p>
<div id="attachment_362" class="wp-caption alignnone" style="width: 310px"><a href="http://blog.carbonfive.com/wp-content/uploads/2009/03/obscurantist_sketch.jpg"><img class="size-medium wp-image-362" title="obscurantist_sketch" src="http://blog.carbonfive.com/wp-content/uploads/2009/03/obscurantist_sketch.jpg" alt="Example usage of the 960 frameworks 16-grid sketchsheet" width="300" height="218" /></a><p class="wp-caption-text">Example usage of the 960 framework</p></div>
<p>16 columns was overkill, so I decided to fire up Illustrator and utilize 960&#8242;s Illustrator 12-column grid template as a background layer to help me lay out my page design. (960 comes with a range of templates catering to the most prominent graphics programs.)</p>
<p>Here&#8217;s the final design:</p>
<div id="attachment_380" class="wp-caption alignnone" style="width: 310px"><a href="http://blog.carbonfive.com/wp-content/uploads/2009/03/ai-960-layout.png"><img class="size-medium wp-image-380" title="ai-960-layout" src="http://blog.carbonfive.com/wp-content/uploads/2009/03/ai-960-layout.png" alt="The Obscurantist Illustrator layout using a 960 template file as background layer" width="300" height="187" /></a><p class="wp-caption-text">The Obscurantist Illustrator layout using a 960 template file as background layer</p></div>
<h4>Mark It Up</h4>
<p>The next step was converting my design to semantic and valid XHTML. This post is already long enough, so I won&#8217;t bore you with the details. Suffice it to say, I tried my best not to let presentational concerns influence my markup. By keeping things as semantic as possible, I set the stage for seeing how well Compass would facilitate leveraging 960&#8242;s layout structure in spite of the framework&#8217;s presentational class names. Feel free to pop open firebug and check out the <a title="The Obscurantist: An example Compass-960 layout" href="http://labs.carbonfive.com/compass_example">The Obscurantist&#8217;s</a> markup for yourself.</p>
<h4>Stylin&#8217; with Sass, 960 degrees o&#8217; heat, straight sexified son!</h4>
<p>The next step was to implement my 12-column grid layout in application.sass. As I had already designed The Obscurantist in Illustrator using the 960 grid template as a backdrop, coding up the grid was very straight forward. It turns out I can count to twelve, so I was in good shape. I&#8217;ve included the relevant aspects of application.sass below. Read it over, and below I&#8217;ll explain Compass&#8217;s 960 API in more detail.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #a1a100;">@import compass/utilities/general/clearfix.sass</span>
<span style="color: #a1a100;">@import 960/grid.sass</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* ...omitted for brevity... */</span>
&nbsp;
<span style="color: #cc00cc;">#container</span>
  <span style="color: #00AA00;">+</span>grid-container
  <span style="color: #00AA00;">+</span>clearfix
&nbsp;
  <span style="color: #6666ff;">.title</span>
    <span style="color: #00AA00;">+</span>grid<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">12</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">12</span><span style="color: #00AA00;">&#41;</span>
&nbsp;
  <span style="color: #6666ff;">.publication-info</span>
    <span style="color: #00AA00;">+</span>grid<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">12</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">12</span><span style="color: #00AA00;">&#41;</span>
    <span style="color: #6666ff;">.volume</span>
      <span style="color: #00AA00;">+</span>grid<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">12</span><span style="color: #00AA00;">&#41;</span>
      <span style="color: #00AA00;">+</span>alpha
    <span style="color: #6666ff;">.date</span>
      <span style="color: #00AA00;">+</span>grid<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">8</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">12</span><span style="color: #00AA00;">&#41;</span>
    <span style="color: #6666ff;">.number</span>
      <span style="color: #00AA00;">+</span>grid<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">12</span><span style="color: #00AA00;">&#41;</span>
      <span style="color: #00AA00;">+</span>omega
&nbsp;
   <span style="color: #cc00cc;">#article</span>
    <span style="color: #00AA00;">+</span>grid<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">12</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">12</span><span style="color: #00AA00;">&#41;</span>
    <span style="color: #6666ff;">.body</span>
      <span style="color: #00AA00;">+</span>grid<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">7</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">12</span><span style="color: #00AA00;">&#41;</span>
      <span style="color: #00AA00;">+</span>alpha
    <span style="color: #6666ff;">.captioned-photo</span>
      <span style="color: #00AA00;">+</span>grid<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">12</span><span style="color: #00AA00;">&#41;</span>
      <span style="color: #00AA00;">+</span>omega
&nbsp;
  <span style="color: #cc00cc;">#sidebar</span>
    <span style="color: #00AA00;">+</span>grid<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">12</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">12</span><span style="color: #00AA00;">&#41;</span>
    img
      <span style="color: #00AA00;">+</span>grid<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">12</span><span style="color: #00AA00;">&#41;</span>
      <span style="color: #00AA00;">+</span>alpha
    <span style="color: #6666ff;">.body</span>
      <span style="color: #00AA00;">+</span>grid<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">7</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">12</span><span style="color: #00AA00;">&#41;</span>
      <span style="color: #00AA00;">+</span>omega
&nbsp;
  <span style="color: #cc00cc;">#tagline</span>
    <span style="color: #00AA00;">+</span>grid<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">12</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">12</span><span style="color: #00AA00;">&#41;</span></pre></div></div>

<ul>
<li> &#8216;+grid-container&#8217; establishes the overall 960px wide centered layout</li>
<li> &#8216;+grid(m, n)&#8217; assigns an element a width based on the number of columns(m) it should take up with respect to a number of total colums(n)</li>
</ul>
<p><em>Keen readers will notice that while the 960 grid system supports only 12 and 16 column layouts, +grid(m,n) is a method call which supports <strong>any</strong> number of columns. That&#8217;s right, Compass provides a <strong>completely customizable</strong> 960 pixel wide layout. The various column widths are calculated when Sass generates your CSS. (More on this below.)</em></p>
<p>So what about this ominous sounding &#8220;Alpha&#8221; and &#8220;Omega&#8221; business? As it happens, the 960 framework defines a gutter of 20px, each neighboring element contributing a 10 pixel margin to the overall gutter. Therefore, there will be a 10 pixel margin on the left and right hand sides of the overall grid container, constituted by the left side of the first element in a row and the right side of the last element in a row. (Check out <a title="The Obscurantist: An example Compass-960 layout" href="http://labs.carbonfive.com/compass_example">The Obscurantist</a> in Firebug for a better understanding.)</p>
<p>But, what happens if you are nesting grid elements? In that case you don&#8217;t want the child to re-contribute 10 pixels of outside margin, as the parent element already took care of this. What do you do? Simply demarcate the left most nested element as the &#8216;Alpha&#8217; and the right most nested element as the &#8216;Omega&#8217;. Doing so will remove the outside margins and your grid layout will remain locked in place.</p>
<p>One additional note, the container element has had a clearfix applied to it, so that it will expand to<br />
contain its floated child elements. This allowed me to attach 960&#8242;s 12-column grid image as a background to ensure my layout exactly matched my mockup.</p>
<h4>The end has come: Sexiness &#8211; attained. Coolness &#8211; attained. Craziness &#8211; Why not?</h4>
<p>The end result &#8211; <a title="The Obscurantist: An example Compass-960 layout" href="http://labs.carbonfive.com/compass_example">The Obscurantist</a>. You can toggle the 12-column grid background using the button in the upper right-hand corner.</p>
<p>I&#8217;m sold. Compass successfully allowed to me attain my goal: overall clean, minimal, and semantic markup and a rigid adherence to an underlying grid-system.</p>
<p>Finally, the example site is up on github, feel free to peruse it if you need a more comprehensive view of the working parts.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ git clone git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>aaronsbrown<span style="color: #000000; font-weight: bold;">/</span>obscurantist.git</pre></div></div>

<h3>Final Thoughts and Takeaways</h3>
<ul>
<li>My background is in server-side software development and therefore the client-side space and its attendant technologies are relatively new to me. Before I experimented with Sass, I took it for granted that styling presentation via CSS was categorically a different process than developing software. But Sass directly counters my assumption. And even though I no longer directly write CSS when coding with Sass, its DSL makes me feel right at home when describing my presentational styles. Most importantly, Sass gives me the ability to bring my software engineering practices to bear in the presentational realm. I can&#8217;t help but think this is a big deal.
<p>However, I will say getting comfortable with &#8220;programmatic&#8221; CSS took a bit of mental re-orientation. I was used to having all my style definitions right in front of me, explicit and clear. Yet Sass, especially when coupled with Compass, introduces to the CSS space welcomed notions of abtraction, like modularity and encapsulation. As such, things are no longer directly in front of me. Rather, I have to approach coding CSS with the mindset of using libraries. So i have to fire up the docs (in this case the 960 plug-in Sass code), see what resources the library provides, and then determine the best use of those resources. Again, I go through this process daily when writing application code, but it felt a little awkward when first incorporating this practice in the CSS space. But once I began approaching coding my presentation layer like any other programming task, things immediately fell into place. Also, because the end product of the Sass work cycle is CSS, I had ready access to those files if I wanted want to see what was being sent to the client. And since I use Firebug as my main debugging tool, my approach to debugging the presentation layer didn&#8217;t have to change at all. </li>
<li>I think that for small personal and professional projects Sass and Compass will help streamline CSS development. The ability to modularize and re-use code is a big win in terms of best practices and efficiency. It can also help maintain consistency throughout the code base. I think the tool would even be useful in large-scale organizations where the developers share similar values and engineering practices, and whom are disciplined enough to learn and use the Sass/Compass libraries.
<p>I&#8217;m perhaps a bit more skeptical about the promise of Compass to distribute reusable CSS plug-ins throughout larger engineering ecosystems. While there are surely commonplace CSS problems, I think the idiosyncratic nature of website design will at some point outweigh the ability for large scale CSS reuse. But, I do hope I am wrong on this point, as I feel Compass&#8217;s aims and values are admirable. Time will tell.</li>
<li>There is one big concern I have with respect to using Compass to maintain semantics, and it concerns optimization. The Sass &#8216;mixin&#8217; model basically inlines style attributes (from, for example, 960) into your own custom CSS. The (potential) downside of this is lots of duplicated CSS rules in Sass&#8217;s <em>generated end product</em>. How might this model impact the file size of my custom CSS? And how to weigh this increase in file size against the benefits Sass and Compass bring to the development side of things? Are we sacrificing consumer performance for producer best practices? I don&#8217;t have an answer to this question. If anyone out there can speak to this issue, I&#8217;d love to hear your thoughts.
<p>If I have time, I would like to implement The Obscurantist with only the 960 framework, sans Compass, and compare the resulting CSS. I&#8217;ll just have to stomach presentation class names in my markup for the sake of enlightenment.</li>
<li>Given the programmatic nature of Sass, the Compass port of the 960 framework is extremely customizable. In effect,you get an API to generate a grid of N columns, each separated by a configurable gutter, that all together span 960 pixels. For example, let&#8217;s say you want to create a layout that is 960 px wide and comprises 5 columns separated by 10 pixel gutters. It&#8217;s pretty easy:

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #a1a100;">@import 960/grid.sass</span>
&nbsp;
!ninesixty_gutter_width <span style="color: #00AA00;">=</span> <span style="color: #933;">10px</span>
&nbsp;
<span style="color: #cc00cc;">#container</span>
  <span style="color: #00AA00;">+</span>grid-container
  <span style="color: #cc00cc;">#main-content</span>
    <span style="color: #00AA00;">+</span>grid<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">4</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">5</span><span style="color: #00AA00;">&#41;</span>
  <span style="color: #cc00cc;">#nav</span>
    <span style="color: #00AA00;">+</span>grid<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">5</span><span style="color: #00AA00;">&#41;</span></pre></div></div>

<p>I encourage you to dig into the 960 plug-in&#8217;s Sass files to see what other things you can tweak.</li>
<li>More generally, there seems to be a growing number of Compass modules available. Some modules come installed with Compass, while others are available as plug-ins. Therefore, you can pick and choose from various CSS frameworks as the need arises. Say you love 960&#8242;s approach to grid layouts but you prefer Blueprint&#8217;s typographic standards. Well, Compass allows you to selectively incorporate mixins from both frameworks. And since you don&#8217;t have to rely on the frameworks&#8217; class definitions you remain in full control of your semantics.</li>
<li>And finally, a few words about the 960 CSS framework. I&#8217;ll be honest, when all was said and done, I thought &#8211; &#8220;All this for some width and margin definitions? I could have come up with that on my own with not much effort. It all seems pretty simple.&#8221; But part of me thinks such a reaction reflects, perhaps ironically, rather well on a framework. 960 does one thing-it helps  you execute a grid layout rapidly, easily, and with little preparation. It doesn&#8217;t get in your way and simply optimizes and enhances your work-flow. And while it makes grid layouts <em>seem</em> intuitive and transparent, I&#8217;m quite sure there are subtleties hidden away that I&#8217;m not taking into account with my cursory ascription of, &#8220;That seems pretty simple.&#8221; So I&#8217;m perfectly happy leveraging the hard work of people who have spent more time focusing on grid layouts and spending my time concentrating on other aspects of my project.
<p>Also, and perhaps most importantly for me, the 960 framework sports the following tagline: &#8220;Sketch, Design, Code.&#8221; As I hope this article has demonstrated, I was able to utilize 960&#8242;s resources starting with the brainstorming phase (via sketchseets), during the design phase (via grid templates), and finally throughout the implementation phase (via the grid template background images and the Compass plug-in). In short, 960 provides helpful resources that can, and I would argue should, be used from project inception to project end.</li>
</ul>
<p>In summary, if you want to leverage CSS frameworks while maintaining the semantic purity of your markup, take a moment to check out Compass. I think you&#8217;ll find it opens up a great new space of possibility.</p>
<h4>Resources:</h4>
<ul>
<li><a title="Compass framwork at Github" href="http://wiki.github.com/chriseppstein/compass/getting-started">Compass Framework at Github</a></li>
<li><a title="Compass Primer" href="http://acts-as-architect.blogspot.com/2008/11/compass-primer.html">Compass Primer</a></li>
<li><a title="Compass 960 plug-in" href="http://github.com/chriseppstein/compass-960-plugin/tree/master">Compass 960 plug-in</a></li>
<li><a title="Compass mailing list" href="http://groups.google.com/group/compass-users">Compass mailing list</a></li>
<li><a title="Sass" href="http://haml.hamptoncatlin.com/docs/rdoc/classes/Sass.html">Sass</a></li>
<li><a title="The 960 CSS Framework" href="http://960.gs">The 960 CSS Framework</a></li>
<li><a title="The Grid System" href="http://www.thegridsystem.org/">The Grid System</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.carbonfive.com/2009/03/html/compass-960-semantics/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Agile User Experience (UX) Resources</title>
		<link>http://blog.carbonfive.com/2007/09/flexflash/agile-user-experience-ux-resources</link>
		<comments>http://blog.carbonfive.com/2007/09/flexflash/agile-user-experience-ux-resources#comments</comments>
		<pubDate>Thu, 06 Sep 2007 23:12:19 +0000</pubDate>
		<dc:creator>alon</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Flex/Flash]]></category>
		<category><![CDATA[Rescue Mission]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[sxsw]]></category>

		<guid isPermaLink="false">http://blog/?p=17</guid>
		<description><![CDATA[For the seven years that we have been evolving our Extreme Programming practice, we have repeatedly readdressed the question of how to best integrate user experience design (visual design, information architecture,&#8230;) with an agile process. As a consulting company, it has always been a requirement that we flex our process to accommodate our clients and [...]]]></description>
			<content:encoded><![CDATA[<p>For the seven years that we have been evolving our Extreme Programming practice, we have repeatedly readdressed the question of how to best integrate user experience design (visual design, information architecture,&#8230;) with an agile process. As a consulting company, it has always been a requirement that we flex our process to accommodate our clients and partners. Over the last year or two we have found our clients and partners increasingly interested in flexing their processes to work more agile and collaboratively with us.</p>
<p>The post is the first of a series on user experience (UX) design practices for agile software development teams. In an upcoming project with our partner Hot Studios we will be exploring new ways to integrate their user experience design process with our software development process. We&#8217;ll share some learnings from that, experiences from the past and new ideas for the future.</p>
<p>First we have a growing reading list of existing resources on the topic that I am posting here for you. If you have other resources for us, please share.</p>
<p><a href="http://timiti.blogspot.com/2008/02/user-research-as-commodity.html">User Research as a Commodity</a><br />
<i>Added 2008-02-14</i><br />
Alex at Pivotal Labs <a href="http://pivots.pivotallabs.com/users/alex/blog/articles/400-user-research-as-a-commodity">noted this post</a> from a user experience manager at Kaiser Permanente who describes a strategy for including regular user testing in an agile development process. The strategy is attractive because it fits with a key characteristic of agile where simple practices performed regularly produce high level complex results.</p>
<p><a href="http://web.archive.org/web/20070313205440/http://www.fawcette.com/interviews/beck_cooper/">Kent Beck v. Alan Cooper</a><br />
This is a 2002 article with the following abstract &#8220;Kent Beck is known as the father of &#8216;extreme programming,&#8217; a process created to help developers design and build software that effectively meets user expectations. Alan Cooper is the prime proponent of interaction design, a process with similar goals but different methodology. We brought these two visionaries together to compare philosophies, looking for points of consensus—and points of irreconcilable difference.&#8221; The difference in perspective between the two is very expressive of the conflicts we have seen between design and agile development processes. Many of the following resources reference this discussion.</p>
<p><i>Note: the original source for this great interview appears to have been taken over by another entity that is no longer making the article available. I am linking to it in the <a href="http://www.archive.org">Internet Archive</a>.</i></p>
<p><a href="http://www.disambiguity.com/waterfall-bad-washing-machine-good-ia-summit-07-slides/">Waterfall Bad, Washing Machine Good</a><br />
Leisa Reichelt&#8217;s IA Summit 07 presentation on the role of IA in the design process identifies the failures of a waterfall design process and argues that an agile, iterative design process is superior. Slide 14 is right on.</p>
<p><a href="http://www.agilemodeling.com/essays/agileUsability.htm">User Experience Activities on Agile Development Projects</a><br />
Recent article by Scott Ambler addresses the gap between Beck and Cooper by identifying a middle ground that requires UX and agile practitioners to learn a bit more about each others&#8217; practices and to adopt some of each.</p>
<p><a href="http://agileproductdesign.com/blog/index.html">Holistic Product Design &amp; Development</a><br />
A series of blog posts by Jeff Patton on agile software development and user centered design. Jeff moderates the <span class="nobr"><a href="http://tech.groups.yahoo.com/group/agile-usability/">agile-usability Yahoo group</a></span>.</p>
<p><a href="http://tech.groups.yahoo.com/group/agile-usability/">Agile Usability Yahoo! Group</a><br />
The description for this group provides a good summary of the issues we are tackling here. You are invited to jump into the fray.</p>
<p><a href="http://www.agilelogic.com/files/ExperiencesIntegratingUEDPractices.pdf">Experiences Integrating UED Practices</a><br />
In this experience report Paul Hodgetts presents his &#8220;teams&#8217; struggles to come to grips with the often programming-centric orientation of agile processes, and their ongoing efforts to integrate their UED (user experience design) best practices into the incremental, collaborative world of agile processes.&#8221; He provides an overview to the range of UX practices, identifies challenges and discusses practices that he found were particularly useful in integrating UX and and agile development.</p>
<p><a href="http://lists.interactiondesigners.com/htdig.cgi/discuss-interactiondesigners.com/2004-March/001083.html">Agile User-Centered Design</a><br />
A post to ID-discuss that presents one designer&#8217;s struggle to reconcile agile and user-centered design.</p>
<p><a href="http://www.foruse.com/articles/agiledesign.pdf">Process Agility and Software Usability: Toward Lightweight Usage-Centered Design</a><br />
2001 paper by Larry Constantine presents concrete practices for UX that map to agile practices. His approach is simple and pragmatic.</p>
<p><a href="http://www.slideshare.net/theinfonaut/are-agile-projects-doomed-to-halfbaked-design/">The Challenge of Agile Design</a><br />
These are slides from a talk given by our friends at Pivotal Labs and Satisfaction.</p>
<p><a href="http://agiletoolkit.libsyn.com/index.php?post_id=15584">User Centered Design Round Table</a><br />
Podcast of a discussion on user-centered design and agile development with Lynn Miller, Jeff Patton and Rebecca Wirfs-Brock.</p>
<p><i>Originally posted 2007-09-06</i><br />
<i>Last updated 2008-02-14</i></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.carbonfive.com/2007/09/flexflash/agile-user-experience-ux-resources/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
