<?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; scaleable code</title>
	<atom:link href="http://bjclark.me/tag/scaleable-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://bjclark.me</link>
	<description>rails, design, art, business by BJ Clark</description>
	<lastBuildDate>Mon, 23 Jan 2012 23:04:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.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>
	</channel>
</rss>

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

