<?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>Marked As Pertinent &#187; jquery</title>
	<atom:link href="http://bjclark.me/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://bjclark.me</link>
	<description>rails, design, art, business by BJ Clark</description>
	<lastBuildDate>Wed, 28 Jul 2010 21:51:09 +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>Writing &quot;Scaleable&quot; JQuery &#8211; Shu</title>
		<link>http://bjclark.me/2009/12/writing-scaleable-jquery-shu/</link>
		<comments>http://bjclark.me/2009/12/writing-scaleable-jquery-shu/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 04:41:50 +0000</pubDate>
		<dc:creator>BJ Clark</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[craftsmanship]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[scaleable code]]></category>
		<category><![CDATA[scaling]]></category>
		<category><![CDATA[shuhari]]></category>

		<guid isPermaLink="false">http://bjclark.me/?p=86</guid>
		<description><![CDATA[Recently, I&#8217;ve been thinking a lot about what it means to do really great front end development (HTML, Javascript, CSS). And, one of the key issues things I keep hitting upon is writing &#8220;scaleable&#8221; front end code. I use the word scaleable in a couple ways: Writing code well in a way that you could [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I&#8217;ve been thinking a lot about what it means to do really great front end development (HTML, Javascript, CSS). And, one of the key issues things I keep hitting upon is writing &#8220;scaleable&#8221; front end code. I use the word scaleable in a couple ways:</p>
<ol>
<li>Writing code well in a way that you could keep adding developers and they could each increase productivity linearly.</li>
<li>Writing code that will work for increasingly larger sites.</li>
<li>Writing code that is maintainable, testable, and extendable.</li>
</ol>
<p>I know others have thought about this, some people call it &#8220;best practices&#8221;, some people call it frameworks, Yahoo even went as far as to create the YUI family of libraries. I think deep down, most people were trying to think about how to &#8220;scale&#8221; whatever it was they were doing.  This entry is the first in a series of writing jQuery code that &#8220;scales&#8221;.</p>
<p>Another thing I probably need to address before we get started is &#8220;Shu&#8221;. It comes from the Japanese phrase &#8220;<a href="http://en.wikipedia.org/wiki/Shuhari" target="_blank">Shuhari</a>&#8220;, which I learned from Alistair Cockburn and is common in the Agile circles, and &#8220;describes the stages of learning to mastery&#8221;. Once you&#8217;re aware that there are certain levels of mastery of something, you start asking yourself which level you&#8217;re at and what level others are.</p>
<p>JQuery is awesome, and I love it. For along time, I treated javascript as a 2nd class citizen, but I&#8217;ve recently been really digging into it and making it &#8220;scaleable&#8221;.</p>
<p>In Dan Cederholm&#8217;s recent book, he introduces some jQuery that I&#8217;m lumping into the &#8220;Shu&#8221; box (ba-da ching!).<br />
<code><br />
$(document).ready(function(){<br />
$("#loc-adv a").click(function(){<br />
$("#map").slideToggle("slow");<br />
return false;<br />
});<br />
});</code></p>
<p>Now don&#8217;t get me wrong, this code is perfectly acceptable, especially for the situation it&#8217;s presented in (a small, static site, built by 1-2 developers). I&#8217;m all for not complicating things if they don&#8217;t need to be. This code is the simplest thing that could possibly work, and that&#8217;s <em>awesome</em>. However, we&#8217;re talking about scaling javascript up to larger sites, more developers, and maintainable in legacy applications, and there are some things about this code which don&#8217;t make it very scaleable.</p>
<p>First, it&#8217;s not really re-useable. Sure, you could include it in any page that has the `#loc-adv` a link and a map, and it&#8217;s going to work, but what if  you needed multiple maps in one page or had multiple links. All of a sudden, you&#8217;re going to need to repeat yourself, and we don&#8217;t do that.</p>
<p>Second, if you put this right in your page, as it&#8217;s presented in the book, you can&#8217;t use it on other pages without repeating yourself. Maintaining this code could be painful if you put it in more than one page.</p>
<p>Third, the only way this code is going to fire is if you click the link. There&#8217;s no way to call it from other code, or test it, and you&#8217;ll have to attach it to multiple elements if you add another link or some other element that needs to reveal the map.</p>
<p>What if you want to link to the page with the map open? This code won&#8217;t account for that.</p>
<p>I&#8217;m not going to address all these issues in this post. I&#8217;m going to leave that up for the &#8220;Ha&#8221; and &#8220;Ri&#8221; posts. Look for them in a couple days.</p>
]]></content:encoded>
			<wfw:commentRss>http://bjclark.me/2009/12/writing-scaleable-jquery-shu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails App Template</title>
		<link>http://bjclark.me/2009/08/rails-app-template/</link>
		<comments>http://bjclark.me/2009/08/rails-app-template/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 04:14:19 +0000</pubDate>
		<dc:creator>BJ Clark</dc:creator>
				<category><![CDATA[BDD]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[960gs]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rails template]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://bjclark.me/?p=34</guid>
		<description><![CDATA[I start a lot of projects. More than I&#8217;d like to admit. I finish and deploy very few, but I like cranking out the first iteration of an app in a weekend. Sometimes I do it just to learn some new feature, or try out an architecture idea. I don&#8217;t like to do this in [...]]]></description>
			<content:encoded><![CDATA[<p>I start a lot of projects. More than I&#8217;d like to admit. I finish and deploy very few, but I like cranking out the first iteration of an app in a weekend. Sometimes I do it just to learn some new feature, or try out an architecture idea. I don&#8217;t like to do this in the context of whatever existing app I&#8217;m working on, because I don&#8217;t want any baggage of whatever I was thinking last week. Last week is too long ago.</p>
<p><span id="more-34"></span></p>
<p>I&#8217;ve had this technique validated by my former boss Ward Cunningham. He (famously) worked with Kent Beck at Tektronix and they were research partners. During this time, they came up with lots of really great ideas, design patterns, and methodologies. And the technique they used for exploration went something like this (paraphrased from Ward):</p>
<blockquote><p>Kent and I would get to work in the morning, and we&#8217;d just start writing code. If it went well, we might right code all morning and maybe all day. If it went really well, we&#8217;d work on the same project all week and get something great out. Usually these ideas then got turned over to other teams to keep working on.</p>
<p>But usually, these ideas didn&#8217;t work out very well. So we&#8217;d stop at lunch, throw it all away, and work on whatever we were supposed to be working on.</p>
<p>The next morning, we would both show up and Kent would usually say &#8220;I have an idea on that thing we were working on yesterday&#8221; and off we&#8217;d go.</p></blockquote>
<p>Great things came out of this, TDD, some notable design patterns, and really XP.</p>
<p>The thing that holds me back from doing this more, is that frankly, it&#8217;s a pain in the ass to get all the basics in a rails app installed. Just to do anything, I usually like to have Rspec, rspec-rails, cucumber, authlogic, jquery, 960gs, and a handful of other plugins and libraries installed. They all need to be configured, databases need to be set up, etc.</p>
<p>Worst of all, most things need authentication, you know, so that you can actually have users. That means you need sign up, login, activation, password resets, emails, the list goes on.</p>
<p>Where am I going with this? Well, the ability to generate rails apps via custom templates was added in Rails 2.2. So I took it upon myself to stop shaving small yaks every time I wanted to hack on a new project and shave a big one. I present, <a href="http://github.com/BJClark/rails-templates/blob/d8889e1c771847f75641503e478c130e959e1686/scidept.rb" target="_blank">the science department rails template</a>.</p>
<pre>rails my_app -d postgresql -m http://github.com/BJClark/rails-templates/blob/d8889e1c771847f75641503e478c130e959e1686/scidept.rb</pre>
<p>Run this little command, answer 3 questions, change 1 line of code, and run</p>
<pre> rake spec &amp;&amp; rake features</pre>
<p>You now have a fully implemented and tested, rails/rspec/cucumber/authlogic/resource_controller/lesscss/jquery/960gs app, with signup, login, and password resets, checked into git and ready to hack.</p>
<p>Hack, fork, and profit!</p>
]]></content:encoded>
			<wfw:commentRss>http://bjclark.me/2009/08/rails-app-template/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.344 seconds -->
