<?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>dBlogIt by Dustin Boston</title>
	<atom:link href="http://dblogit.com/feed" rel="self" type="application/rss+xml" />
	<link>http://dblogit.com</link>
	<description>A one-man playground for nerds</description>
	<lastBuildDate>Sun, 06 May 2012 22:56:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>In Defense of JavaScript Constructor Functions (Classes)</title>
		<link>http://dblogit.com/archives/3739</link>
		<comments>http://dblogit.com/archives/3739#comments</comments>
		<pubDate>Sun, 06 May 2012 22:56:38 +0000</pubDate>
		<dc:creator>Dustin Boston</dc:creator>
				<category><![CDATA[Post]]></category>
		<category><![CDATA[classes]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://dblogit.com/?p=3739</guid>
		<description><![CDATA[<!-- sanity check --><!--Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

)
-->So there&#8217;s lots of debate about the merits of pure JavaScript objects (using Prototypal Inheritance) vs constructor functions (classes). I was on the former bandwagon until recently when I realized there are a couple of really good reasons to use &#8230; <a href="http://dblogit.com/archives/3739">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<!-- sanity check --><!--Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

)
--><p>So there&#8217;s <a title="Class Warfare on Infrequently Noted" href="http://infrequently.org/2012/04/class-warfare/">lots of debate</a> about the merits of pure JavaScript objects (using Prototypal Inheritance) vs constructor functions (classes). I was on the former bandwagon until recently when I realized there are a couple of really good reasons to use classes.</p>
<p>Assume the following: I have a situation where I use/reuse a single object in many different methods throughout my app. It gets modified and munged and poked and prodded until finally it dies a horrible death and disappears into the ether.</p>
<h3 id="LC4">Simplified validation and object setup</h3>
<div>Every method tests the object for the properties that it cares about before it does any processing. It can be as few as three validations and as many as 10. Well lets say I have even 20 methods with an average of six validations each. That&#8217;s 120 various checks. But with constructor functions I could reduce that to one&#8212;when the object is initialized. At that point data is validated and errors are thrown. By simply checking if the object is <code>instanceof Type</code> in each method I can drastically reduce the amount of pre-processing I have to do before an object is ready for prime time.</div>
<h3>Smaller, more readable codebase</h3>
<div>Less method-level validation equates to smaller codebase. Seriously, if I don&#8217;t have to write <code>x !== undefined</code> five or six times in every method that&#8217;s a significant file-size reduction. It may not perform better (I haven&#8217;t tested it yet) but it&#8217;s a helluva lot easier to read and a lot less error prone. Assuming I put each validation on a single line I&#8217;ve just saved 120 lines of code. This is pretty compelling IMHO.</div>
<h3>Adds well-defined rules to an application</h3>
<div>In this scenario a developer cannot simply create a similar object to be used in place of the properly vetted/validated one. Instead the developer must create an instance of the well-formed object. This is great for devs who are new to a project or who are still honing their chops. It means less hackery and cleaner code.</div>
<h3>Disclaimer</h3>
<div id="LC15">In no way do I intend this as a whole-sale endorsement for constructor functions over regular objects. In fact, if inheritance is involved I almost always use Prototypal Inheritance with regular old objects. But in this specific scenario they&#8217;re a great fit. In other words, always use the best tool for the job.</div>
]]></content:encoded>
			<wfw:commentRss>http://dblogit.com/archives/3739/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What Are Modules and Why Use Them?</title>
		<link>http://dblogit.com/archives/3707</link>
		<comments>http://dblogit.com/archives/3707#comments</comments>
		<pubDate>Sat, 24 Mar 2012 02:47:17 +0000</pubDate>
		<dc:creator>Dustin Boston</dc:creator>
				<category><![CDATA[Post]]></category>
		<category><![CDATA[amd]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[modules]]></category>
		<category><![CDATA[theory]]></category>

		<guid isPermaLink="false">http://dblogit.com/?p=3707</guid>
		<description><![CDATA[<!-- sanity check --><!--Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

)
-->When it comes to developing scalable web apps (or apps of any sort really) it&#8217;s best to keep your code modular. Cowboy code won&#8217;t fly when your sweet porn app is getting nailed by a quarter million users in the time it &#8230; <a href="http://dblogit.com/archives/3707">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<!-- sanity check --><!--Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

)
--><p>When it comes to developing scalable web apps (or apps of any sort really) it&#8217;s best to keep your code modular. <a href="http://c2.com/cgi/wiki?CowboyCoder">Cowboy code</a> won&#8217;t fly when your sweet porn app is getting nailed by a quarter million users in the time it takes to make a sandwich. Right. So, just to be clear I&#8217;m not talking about a specific architecture or methodology, I&#8217;m talking about approaching your code in a way that works for sites with large codebases and high traffic. IMHO this approach works for and should be used by small apps too. Just sayin.</p>
<h2>Why modular architecture</h2>
<p>For the love of all that is good, lets get to the point. There are at least five reasons to write modular code (in no particular order):</p>
<dl>
<dt>Re-usability</dt>
<dd>Modules can be used in multiple projects without modification</dd>
<dt>Adaptability</dt>
<dd>Can be updated or replaced without affecting the whole</dd>
<dt>Sustainability</dt>
<dd>It&#8217;s simpler and easier to develop discrete functionality</dd>
<dt>Stability</dt>
<dd>The more it&#8217;s used the better it&#8217;s tested (no wheel-inventing going on here)</dd>
<dt>Economicality</dt>
<dd>If the client (AKA, web browser) doesn&#8217;t need it, it doesn&#8217;t need to be loaded</dd>
</dl>
<p>Let&#8217;s get practical.</p>
<h3>Re-usability</h3>
<p>Every time you load up some random third party Javascript library you&#8217;re using modular code (some libraries are more modular than others). You stick it in, call it, and it does what it&#8217;s supposed to do. If you want to use that same library in a different project you can. So the next time Pointy-Haired Boss comes asking for a freaking contact form you can give him hell about how it&#8217;s going to take you four weeks to get it done, copy and paste the module, and go back to playing Half Life.</p>
<h3>Adaptability</h3>
<p>When said Pointy-Haired Boss decides that he hates the old contact form because &#8220;it&#8217;s not flashy enough&#8221; and wants to replace it with &#8220;something more social&#8221; or &#8220;something that slides out from the side like that one site&#8221; you&#8217;re good. Gut the old module (probably a bad idea) or create a new one. Either way, the module&#8217;s scope is limited so it&#8217;s not going to break the rest of the app.</p>
<h3>Sustainability</h3>
<p>Here&#8217;s a rhetorical question. What would you rather work on: a contact form whose functionality is randomly spread across 823 lines of code interspersed with navigation stuff, slidy thingies, some AJAX shit, and a handful of random global functions, <em>or</em> 42 lines of contact form specific code located in a single file called contact_form.js? [5. Thank you very much, smart-ass. Now go read that Cowboy code link in the intro.] Projects big and small can benefit from this type of structure.</p>
<h3>Stability</h3>
<p>The first time you re-use your super-slidy contact form in a different project you will realize it has about a thousand shortcomings. It needs to be easily skinned, &#8220;ohmigod it has to slide from the right!&#8221;, and whatnot. So you fix it, update all instances, fix bugs, test, reuse. A year later you&#8217;ve got a really solid, semi-slidy social contact thingy that 9 other people on GitHub also use. YAY!</p>
<h3>Economical&#8230;ity?</h3>
<p>Lol. Anyway. There&#8217;s no use loading the Super Social Slider Form ME(tm) on every page of your app. Better to include it only where it&#8217;s needed. In fact, why not wait to load it until it&#8217;s actually needed. Modular code lets you do this kind of thing. When you have the 489kb, 823 line multi-function cluster-fuck version, the client gets it all at once. Kittens die because of this kind of shit. Be nice to your end users by conserving bandwidth, memory, and load times.</p>
<h2>Rules To Live By</h2>
<p>I&#8217;ll save the practicalities of putting together a real module for another post but before I that, there are a few rules to live by.</p>
<dl>
<dt>Minimize dependencies</dt>
<dd>Try not to use external libraries if you don&#8217;t have to. Don&#8217;t be afraid to write &#8220;pure&#8221; Javascript.</dd>
<dt>Hold on loosely</dt>
<dd>Modules should be loosely coupled. Don&#8217;t call a module or its methods directly, instead use observers.</dd>
<dt>Do only one thing</dt>
<dd>Include all functionality required for the module to work by itself within one module.</dd>
<dd></dd>
<dd></dd>
</dl>
<p>Keep these in mind when you&#8217;re starting an app and you&#8217;re good to go.</p>
]]></content:encoded>
			<wfw:commentRss>http://dblogit.com/archives/3707/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Suckered</title>
		<link>http://dblogit.com/archives/3703</link>
		<comments>http://dblogit.com/archives/3703#comments</comments>
		<pubDate>Wed, 14 Mar 2012 06:10:11 +0000</pubDate>
		<dc:creator>Dustin Boston</dc:creator>
				<category><![CDATA[Image]]></category>

		<guid isPermaLink="false">http://dblogit.com/?p=3703</guid>
		<description><![CDATA[<!-- sanity check --><!--Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

)
-->This is Jameson and his partner in crime. Notice that little popper toy. Notice the location. Yes it&#8217;s a parking lot. How did we arive at this situation? Well it&#8217;s simple: They suckered me. I thought it would be nice &#8230; <a href="http://dblogit.com/archives/3703">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<!-- sanity check --><!--Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

)
--><p><img title="C360_2012-02-25-16-09-37.jpg" class="alignnone" alt="image" src="http://dblogit.com/wp-content/uploads/2012/03/wpid-C360_2012-02-25-16-09-37.jpg" /></p>
<p>This is Jameson and his partner in crime. Notice that little popper toy. Notice the location. Yes it&#8217;s a parking lot. How did we arive at this situation? Well it&#8217;s simple:</p>
<p>They suckered me.</p>
<p>I thought it would be nice to get a board game for the adults to play. Where does one buy board games? At Toys &#8216;R&#8217; Us of course. First mistake. I don&#8217;t know what I was thinking. </p>
<p>Second was when mama, ever so coy, batted her eyes and asked if he could play with the toy. Sure, I thought, what&#8217;s the harm. So then he&#8217;s pulling it everywhere through the store which is really cute. </p>
<p>Time to check out and the kid pitches a fit, of course. It was the perfect trifecta so yeah I totally caved and bought it. They got me. They got me good&#8230;but isn&#8217;t it so cute?!</p>
]]></content:encoded>
			<wfw:commentRss>http://dblogit.com/archives/3703/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vinyl</title>
		<link>http://dblogit.com/archives/3699</link>
		<comments>http://dblogit.com/archives/3699#comments</comments>
		<pubDate>Sun, 30 Oct 2011 21:57:36 +0000</pubDate>
		<dc:creator>Dustin Boston</dc:creator>
				<category><![CDATA[Image]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[records]]></category>

		<guid isPermaLink="false">http://dblogit.com/archives/3699</guid>
		<description><![CDATA[<!-- sanity check --><!--Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

)
-->I was just taking a look through my father in-law&#8217;s awesome record collection. Omg. Van Halen, Led Zeppelin, Fleetwood Mac&#8230; I could go on and on. So much incredible classic rock in one little egg crate.]]></description>
			<content:encoded><![CDATA[<!-- sanity check --><!--Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

)
--><p><img style="display:block;margin-right:auto;margin-left:auto;" alt="image" src="http://dblogit.com/wp-content/uploads/2011/10/wpid-FxCam_1320011422742.jpg" /></p>
<p>I was just taking a look through my father in-law&#8217;s awesome record collection. Omg. Van Halen, Led Zeppelin, Fleetwood Mac&#8230; I could go on and on. So much incredible classic rock in one little egg crate. </p>
]]></content:encoded>
			<wfw:commentRss>http://dblogit.com/archives/3699/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First steps</title>
		<link>http://dblogit.com/archives/3695</link>
		<comments>http://dblogit.com/archives/3695#comments</comments>
		<pubDate>Sun, 23 Oct 2011 00:37:26 +0000</pubDate>
		<dc:creator>Dustin Boston</dc:creator>
				<category><![CDATA[Image]]></category>

		<guid isPermaLink="false">http://dblogit.com/archives/3695</guid>
		<description><![CDATA[<!-- sanity check --><!--Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

)
-->Jameson took three little baby steps completely on his own today! His balance is great but he really doesn&#8217;t understand what he&#8217;s doing yet]]></description>
			<content:encoded><![CDATA[<!-- sanity check --><!--Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

)
--><p><img style="display:block;margin-right:auto;margin-left:auto;" alt="image" src="http://dblogit.com/wp-content/uploads/2011/10/wpid-FxCam_1319329602243.jpg" /></p>
<p>Jameson took three little baby steps completely on his own today! His balance is great but he really doesn&#8217;t understand what he&#8217;s doing yet <img src='http://dblogit.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://dblogit.com/archives/3695/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Our Awesome Engagement Photos by The R2 Studio @ther2studio</title>
		<link>http://dblogit.com/archives/3682</link>
		<comments>http://dblogit.com/archives/3682#comments</comments>
		<pubDate>Wed, 19 Oct 2011 18:24:41 +0000</pubDate>
		<dc:creator>Dustin Boston</dc:creator>
				<category><![CDATA[Image]]></category>
		<category><![CDATA[engagement]]></category>

		<guid isPermaLink="false">http://dblogit.com/?p=3682</guid>
		<description><![CDATA[<!-- sanity check --><!--Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

)
-->Heather and I recently had our engagement pictures taken by the lovely ladies at The R2 Studio (heavy flash). They were incredible and made us feel like rock stars. Head over to the blog post and then check out the &#8230; <a href="http://dblogit.com/archives/3682">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<!-- sanity check --><!--Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

)
--><p><img src="http://dblogit.com/wp-content/uploads/2011/10/012-TheR2Studio-HeatherDustinENG-600x509.jpg" alt="" title="Engagement Photo" width="600" height="509" class="alignnone size-full wp-image-3683" /></p>
<p>Heather and I recently had <a href="http://www.heatheranddustineng.ther2studio.com/#/client-gallery/">our engagement pictures</a> taken by the lovely ladies at <a href="http://ther2studio.com/">The R2 Studio (heavy flash)</a>. They were incredible and made us feel like rock stars. Head over to <a href="http://ther2studio.com/blog/?p=3952">the blog post</a> and then check out <a href="http://www.heatheranddustineng.ther2studio.com/#/client-gallery/">the full set</a>.</p>
<p><ins datetime="2011-10-20T16:31:49+00:00">Update: Our photos also got <a href="http://hifiweddings.com/2011/10/20/heather-dustins-stinkweed-sesh/">featured on Hi-Fi weddings</a>. Sweet!</ins></p>
]]></content:encoded>
			<wfw:commentRss>http://dblogit.com/archives/3682/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Another reason I hate text messaging</title>
		<link>http://dblogit.com/archives/3668</link>
		<comments>http://dblogit.com/archives/3668#comments</comments>
		<pubDate>Mon, 01 Aug 2011 19:07:51 +0000</pubDate>
		<dc:creator>Dustin Boston</dc:creator>
				<category><![CDATA[Image]]></category>

		<guid isPermaLink="false">http://dblogit.com/?p=3668</guid>
		<description><![CDATA[<!-- sanity check --><!--Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

)
-->]]></description>
			<content:encoded><![CDATA[<!-- sanity check --><!--Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

)
--><p><img src="http://dblogit.com/wp-content/uploads/2011/08/ragecomic-phone-troll-2-500x369.png" alt="" title="Phone Troll 2" width="500" height="369" class="alignnone size-medium wp-image-3669" /></p>
]]></content:encoded>
			<wfw:commentRss>http://dblogit.com/archives/3668/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One of the many reasons I hate text messaging</title>
		<link>http://dblogit.com/archives/3662</link>
		<comments>http://dblogit.com/archives/3662#comments</comments>
		<pubDate>Mon, 01 Aug 2011 17:38:40 +0000</pubDate>
		<dc:creator>Dustin Boston</dc:creator>
				<category><![CDATA[Image]]></category>

		<guid isPermaLink="false">http://dblogit.com/?p=3662</guid>
		<description><![CDATA[<!-- sanity check --><!--Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

)
-->]]></description>
			<content:encoded><![CDATA[<!-- sanity check --><!--Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

)
--><p><img src="http://dblogit.com/wp-content/uploads/2011/08/ragecomic-phone-troll-500x369.png" alt="" title="Phone Troll" width="500" height="369" class="alignnone size-medium wp-image-3663" /></p>
]]></content:encoded>
			<wfw:commentRss>http://dblogit.com/archives/3662/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cover your code</title>
		<link>http://dblogit.com/archives/3659</link>
		<comments>http://dblogit.com/archives/3659#comments</comments>
		<pubDate>Tue, 26 Jul 2011 23:33:13 +0000</pubDate>
		<dc:creator>Dustin Boston</dc:creator>
				<category><![CDATA[Link]]></category>
		<category><![CDATA[code coverage]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://dblogit.com/?p=3659</guid>
		<description><![CDATA[<!-- sanity check --><!--Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

)
-->Just started using JSCoverage for testing code coverage in Javascript. It&#8217;s super simple to implement&#8212;I even got it working with RequireJS (just had to make sure it was using relative URLs).]]></description>
			<content:encoded><![CDATA[<!-- sanity check --><!--Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

)
--><p>Just started using <a href="http://siliconforks.com/jscoverage/">JSCoverage</a> for testing code coverage in Javascript. It&#8217;s super simple to implement&#8212;I even got it working with RequireJS (just had to make sure it was using relative URLs). </p>
]]></content:encoded>
			<wfw:commentRss>http://dblogit.com/archives/3659/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Les Twins Dancing To Edit Ants</title>
		<link>http://dblogit.com/archives/3632</link>
		<comments>http://dblogit.com/archives/3632#comments</comments>
		<pubDate>Wed, 20 Jul 2011 05:47:28 +0000</pubDate>
		<dc:creator>Dustin Boston</dc:creator>
				<category><![CDATA[Video]]></category>
		<category><![CDATA[dance]]></category>
		<category><![CDATA[sytycd]]></category>

		<guid isPermaLink="false">http://dblogit.com/archives/3632</guid>
		<description><![CDATA[<!-- sanity check --><!--Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

)
-->Um yeah, this is just awesome. Thanks Steve.]]></description>
			<content:encoded><![CDATA[<!-- sanity check --><!--Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

)
--><p>Um yeah, this is just awesome. Thanks <a href="http://monkinetic.com">Steve</a>. </p>
<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/t6OeNwrU5_8"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/t6OeNwrU5_8" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://dblogit.com/archives/3632/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

