<?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>jonathanjulian.com</title>
	<atom:link href="http://jonathanjulian.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanjulian.com</link>
	<description>Ruby, Rails, JavaScript, software development</description>
	<lastBuildDate>Wed, 30 Jun 2010 21:40:38 +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>Proof that I was at JSConf 2010: Hangover.js</title>
		<link>http://jonathanjulian.com/2010/06/proof-that-i-was-at-jsconf-2010-hangover-js/</link>
		<comments>http://jonathanjulian.com/2010/06/proof-that-i-was-at-jsconf-2010-hangover-js/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 21:40:38 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[Animal-print robe]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://jonathanjulian.com/?p=247</guid>
		<description><![CDATA[At 9am on Sunday, the folks that needed an easy start to their jsconf day 2 witnessed Hangover.js. I live-coded a simple lightbox, and a simple textarea character counter. The lights were low, the vibe was chill and relaxed. The code that was committed during the session can be found at 
http://github.com/jjulian/hangover_js_examples.

Thanks to those that [...]]]></description>
			<content:encoded><![CDATA[<p>At 9am on Sunday, the folks that needed an easy start to their jsconf day 2 witnessed Hangover.js. I live-coded a simple lightbox, and a simple textarea character counter. The lights were low, the vibe was chill and relaxed. The code that was committed during the session can be found at 
<a href="http://github.com/jjulian/hangover_js_examples">http://github.com/jjulian/hangover_js_examples</a>.</p>

<p>Thanks to those that hung out with me and helped me code these features (if I remember correctly, <a href="http://twitter.com/rektide">@rektide</a>, <a href="http://twitter.com/getify">@getify</a>, <a href="http://twitter.com/vinylfox">@vinylfox</a>)&#8230;and thanks to Track B for allowing non-mind-melting sessions <em>cough</em>sproutcore<em>cough</em> to be scheduled after a long night of pirate cruise swashbuckling!</p>

<p><embed src="http://blip.tv/play/g_MngemHQwI" type="application/x-shockwave-flash" width="480" height="346" allowscriptaccess="always" allowfullscreen="true"></embed></p>

<div style="width:425px" id="__ss_3791439"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/jonathanjulian/hangoverjs" title="Hangover.js">Hangover.js</a></strong><object id="__sse3791439" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=hangover-js-100420121318-phpapp02&#038;stripped_title=hangoverjs" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed name="__sse3791439" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=hangover-js-100420121318-phpapp02&#038;stripped_title=hangoverjs" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object><div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/jonathanjulian">Jonathan Julian</a>.</div></div>
]]></content:encoded>
			<wfw:commentRss>http://jonathanjulian.com/2010/06/proof-that-i-was-at-jsconf-2010-hangover-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RubyNation 2010</title>
		<link>http://jonathanjulian.com/2010/04/rubynation-2010/</link>
		<comments>http://jonathanjulian.com/2010/04/rubynation-2010/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 14:02:07 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jonathanjulian.com/?p=216</guid>
		<description><![CDATA[This past weekend was fun-filled with geekyness in the DC area! Here are a few of my favorite sessions and thoughts from RubyNation 2010.

Grease Your Suite by Nick Gauthier: Nick killed it with his presentation on how he used all sorts of optimizations to get his project&#8217;s test suite from 13 minutes down to less [...]]]></description>
			<content:encoded><![CDATA[<p>This past weekend was fun-filled with geekyness in the DC area! Here are a few of my favorite sessions and thoughts from <a href="http://www.rubynation.org/">RubyNation</a> 2010.</p>

<p><a href="http://grease-your-suite.heroku.com/">Grease Your Suite</a> by <a href="http://twitter.com/ngauthier">Nick Gauthier</a>: Nick killed it with his presentation on how he used all sorts of optimizations to get his project&#8217;s test suite from 13 minutes down to less than 30 seconds. Wow! Presentation style was fun and playful, while still being hardcore and informative (optimizing the filesystem? whoa). I&#8217;m really glad this talk was inserted, and wished more people could have seen it.</p>

<p><a href="http://pure-rspec-scotruby.heroku.com/">Pure RSpec</a> by <a href="http://blog.l4rk.com/">John Larkowski</a>: This talk was all about rspec syntax, and how to make your tests read better. I really dig this type of talk, since I always come away with a dozen new tips to integrate into my code right away.</p>

<p><strong>Git Guts</strong> by <a href="http://www.nearinfinity.com/home/bios/jeff_kunkle.html">Jeff Kunkle</a>: Oh man, Jeff unleashed all the crazy details about internal git objects and trees within the first 3 minutes. This was not just a discussion of the <a href="/2009/08/basic-git/">basic git</a> commands! This was all about how git works under the covers. Not surprisingly, there were plenty of questions and discussions at the end. Maybe git workflow with branches and merging and rebasing is something we should talk about publicly more often.</p>

<p><a href="http://cloud.github.com/downloads/russolsen/presentations/InsideRuby-1.pdf">Looking Inside Your Ruby Implementation</a> by <a href="http://jroller.com/rolsen/">Russ Olsen</a>: &#8220;How many of you are comfortable with C programming?&#8221; Russ asked. Heh. He went on to take us on a tour of the C code behind <code>puts</code>. Then he took us through the jRuby implementation too! Unique and informative.</p>

<p><a href="http://www.scribd.com/doc/27174770/Garbage-Collection-and-the-Ruby-Heap">Garbage Collection and the Ruby Heap</a> by <a href="http://timetobleed.com/">Joe Damato</a> and <a href="http://twitter.com/tmm1">Aman Gupta</a>: I heard this described this as &#8220;if you work with Ruby, you <em>gotta</em> go to this one&#8221;. It reminded me of a talk I saw at JavaOne way back when about the Java gc. Very detailed.</p>

<p>Sadly, I lollygagged back from lunch on Friday and missed <a href="http://smartlogicsolutions.com/john">John Trupiano</a> presenting <a href="http://i-dont-trust-your-code.heroku.com/">I Don&#8217;t Trust Your Code</a> which contains excellent details about how gem maintainers should structure, build, and manage public gems. Excellent advice! This presentation, as well as a few others this weekend, were built with <a href="http://github.com/schacon/showoff">showoff</a>. It&#8217;s easy to use:</p>

<pre><code>gem install showoff
git clone git://github.com/jtrupiano/i_dont_trust_your_code.git
cd i_dont_trust_your_code
showoff serve
</code></pre>

<p>Now open a browser to http://localhost:9090, and right-arrow through the slides!</p>

<p><a href="http://github.com/jcasimir/teach_anything">How to Teach Anything to Anyone, Even Your Dev Team</a> by <a href="http://twitter.com/j3">Jeff Casimir</a>: Jeff says he wishes he could speak like Dave Thomas&#8230;I say, I wish I could speak like Jeff. This was a non-technical and inspirational presentation of some of the basic concepts of teaching. Using books, graphs, and statistics, Jeff took us through the various ways people learn, especially highlighting the &#8220;gradual release of responsibility principle&#8221;. If I had to pick a favorite talk from the weekend, this would be it. <em>&#8220;I do, we do, you do&#8221;</em>, Jeff.</p>

<p><strong>Blocks, Procs and Lambdas, Oh My! Functional Programming in Ruby</strong> by <a href="http://paulbarry.com/">Paul Barry</a>: Out of my colleagues, Paul holds the title of &#8220;The Language Mayor&#8221;. During this talk, he showed us some &#8220;functional&#8221; programming constructs and how they can be applied to Ruby as well as other languages such as Clojure. Rich with syntax and details.</p>

<p><a href="http://www.scribd.com/doc/15336842/Rails-in-the-Large-How-Were-Developing-the-Largest-Rails-Project-in-the-World">Rails in the Large</a> by <a href="http://www.nealford.com/">Neal Ford</a>: Other than using rock/paper/scissors to solve office dilemmas, Neal also seems to work on one of the hugest Rails projects around. 11 pairs of programmers!?! It sounds insane, and it probably is. Wow. Great insights from an &#8220;enterprise&#8221; team, including PMs, BAs, UAT, and coffee delivery services.</p>

<p><a href="http://www.rubynation.org/"><img src="http://www.rubynation.org/images/conference/badges/2010/rubyWebBadgeConference.png"/></a></p>

<p>But, as always, the real value of these local conferences is with the <em>people</em> who attend, and some of the most fun was not sitting and listening, but sitting and <em>conversing</em> and <em>working</em> and <em>learning</em>. I spent some time building an interactive Google map into a project <a href="http://twitter.com/jtrupiano">@jtrupiano</a> is working on. I hung out with <a href="http://twitter.com/nerded">@nerded</a> and learned why I should be using <a href="http://gitx.frim.nl/">gitx</a> more often. Over a beer at the RuBy-B-Q, I caught up with <a href="http://twitter.com/abatalion">@abatalion</a> and met <a href="http://twitter.com/marchdoe">@marchdoe</a>, then Paul and I owned the foosball table. I learned how <a href="http://twitter.com/bryanl">@bryanl</a> likes to set up maintenance contracts with his clients, and we both agreed that there is plenty of work in the mid-atlantic region right now for all of us. I met <a href="http://twitter.com/greggpollack">@greggpollack</a> for the first time. I talked natural database id&#8217;s with <a href="http://twitter.com/avdi">@avdi</a>. I think I convinced <a href="http://twitter.com/stevenhaddox">@stevenhaddox</a> that he can make it to more <a href="http://bmoreonrails.org">bmoreonrails</a> meetings if he brings his family! I got to meet <a href="http://twitter.com/mbleigh">@mbleigh</a> and learned about his Rack-based authentication system for twitter/oauth/facebook/etc called <a href="http://github.com/intridea/omniauth">OmniAuth</a>. Over beers in the hotel bar, I hacked on the new <a href="http://bmoreonrails.org">bmoreonrails</a> website, adding live tweets and a member roster. And the ride up and back from Baltimore with <a href="http://twitter.com/pjb3">@pjb3</a> was chock-filled with fun talk about rspec, rss readers, and rails!</p>

<p>Hopefully, I&#8217;ll have a similar experience this coming week at <a href="http://jsconf.us/2010">JSConf</a>, as well as at <a href="http://railsconf.com">Railsconf</a> this June!</p>
]]></content:encoded>
			<wfw:commentRss>http://jonathanjulian.com/2010/04/rubynation-2010/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Rails to_json or as_json?</title>
		<link>http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/</link>
		<comments>http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 17:08:36 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jonathanjulian.com/?p=187</guid>
		<description><![CDATA[A really great modification was introduced in Rails 2.3.3 &#8211; and while everyone clamored about JSON encoding speeds and C vs Ruby implementations, the blogosphere overlooked the clean separation of responsibility that was introduced.

In the &#8220;old days&#8221;, you&#8217;d override to_json in your model class to provide a JSON implementation of your model. Then in your [...]]]></description>
			<content:encoded><![CDATA[<p>A really great modification was introduced in <a href="http://weblog.rubyonrails.org/2009/7/20/rails-2-3-3-touching-faster-json-bug-fixes">Rails 2.3.3</a> &#8211; and while everyone clamored about JSON <a href="http://www.ruby-forum.com/topic/200017">encoding speeds</a> and <a href="http://flori.github.com/json/">C vs Ruby implementations</a>, the blogosphere overlooked the clean separation of responsibility that was introduced.</p>

<p>In the &#8220;old days&#8221;, you&#8217;d override <code>to_json</code> in your model class to provide a JSON implementation of your model. Then in your controller, <code>render :json =&gt; @model</code> would work perfectly. And some folks would even redundantly code <code>render :json =&gt; @model.to_json</code>, and that would work too.</p>

<p><code>to_json</code> even had some great options for ActiveRecord objects! You could tell the method to only render certain attributes, or to include associations or method calls!</p>

<pre><code>render :json =&gt; 
  @user.to_json(:only =&gt; [:email], :include =&gt; [:addresses])
</code></pre>

<p>Life was good. But things start to fall apart when you want to do something a little out of the ordinary. Like return JSON with the model as part of a bigger structure.</p>

<pre><code>render :json =&gt; { :success =&gt; true, 
  :user =&gt; @user.to_json(:only =&gt; [:email]) }
</code></pre>

<p>Oops. <code>{\"user\":{\"email\":\"me@example.com\","success":true}</code>has the JSON characters <em>escaped</em>, which is not what we want. So what do we do? We hack around it:</p>

<pre><code>render :json =&gt; { :success =&gt; true, 
  :user =&gt; { :email =&gt; @user.email } }
</code></pre>

<p>But this doesn&#8217;t scale &#8211; we have to explicitly create the JSON <em>by hand</em> in the <em>controller</em>. What if we need 5 or more attributes? Yuck!</p>

<p>Enter <strong>ActiveSupport 2.3.3</strong>. Now the <em>creation</em> of the json is separate from the <em>rendering</em> of the json. <code>as_json</code> is used to create the structure of the JSON as a Hash, and the rendering of that hash into a JSON string is left up to <a href="http://as.rubyonrails.org/classes/ActiveSupport/JSON.html"><code>ActiveSupport::json.encode</code></a>. You should never use <code>to_json</code> to <em>create</em> a representation, only to <em>consume</em> the representation.</p>

<pre><code>def as_json(options={})
  { :email =&gt; self.email }
end
</code></pre>

<p>Anytime <code>to_json</code> is called on an object, <code>as_json</code> is invoked to create the data structure, and then that hash is encoded as a JSON string using <code>ActiveSupport::json.encode</code>. This happens for all types: Object, Numeric, Date, String, etc (see <a href="http://github.com/rails/rails/tree/2-3-stable/activesupport/lib/active_support/json">active_support/json</a>).</p>

<p>ActiveRecord objects behave the same way. There is a default <code>as_json</code> <a href="http://github.com/rails/rails/blob/2-3-stable/activerecord/lib/active_record/serializers/json_serializer.rb">implementation</a> that creates a Hash that includes all the model&#8217;s attributes. <strong>You should override <code>as_json</code> in your Model to create the JSON structure you want</strong>. <code>as_json</code>, just like the old <code>to_json</code>, takes an option hash where you can specify attributes and methods to include declaratively.</p>

<pre><code>def as_json(options={})
  super(:only =&gt; [:email, :avatar], :include =&gt;[:addresses])
end
</code></pre>

<p>Your controller code to display one model should always look like this:</p>

<pre><code>render :json =&gt; @user
</code></pre>

<p>And if you have to do anything <a href="http://namxam.tumblr.com/post/396486333/rails-as-json-vs-to-json">out of the ordinary</a>, call <code>as_json</code> passing your options.</p>

<pre><code>render :json =&gt; { :success =&gt; true, 
  :user =&gt; @user.as_json(:only =&gt; [:email]) }
</code></pre>

<p>The moral of the story is: <strong>In controllers, do not call <code>to_json</code> directly, allow <code>render</code> to do that for you. If you need to tweak the JSON output, override <code>as_json</code> in your model, or call <code>as_json</code> directly.</strong></p>

<p>Fix your code now to use <code>as_json</code> &#8211; it will be one less thing to worry about when you migrate to Rails 3.</p>

<p><em>This post was inspired by the investigation I went into while exploring the answer to <a href="http://stackoverflow.com/questions/2572284/override-to-json-in-rails-2-3-5/2574900">this question on Stack Overflow</a>.</em></p>

<p><em>Hey Brian Morearty &#8211; Rails was never Javaficated to begin with. So the answer is <a href="http://bmorearty.wordpress.com/2009/07/20/to_json-as_json/">yes</a>.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>New Ext JS book in the works</title>
		<link>http://jonathanjulian.com/2010/01/new-ext-js-book-in-the-works/</link>
		<comments>http://jonathanjulian.com/2010/01/new-ext-js-book-in-the-works/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 01:08:08 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[extjs]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://jonathanjulian.com/?p=158</guid>
		<description><![CDATA[I&#8217;ve heard a rumor from a trusted source that the next version of Learning Ext JS is being written, and it may be titled Learning Ext JS 3.0. It will be updated to reflect working with version 3.x of the library, and have at least three new chapters added. If it is published in 2010, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve heard a rumor from a trusted source that the next version of <a href="http://learningextjs.com/">Learning Ext JS</a> is being written, and it may be titled <strong>Learning Ext JS 3.0</strong>. It will be updated to reflect working with version 3.x of the <a href="http://extjs.com/">library</a>, and have at least <strong><em>three</em></strong> new chapters added. If it is published in 2010, this could be a great year for Ext JS books, with <a href="http://extjsinaction.com/">Ext JS in Action</a> scheduled to go to print in June.</p>

<p><strong>UPDATE February 10</strong>: Confirmed! I&#8217;ve been asked to be a Technical Reviewer, and I&#8217;ve already received 3 chapters to review! This is going to be a great refresh for what I think is the best entry-level Ext JS book.</p>
]]></content:encoded>
			<wfw:commentRss>http://jonathanjulian.com/2010/01/new-ext-js-book-in-the-works/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Five Tips to Improve Your Ext JS Application</title>
		<link>http://jonathanjulian.com/2010/01/five-tips-to-improve-your-ext-js-application/</link>
		<comments>http://jonathanjulian.com/2010/01/five-tips-to-improve-your-ext-js-application/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 00:43:47 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[extjs]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://jonathanjulian.com/?p=138</guid>
		<description><![CDATA[Three Pillar Global sponsored their first Ext JS meetup earlier this week, and they were kind enough to invite me to give one of the presentations. Thanks to Patrick Sheridan (@sheridap) of Three Pillar for pulling it together, and providing the delicious pizza! My presentation was inserted between Shea Frederick and Jay Garcia&#8217;s. Pretty good [...]]]></description>
			<content:encoded><![CDATA[<h3 style="font-size: 1.17em;"><span style="font-weight: normal; font-size: 13px;"><a href="http://www.threepillarsoftware.com/">Three Pillar Global</a> sponsored their first <a href="http://www.meetup.com/baltimore-dc-javascript-users/calendar/12219819/">Ext JS meetup</a> earlier this week, and they were kind enough to invite me to give one of the presentations. Thanks to Patrick Sheridan (<a href="http://twitter.com/sheridap">@sheridap</a>) of Three Pillar for pulling it together, and providing the delicious pizza! My presentation was inserted between <a href="http://www.vinylfox.com/">Shea Frederick</a> and <a href="http://tdg-i.com/">Jay Garcia</a>&#8217;s. Pretty good company, I&#8217;d say.</span></h3>

<p>Pat started off discussing &#8220;<a href="http://www.slideshare.net/threepillar/three-pillar-global-design-for-use">Design for Use</a>&#8220;. Then Shea told us all about &#8220;<a href="http://www.slideshare.net/VinylFox/practical-ext-js-debugging">Practical Ext JS Debugging</a>&#8220;.</p>

<p>My talk is titled &#8220;Five Tips to Improve Your Ext JS Application&#8221;. I briefly touch on five distinct strategies to use to make your code more maintainable and reusable. Below the slides and video is a short discussion of each topic:</p>

<div id="__ss_2958396" style="width: 425px; text-align: left;"><a style="font: 14px Helvetica,Arial,Sans-serif; display: block; margin: 12px 0 3px 0; text-decoration: underline;" title="Five Tips To Improve Your Ext Js Application" href="http://www.slideshare.net/jonathanjulian/five-tips-to-improve-your-ext-js-application">Five Tips To Improve Your Ext Js Application</a><object style="margin: 0px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=fivetipstoimproveyourextjsapplication-100120131238-phpapp01&amp;rel=0&amp;stripped_title=five-tips-to-improve-your-ext-js-application" /><param name="allowfullscreen" value="true" /><embed style="margin: 0px;" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=fivetipstoimproveyourextjsapplication-100120131238-phpapp01&amp;rel=0&amp;stripped_title=five-tips-to-improve-your-ext-js-application" allowscriptaccess="always" allowfullscreen="true"> </embed></object>
<div style="font-size: 11px; font-family: tahoma,arial; height: 26px; padding-top: 2px;">View more <a style="text-decoration: underline;" href="http://www.slideshare.net/">documents</a> from <a style="text-decoration: underline;" href="http://www.slideshare.net/jonathanjulian">Jonathan Julian</a>.</div>
</div>

<p><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=9768559&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=9768559&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object></p>

<p><a href="http://vimeo.com/9768559">Jonathan Julian at the Northern Virginia Ext JS meetup at Three Pillar Global on 1/19/10</a> from <a href="http://vimeo.com/user3205431">Jay Garcia</a> on <a href="http://vimeo.com">Vimeo</a>.</p>

<h3>Define your own components</h3>

<p>Explicitly define your own &#8220;classes&#8221; as you build your UI. This will allow your code to be more reusable, testable, and maintainable. It&#8217;s really easy to do, and along with namespacing your files and only defining one component per file, this approach will lead to amazingly clear directory structure.</p>

<h3>Use an event manager</h3>

<p>Sometimes also known as an &#8220;event broker&#8221;, this is a simple object used to centralize all events. The example in the presentation is the &#8220;simplest event manager you can build with Ext JS&#8221;. I like to use at least one in every project to simplify the coding when someone inevitably asks, &#8220;can you make it do X every time the user does Y?&#8221;</p>

<div id="attachment_146" class="wp-caption alignleft" style="width: 290px"><img class="size-medium wp-image-146" title="describing an event manager" src="http://jonathanjulian.com/wp-content/uploads/2010/01/five_tips-crop-280x300.jpg" alt="Here I am describing the MyApp.eventManager" width="280" height="300" /><p class="wp-caption-text">Fire an event on the MyApp.eventManager</p></div>

<h3>Override the framework properly</h3>

<p>Anytime you need to &#8220;hack&#8221; the framework, do your work in a special file (or dir): call it &#8220;overrides&#8221;. Then when you test your upgrade to the next version of Ext JS, all the integration points to inspect are in one place. I also included my idea of a standard directory layout. I think it works well with the idea of &#8220;Namespace Segmentation&#8221; as discussed in Chapter 16 of <a href="http://extjsinaction.com/">Ext JS in Action</a>.</p>

<h3>Remember, it&#8217;s still a web app</h3>

<p>Write good JavaScript code. Use <a href="http://jslint.com/">JSLint</a>. Read <a href="http://jonathanjulian.com/2009/07/javascript-the-good-parts/">The Good Parts</a> and <a href="http://stevesouders.com/efws/">Even Faster Websites</a>.</p>

<h3>Prefer an Ext JS SPA to a classic &#8220;web app&#8221;</h3>

<p>This is a tricky one. If you have the choice, build your application in two tiers &#8211; Ext JS, and web service. They don&#8217;t even have to share the same endpoint! A cleaner design emerges when you separate the concept of the Ui and the data. If you work on a project that already muddles the two with server-side script tags and generation of Ext JS configs with &#8220;helpers&#8221;, then make it a goal to write all new code in the two-tier style. Put your Ext JS code in .js files. And only communicate with the server via JSONStores and Ajax requests.</p>

<div id="attachment_148" class="wp-caption alignright" style="width: 246px"><a href="http://github.com/jjulian/winner_picker"><img class="size-medium wp-image-148  " title="winner_picker on github" src="http://jonathanjulian.com/wp-content/uploads/2010/01/winner_picker-291x300.png" alt="jjulian/winner_picker" width="236" height="243" /></a><p class="wp-caption-text">The winner_picker UI.</p></div>

<h3>The Winner Picker App</h3>

<p>Shea brought a few copies of <a href="http://learningextjs.com/">Learning Ext JS</a>, and Jay brought a few vouchers for an early access copy of <a href="http://extjsinaction.com/">Ext JS in Action</a>. We needed a way to give them away &#8211; so, I dreamed up a simple app to randomly choose an attendee. To make it fun, I wanted to have a slick animation to randomly highlight attendees names for a few seconds before the choice is shown.</p>

<p>In less than an hour or so, here&#8217;s the Ext JS app I made: it&#8217;s a grid with an Array Store (attendees were entered manually), and one button that kicks off the process. And the silly animation: every 10ms, a grid row is selected at random and highlighted. The delay is slowly ramped down for effect. After a few seconds, the last random choice is made, and a message box is shown with the winner&#8217;s name. The<a href="http://github.com/jjulian/winner_picker"> code is on github</a>, and I encourage you to fork the project and improve it, for no other reason than practice (basic knowledge of git is <a href="http://jonathanjulian.com/2009/08/basic-git/">easy to get</a>). The Five Tips can be applied to this tiny project just as well as they can to your large enterprise project!</p>

<h3>Conclusion</h3>

<p>I think it was a successful event, and I hope to be involved in the future. There were a handful of intense discussions afterwards &#8211; it&#8217;s good to be a part of a passionate community! If you are in the Baltimore area, come on out to <a href="http://www.meetup.com/baltimore-dc-javascript-users/">our JavaScript meetup</a> and hang out with us on the first Wednesday of every month. We meet at the <a href="http://beehivebaltimore.com/">Beehive</a> in Canton. If you are in NOVA and want to help build the Ext JS meetup scene there, get in contact with Pat (<a href="http://twitter.com/sheridap">@sheridap</a>) or Jay (<a href="http://twitter.com/tdgi">@tdgi</a>).</p>

<p>I&#8217;d love to hear what you think about the Five Tips. Feel free to comment here, or on the <a href="http://www.slideshare.net/jonathanjulian/five-tips-to-improve-your-ext-js-application">slideshare page</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://jonathanjulian.com/2010/01/five-tips-to-improve-your-ext-js-application/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>
