<?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>Nick Zalabak - techwhizbang &#187; Software</title>
	<atom:link href="http://techwhizbang.com/category/software/feed/" rel="self" type="application/rss+xml" />
	<link>http://techwhizbang.com</link>
	<description>my work, life, and ideas</description>
	<lastBuildDate>Thu, 08 Mar 2012 06:07:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Clojure Applications as Daemons</title>
		<link>http://techwhizbang.com/2012/02/clojure-applications-as-daemons/</link>
		<comments>http://techwhizbang.com/2012/02/clojure-applications-as-daemons/#comments</comments>
		<pubDate>Wed, 29 Feb 2012 06:17:39 +0000</pubDate>
		<dc:creator>techwhizbang</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[clojure]]></category>
		<category><![CDATA[daemon]]></category>
		<category><![CDATA[jvm]]></category>

		<guid isPermaLink="false">http://techwhizbang.com/?p=571</guid>
		<description><![CDATA[Running your Clojure app as a daemon is very useful especially when you&#8217;re ready to take it live for several reasons. You need a way to easily and consistently &#8220;background&#8221; or disassociate from the controlling tty for every deployment. Systems often start daemons at boot time (think about when your server is rebooted intentionally and more often&#8230;unintentionally). [...]]]></description>
			<content:encoded><![CDATA[<p>Running your Clojure app as a daemon is very useful especially when you&#8217;re ready to take it live for several reasons.</p>
<ul>
<li>You need a way to easily and consistently &#8220;background&#8221; or disassociate from the controlling tty for every deployment.</li>
</ul>
<ul>
<li>Systems often <em>start daemons</em> at boot time (think about when your server is rebooted intentionally and more often&#8230;unintentionally).</li>
</ul>
<ul>
<li>Something a monitor script can execute if your application becomes unresponsive or unruly.</li>
</ul>
<p>There may be others, but those are the main reasons.</p>
<p>Those unfamiliar with the Java ecosystem may feel especially lost in this area, but fear not because here is an awesome solution. I am going to walk you through getting your application running as a daemon using a great piece of software made by <a title="Tanuki Java Service Wrapper" href="http://wrapper.tanukisoftware.com/doc/english/download.jsp" target="_blank">Tanuki</a>. I do not work for Tanuki, nor do I even know anyone at Tanuki, and so trust me this isn&#8217;t some lame plug for a product. I&#8217;ve used it for many of my Java applications and now I use it with my Clojure applications. It is quite simply a great piece of software. They call it a &#8220;Java Service Wrapper&#8221;, but that is a bit of a misnomer. It is really a <em>JVM</em> Service Wrapper.</p>
<p>In order to start using it, you&#8217;ll need to bundle your application as a Jar file. As you&#8217;ll read from the documentation on the Tanuki site there are several ways to &#8220;integrate&#8221; with the service wrapper. However, I find that using their <a href="http://wrapper.tanukisoftware.com/doc/english/integrate.html#method4" target="_blank">fourth approach</a> is the best. It is not  coupled in any way to your application and there is no code to be written. Generating a Jar file is of course a breeze if you&#8217;re using Leiningen or Cake. I&#8217;m most familiar with Leiningen so you&#8217;ll want to build an &#8220;uberjar&#8221; or an equivalent Jar file that contains all of its dependencies. Wait, you&#8217;re already <a title="quander" href="http://www.urbandictionary.com/define.php?term=quander">quandering</a>&#8230;&#8221;will it work if I have a web app?&#8221; Yes! You can make it a War file, if you are using an embedded Jetty server. In fact, you can make your web application a Jar file if you&#8217;re using the Ring Jetty adapter and skip the complexity of a War file. Of course this is beyond the scope of the post. Before you jump off into the deep end with the service wrapper be sure that your application starts properly. Remember you&#8217;ll need a &#8220;main&#8221; function registered in the manifest of your Jar file. On the command line start it up like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">java <span style="color: #660033;">-jar</span> your-nifty-clojure-app.jar</pre></div></div>

<p>Perfect. Now you&#8217;ll need to download the service wrapper from <a title="Tanuki Service Wrapper Download" href="http://wrapper.tanukisoftware.com/doc/english/download.jsp#latest" target="_blank">here</a>. You&#8217;ll see that they have thought of just about every OS distribution. If your development and production OS are the same, simply choose the right download. Or if you develop on a Mac and deploy to a Linux server like me, then choose the &#8220;Delta Pack&#8221;. The &#8220;Delta Pack&#8221; is cross platform support for those of us who develop  and deploy to a multitude of OS&#8217;s. I forgot to mention I use the community edition and that is what I will be using for this setup.</p>
<p>I prefer to create a folder in my project called &#8220;daemon&#8221; and unzip the service wrapper contents there. Once unzipped you&#8217;ll see a directory structure like this. Begin trimming the unnecessary files by deleting the README&#8217;s, doc, and jdoc folders.</p>
<p style="text-align: center;"><img class="aligncenter  wp-image-581" title="tanuki directory structure" src="http://techwhizbang.com/wp-content/uploads/2012/02/tanuki_directory_structure.jpg" alt="" width="620" height="73" /></p>
<p>Now go into the src/bin directory and find a file called &#8220;sh.script.in&#8221;. Copy it into the bin folder of daemon directory, rename it, and lastly make it executable.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> src<span style="color: #000000; font-weight: bold;">/</span>bin
<span style="color: #c20cb9; font-weight: bold;">cp</span> sh.script.in ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>your-nifty-clojure-app
<span style="color: #7a0874; font-weight: bold;">cd</span> ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>bin
<span style="color: #c20cb9; font-weight: bold;">chmod</span> +x your-nifty-clojure-app</pre></div></div>

<p>Open the executable and edit the following three variables to match your application name.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">APP_NAME</span>=<span style="color: #ff0000;">&quot;your-nifty-clojure-app&quot;</span>
<span style="color: #007800;">APP_LONG_NAME</span>=<span style="color: #ff0000;">&quot;Your Nifty Clojure App&quot;</span>
...
<span style="color: #007800;">PIDDIR</span>=<span style="color: #ff0000;">&quot;./&quot;</span></pre></div></div>

<p>Naturally you can change the PIDDIR to write where ever you want or conditionally change it based on the target environment. For starters though just put the PID file where you start the script.</p>
<p>Now go into the src/conf directory and find a file called &#8220;wrapper.conf.in&#8221;. Copy it into the conf folder of daemon directory, and rename it &#8220;wrapper.conf&#8221;.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cp</span> src<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>wrapper.conf.in conf<span style="color: #000000; font-weight: bold;">/</span>wrapper.conf</pre></div></div>

<p>You&#8217;ll to make several edits to the wrapper.conf file. </p>
<p>Begin by telling the wrapper script that it should use the fourth integration method. Specifically it will use the WrapperJarApp as the main method and then subsequently execute your main method.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">...
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperJarApp
...</pre></div></div>

<p>I like to set a reusable variable that sets the path to your application Jar file.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">...
<span style="color: #666666; font-style: italic;"># Reusable path to the main JAR file for your application</span>
set.APP_JAR_PATH=..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>your-nifty-clojure-app.jar
...</pre></div></div>

<p>Now you&#8217;ll need to add your Jar file to the classpath as defined in the wrapper.conf.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Java Classpath (include wrapper.jar)  Add class path elements as</span>
<span style="color: #666666; font-style: italic;">#  needed starting from 1</span>
wrapper.java.classpath.1=..<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>wrapper.jar
wrapper.java.classpath.2=<span style="color: #000000; font-weight: bold;">%</span>APP_JAR_PATH<span style="color: #000000; font-weight: bold;">%</span></pre></div></div>

<p>You should adjust the JVM minimum and maximum heap sizes.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Initial Java Heap Size (in MB)</span>
wrapper.java.initmemory=<span style="color: #000000;">256</span> <span style="color: #666666; font-style: italic;"># Set it to whatever you see fit...</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Maximum Java Heap Size (in MB)</span>
wrapper.java.maxmemory=<span style="color: #000000;">512</span> <span style="color: #666666; font-style: italic;"># Set it to whatever you see fit...</span></pre></div></div>

<p>Lastly, tell the wrapper script what Jar file to execute. These work like command line arguments. If your application requires arguments, feel free to enumerate them</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">...
wrapper.app.parameter.1=<span style="color: #000000; font-weight: bold;">%</span>APP_JAR_PATH<span style="color: #000000; font-weight: bold;">%</span>
<span style="color: #666666; font-style: italic;">#wrapper.app.parameter.2=some argument</span>
<span style="color: #666666; font-style: italic;">#wrapper.app.parameter.3=another argument</span>
...</pre></div></div>

<p>Now you should be able to start,stop, and restart your application using the bin/your-nifty-clojure-app</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>your-nifty-clojure-app start<span style="color: #000000; font-weight: bold;">|</span>stop<span style="color: #000000; font-weight: bold;">|</span>restart</pre></div></div>

<p>Tanuki offers a bunch of other options that I haven&#8217;t even scratched the surface on and they are worth a look. I hope this helps you daemonize your Clojure application!</p>
]]></content:encoded>
			<wfw:commentRss>http://techwhizbang.com/2012/02/clojure-applications-as-daemons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Short and Sweet Disclojure</title>
		<link>http://techwhizbang.com/2012/01/short-and-sweet-disclojure/</link>
		<comments>http://techwhizbang.com/2012/01/short-and-sweet-disclojure/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 06:32:53 +0000</pubDate>
		<dc:creator>techwhizbang</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[clojure]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[lisp]]></category>

		<guid isPermaLink="false">http://techwhizbang.com/?p=516</guid>
		<description><![CDATA[After experimenting and bouncing back and forth on several relatively new languages, I was undecided on what new language I wanted to commit myself to. It wasn&#8217;t until I began reading Clojure in Action that I really started to grok and see through its otherwise intimidating syntax. Admittedly, Clojure just looked and sounded too exotic [...]]]></description>
			<content:encoded><![CDATA[<p>After experimenting and bouncing back and forth on several relatively new languages, I was undecided on what new language I wanted to commit myself to. It wasn&#8217;t until I began reading <em><a href="http://amzn.com/1935182595" title="Clojure in Action" target="_blank">Clojure in Action</a></em> that I really started to grok and see through its otherwise intimidating syntax. Admittedly, Clojure just looked and sounded too exotic at first glance. Do I really want to learn Lisp? Aren&#8217;t those parentheses crazy? Shouldn&#8217;t I be programming the next million dollar idea for the iPhone? </p>
<p>It turns out that the answers to those questions are: Yes. No. What money? </p>
<p>I wanted a challenge. I wanted something that would transcend the way I&#8217;ve been thinking about programming. I wanted something that I knew would make me a better software engineer. I wanted something more expressive and powerful. </p>
<p>Luckily, the past two weeks I&#8217;ve had an excellent opportunity at work to apply and push my learnings of Clojure further. I thought it would be an opportune time to share the good, the bad, and whatever else in between. A reflective and honest &#8220;disclojure&#8221;. </p>
<p>It seems that the best way to learn a new language is finding well documented source code and blogs from likeminded people. Clojure is a &#8220;newer&#8221; burgeoning language so it goes without saying that there are far fewer comprehensive online resources to tap into. The blogosphere is actually a bit sparse on Clojure. I&#8217;d strongly recommend having a couple Clojure e-books at your fingertips for reference. Speaking of books, don&#8217;t expect to learn Clojure by reading a stack of books for 5 months and think that it will magically flow from your digits. It&#8217;ll never ever happen. The best recipe for me has been a 1:1 ratio of time spent reading and coding. If you&#8217;re in pursuit of books that might help you on your quest to learning Clojure, remember Clojure is a Lisp. <em><a href="http://amzn.com/0262560992" title="The Little Schemer" target="_blank">The Little Schemer</a></em> and <em><a href="http://amzn.com/026256100X" title="The Seasoned Schemer" target="_blank">The Seasoned Schemer</a></em> have been priming Lisp programmers for decades. If anything reading these two books will make you hungrier for more, wink wink nudge nudge.</p>
<p>Github has been an invaluable asset when looking for good source code examples. One of the questions I continue to ask myself while coding, &#8220;Is the code I&#8217;m writing idiomatic?&#8221; That is important to me because one of my main objectives is to transcend my thinking and programming style. So before you add that dependency to your <a href="https://github.com/technomancy/leiningen" title="Leiningen" target="_blank">Leiningen</a> project.clj have a peek at the author&#8217;s source. In reality, you might often find yourself sifting through source because of the lack of documentation or examples. Actually I read other developers source code daily for this very reason. So let me re-phrase that, while you&#8217;re trying to figure out how the heck some library or &#8220;clojar&#8221; works, be mindful of the coding style. Undoubtedly you will pick up something useful.</p>
<p>I had a perplexing problem the other day and for the life of me I couldn&#8217;t figure it out. I simply lacked the context necessary that other more advanced Clojure developers have. I found my answer after posting my question on the <a href="http://groups.google.com/group/clojure" title="Clojure Google Groups" target="_blank">Clojure forum</a> hosted on Google Groups. More specifically, I was using lein run to execute a simple database preparation task, but the process was hanging on well after it completed. It wasn&#8217;t until someone informed me that I should use (shutdown-agents) after the task I was running finished because of the way the agent thread pool delays shut down. See my gist <a href="https://gist.github.com/1635837">here</a>. The turn around time on the Clojure forum varies. I think it took 2 or 3 days before my post was moderated and then received a response. Most if not all of the Clojure core developers answer questions in this forum so the responses are of high quality and are super helpful.</p>
<p>Sometimes you&#8217;re totally stuck. Even after using your e-book as a reference and reading the source code it just doesn&#8217;t make sense. Enter <a href="irc://irc.freenode.net/#clojure" title="Clojure IRC" target="_blank">Clojure IRC</a>! During the daytime it is bustling with chatter. Lots of the folks who answer questions on the Clojure forum hang out here too. In my experiences, the community that gathers here is friendly and willing to help. </p>
<p>Clojure is as expressive, powerful, and succinct as advertised. The Java interop with Clojure is about the simplest and cleanest I&#8217;ve seen thus far and that includes JRuby and Scala. I&#8217;m impressed with the clean HTTP API Ring has to offer and using the Clojure JDBC API is really nice. If only JDBC were that easy in Java there would be no need for heavyweight clunky ORMs. In terms of testing, speclj is a pretty awesome testing framework that mirrors Ruby&#8217;s RSpec API. I also have enjoyed rolling my own solutions for things that aren&#8217;t available yet. And one of the most important parts&#8230;it is fast and performs very well under load. I don&#8217;t make these claims falsely either, we ran a load test today at work and we were absolutely thrilled with the response times and throughput. I look forward to posting more about Clojure in the coming weeks. Stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://techwhizbang.com/2012/01/short-and-sweet-disclojure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monitoring a remote JVM process</title>
		<link>http://techwhizbang.com/2011/12/monitoring-a-remote-jvm-process/</link>
		<comments>http://techwhizbang.com/2011/12/monitoring-a-remote-jvm-process/#comments</comments>
		<pubDate>Wed, 07 Dec 2011 22:52:49 +0000</pubDate>
		<dc:creator>techwhizbang</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://techwhizbang.com/?p=503</guid>
		<description><![CDATA[Monitoring a remote JVM process has never been easier. As part of the default JDK installation you have a utility called jconsole at your fingertips. jconsole provides a simple way to attach to a running JVM process either locally or remotely. There are basically two ways to attach to the process, either choosing to attach [...]]]></description>
			<content:encoded><![CDATA[<p>Monitoring a remote JVM process has never been easier. As part of the default JDK installation you have a utility called jconsole at your fingertips. jconsole provides a simple way to attach to a running JVM process either locally or remotely. There are basically two ways to attach to the process, either choosing to attach to the PID or through JMX. Personally, I find that attaching to a PID is the easiest either remotely or locally.</p>
<p>Attaching to a process remotely might seem difficult or impossible, but if you are able to use X11 window forwarding through SSH it is a nice option. Check your /etc/ssh/ssh_config and make sure that you see ForwardX11 is set to &#8220;yes&#8221;, sometimes it is X11Forwarding, check your Linux distribution to be sure.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Host <span style="color: #000000; font-weight: bold;">*</span>
<span style="color: #666666; font-style: italic;">#   ForwardAgent no</span>
   ForwardX11 <span style="color: #c20cb9; font-weight: bold;">yes</span></pre></div></div>

<p>Once you have made this change, restart your ssh service /etc/init.d/ssh restart or service ssh restart. Voila. Now ssh onto your remote server with the X option</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-X</span> user<span style="color: #000000; font-weight: bold;">@</span>remote.server.com</pre></div></div>

<p>So once you&#8217;ve SSH&#8217;d into your remote server startup jconsole, assuming it is in your PATH you should be able to just type it straight away. You should then immediately see that jconsole has started up through X11 as if it were running on your local machine. Just select the PID and you will be able to start monitoring memory, threads, garbage collection, etc.</p>
<div id="attachment_507" class="wp-caption aligncenter" style="width: 545px"><img class="size-full wp-image-507 " title="jconsole " src="http://techwhizbang.com/wp-content/uploads/2011/12/Screen-Shot-2011-12-07-at-2.50.28-PM.png" alt="jconsole" width="535" height="448" /><p class="wp-caption-text">jconsole</p></div>
<p>Generally when I am load testing an application (I use JMeter) on the JVM I will crack open jconsole to see if there are any blaring memory leaks or memory consumption problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://techwhizbang.com/2011/12/monitoring-a-remote-jvm-process/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fat chunky ugly bloated &#8220;models&#8221;</title>
		<link>http://techwhizbang.com/2011/08/fat-chunky-ugly-bloated-models/</link>
		<comments>http://techwhizbang.com/2011/08/fat-chunky-ugly-bloated-models/#comments</comments>
		<pubDate>Sat, 27 Aug 2011 08:29:14 +0000</pubDate>
		<dc:creator>techwhizbang</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://techwhizbang.com/?p=461</guid>
		<description><![CDATA[I&#8217;m not referring to the runway model variety, I&#8217;m talking about code. Observation I&#8217;ve had the opportunity to work with many Ruby code bases the past few years. One reoccurring theme I keep seeing is bloated models. Fat chunky ugly bloated models. Literally thousands of lines, mixing in of modules, and extensions galore. All of [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not referring to the runway model variety, I&#8217;m talking about code.</p>
<h3>Observation</h3>
<p>I&#8217;ve had the opportunity to work with many Ruby code bases the past few years. One reoccurring theme I keep seeing is bloated models. Fat chunky ugly bloated models. Literally thousands of lines, mixing in of modules, and extensions galore. All of which are convoluting the notion of two completely separate things, data access and business logic. The phrase &#8220;fat models&#8221; has been taken too literally. I have one question. Why?</p>
<p>I am officially declaring it an anti-pattern for the Ruby community. A &#8220;model&#8221; is supposed to be an object representation of the underlying data your application needs. So when working with a _data_ model, you ought to stay laser focused on the DML behavior. Get your data and get out. Move on to the next set of objects that are responsible for determining, strategizing, composing, decorating, and displaying (these action verbs should sound familiar) the object representations of your data.</p>
<p>Remarkably most Java projects I&#8217;ve seen get this one right. Typically there is DAO, there is an entity, and beyond those two objects that are focused on DML, there are other objects that responsible for doing &#8220;things&#8221; with that data. I say &#8220;things&#8221;, but I am referring to whatever your business or domain does with the data beyond creating, reading, updating, or deleting it.</p>
<h3>Real World Example</h3>
<p>Here&#8217;s a solid example for the sake of discussion. Every e-commerce site has some notion of a product or service. Suppose you are modeling a &#8220;Product&#8221;. Your product has some attributes regarding description, size, weight, color, etc. You get the gist. Let&#8217;s not forget pricing, every product has some type of pricing. I see pricing go sideways almost every time. Pricing always starts out simple. You might have a &#8220;base&#8221; price and &#8220;selling&#8221; price. The &#8220;base&#8221; price is your company&#8217;s cost, and the &#8220;selling&#8221; price is your customers cost. Shortly after you deliver that functionality your product development team will undoubtedly come up with all kinds of pricing <strong><em>strategies</em></strong>.</p>
<p>These should all sound familiar:</p>
<ul>
<li>site wide sales</li>
<li>single use coupons</li>
<li>volume discounts</li>
<li>bundling discounts</li>
<li>affiliate pricing tiers</li>
<li>employee discounts</li>
</ul>
<h3>Wrong</h3>
<p>This is where it goes sideways. It&#8217;s so easy, right? Just fetch the &#8220;selling&#8221; price within an instance of the &#8220;Product&#8221; model and being applying the business rules inside your model.</p>
<h3>Right</h3>
<p>I hinted a couple times in that this is a perfect application for the strategy pattern. <a title="Strategy Pattern" href="http://en.wikipedia.org/wiki/Strategy_pattern" target="_blank">Not familiar?</a> Each individual pricing type should have it&#8217;s own strategy. It is safe to let a &#8220;Price&#8221; object flow though the strategies. The pricing strategies classes can then apply the discounts and the appropriate pricing separately. One of the golden rules is that composition is almost always better than inheritance and that is the construct the strategy pattern embraces.</p>
<p>That should look and feel better on many different levels. You should observe the freedom to add or remove pricing features without the tight coupling to any particular model. In the case that your business evolves, and it inevitable does, your pricing strategies should be flexible enough to handle any sort of pricing irrespective of whether it has anything to do with a &#8220;Product&#8221; or not. It should also be easier to test. There are no worries about the creation of database objects or fixtures, simply assert the strategies of pricing with a &#8220;Pricing&#8221; object. Also as the pricing strategies grow in size and complexity it will certainly be easier to abstract away into a separate library.</p>
<h3>Facetious Wonderment</h3>
<p>Here is where my &#8220;wonderment&#8221; comes into action. How is it possible that so many &#8220;Rubyists&#8221; are ignoring traditional OO programming techniques and patterns when coding at the data access layer? Is it possible that the suggestive nature of the most popular and opinionated Ruby framework has created some psychological voodoo on developers making them believe that classes only come in 4 flavors (models, views, controllers, and helpers)? Is it really that scary to add new directories or categorize your classes differently? Perhaps it is the dynamic nature of the language? Can it be the power and &#8220;expressiveness&#8221; of the language? A language wherein the lack of true interfaces, strict type checking, and the magical injection of behaviors and methods has lead its developers down a path of wicked and corrupt habits. Gosh&#8230;why should I create a new class when I can just inject a few unrelated wacky ass methods to the String class? Is it laziness? Could it be that Ruby has given way and lowered the barrier to entry for people who shouldn&#8217;t be programming at all? Or perhaps it is a lack of classic OO programming training?</p>
<h3>Conclusion</h3>
<p>Draw your own conclusions. The major takeaway for me is that I&#8217;m sick of it; or rather I&#8217;m sickened by it. Unwavering I will remain steadfast on an ever-quest to right the wrong where ever my fingertips land regarding this matter. You should too. There are some great code katas that focus on this very problem set. Give the <a title="Gilded Rose" href="https://github.com/professor/GildedRose" target="_blank">Gilded Rose kata</a> a whirl. You might be surprised by the harshness of my befuddlement and/or the generalizations I&#8217;ve made about the Ruby community. Don&#8217;t get me wrong. There are many super intelligent people out there that swear by Ruby, who are doing the right thing, and you know who you are. I am just saying based on my observations and experiences there are many more people doing the wrong thing, specifically in the data access realm, that outweigh the right-doers. But hey that&#8217;s the case with most things in life, isn&#8217;t it?</p>
]]></content:encoded>
			<wfw:commentRss>http://techwhizbang.com/2011/08/fat-chunky-ugly-bloated-models/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Implementing Ruby&#8217;s inject method</title>
		<link>http://techwhizbang.com/2011/07/implementing-rubys-inject-method/</link>
		<comments>http://techwhizbang.com/2011/07/implementing-rubys-inject-method/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 06:37:34 +0000</pubDate>
		<dc:creator>techwhizbang</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://techwhizbang.com/?p=443</guid>
		<description><![CDATA[I spent a little time tinkering with some of the &#8220;newer&#8221; RSpec 2 features while re-implementing the inject method that belongs to the Enumerable module. It is a fun and simple exercise because it reinforces the understanding of blocks and the sometimes confusing nature of the inject method. Here it is. &#160; require 'rubygems' require [...]]]></description>
			<content:encoded><![CDATA[<p>I spent a little time tinkering with some of the &#8220;newer&#8221; RSpec 2 features while re-implementing the inject method that belongs to the Enumerable module. It is a fun and simple exercise because it reinforces the understanding of blocks and the sometimes confusing nature of the inject method. Here it is.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">&nbsp;
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rspec'</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">module</span> <span style="color:#CC00FF; font-weight:bold;">Enumerable</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> inject<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">*</span>args, <span style="color:#006600; font-weight:bold;">&amp;</span>block<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span>args.<span style="color:#9900CC;">size</span> == <span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      inject_binary_operation<span style="color:#006600; font-weight:bold;">&#40;</span>args<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span>, args<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#0000FF; font-weight:bold;">self</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">elsif</span><span style="color:#006600; font-weight:bold;">&#40;</span>args.<span style="color:#9900CC;">size</span> == <span style="color:#006666;">1</span> <span style="color:#006600; font-weight:bold;">&amp;&amp;</span> !block_given?<span style="color:#006600; font-weight:bold;">&#41;</span>
      inject_binary_operation<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">first</span>, args<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">drop</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">else</span>
      the_memo = args<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">||</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">first</span>
      <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">each</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>item<span style="color:#006600; font-weight:bold;">|</span> the_memo = <span style="color:#9966CC; font-weight:bold;">yield</span><span style="color:#006600; font-weight:bold;">&#40;</span>the_memo, item<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">if</span> block_given? <span style="color:#006600; font-weight:bold;">&#125;</span>
      the_memo
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">alias</span> <span style="color:#ff3333; font-weight:bold;">:reduce</span> <span style="color:#ff3333; font-weight:bold;">:inject</span>
&nbsp;
  private
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> inject_binary_operation<span style="color:#006600; font-weight:bold;">&#40;</span>the_memo, operator, enum<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#CC0066; font-weight:bold;">raise</span> <span style="color:#CC00FF; font-weight:bold;">TypeError</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;#{operator} is not a symbol&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">unless</span> operator.<span style="color:#9900CC;">is_a</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">Symbol</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    enum.<span style="color:#9900CC;">each</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>item<span style="color:#006600; font-weight:bold;">|</span> the_memo = the_memo.<span style="color:#9900CC;">send</span><span style="color:#006600; font-weight:bold;">&#40;</span>operator, item<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
    the_memo
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
shared_examples_for <span style="color:#996600;">&quot;an Enumerable object&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
  describe <span style="color:#996600;">&quot;inject&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
    describe <span style="color:#996600;">&quot;given there is a specified memo value&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
      it<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'should return the newly injected &quot;memo&quot; value if using a block'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
        enumerable.<span style="color:#9900CC;">inject</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">3</span>,<span style="color:#006666;">4</span>,<span style="color:#006666;">5</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>memo, enum_item<span style="color:#006600; font-weight:bold;">|</span> memo.<span style="color:#9966CC; font-weight:bold;">include</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>enum_item<span style="color:#006600; font-weight:bold;">&#41;</span> ? memo : memo <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> enum_item <span style="color:#006600; font-weight:bold;">&#125;</span>.<span style="color:#9900CC;">should</span> == <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">3</span>, <span style="color:#006666;">4</span>, <span style="color:#006666;">5</span>, <span style="color:#006666;">1</span>, <span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#93;</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
      describe <span style="color:#996600;">&quot;when it is a binary operation&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
        it<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'should return a TypeError because the single argument is not a Symbol'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
          <span style="color:#CC0066; font-weight:bold;">lambda</span> <span style="color:#006600; font-weight:bold;">&#123;</span> enumerable.<span style="color:#9900CC;">inject</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>.<span style="color:#9900CC;">should</span> raise_error<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">TypeError</span><span style="color:#006600; font-weight:bold;">&#41;</span>
        <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
        it<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'should add the values'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
          enumerable.<span style="color:#9900CC;">inject</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">2</span>, :<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">should</span> == <span style="color:#006666;">8</span>
        <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
        it<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'should multiply the values'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
          enumerable.<span style="color:#9900CC;">inject</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">2</span>, :<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">should</span> == <span style="color:#006666;">12</span>
        <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
        it<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'should subtract the values'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
          enumerable.<span style="color:#9900CC;">inject</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">2</span>, :<span style="color:#006600; font-weight:bold;">-</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">should</span> == <span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">4</span>
        <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    describe <span style="color:#996600;">&quot;given there isn't a specified memo value&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
      it<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'should return the newly injected &quot;memo&quot; value if using a block'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
        enumerable.<span style="color:#9900CC;">inject</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>memo, enum_item<span style="color:#006600; font-weight:bold;">|</span> memo <span style="color:#006600; font-weight:bold;">&gt;</span> enum_item ? memo : enum_item <span style="color:#006600; font-weight:bold;">&#125;</span>.<span style="color:#9900CC;">should</span> == <span style="color:#006666;">3</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
      describe <span style="color:#996600;">&quot;when it is a binary operation&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
        it<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'should add the values'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
          enumerable.<span style="color:#9900CC;">inject</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;">&#41;</span>.<span style="color:#9900CC;">should</span> == <span style="color:#006666;">6</span>
        <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
        it<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'should multiply the values'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
          enumerable.<span style="color:#9900CC;">inject</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;">&#41;</span>.<span style="color:#9900CC;">should</span> == <span style="color:#006666;">6</span>
        <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
        it<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'should subtract the values'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
          enumerable.<span style="color:#9900CC;">inject</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;">&#41;</span>.<span style="color:#9900CC;">should</span> == <span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">4</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;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>  
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
describe <span style="color:#CC00FF; font-weight:bold;">Range</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
  it_should_behave_like <span style="color:#996600;">&quot;an Enumerable object&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    let<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:enumerable</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">1</span>..<span style="color:#006666;">3</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>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
describe <span style="color:#CC0066; font-weight:bold;">Array</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
  it_should_behave_like <span style="color:#996600;">&quot;an Enumerable object&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    let<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:enumerable</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span>,<span style="color:#006666;">2</span>,<span style="color:#006666;">3</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>I especially like the RSpec documentation format because it provides such great readability. When appropriate the &#8220;shared_examples_for&#8221; is also nice to keep your test suite DRY.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">$ rspec injectable.<span style="color:#9900CC;">rb</span> <span style="color:#006600; font-weight:bold;">--</span><span style="color:#CC0066; font-weight:bold;">format</span> documentation
&nbsp;
<span style="color:#CC00FF; font-weight:bold;">Range</span>
  it should behave like an <span style="color:#CC00FF; font-weight:bold;">Enumerable</span> object
    inject
      given there is a specified memo value
        should <span style="color:#0000FF; font-weight:bold;">return</span> the newly injected <span style="color:#996600;">&quot;memo&quot;</span> value <span style="color:#9966CC; font-weight:bold;">if</span> using a block
        <span style="color:#9966CC; font-weight:bold;">when</span> it is a binary operation
          should <span style="color:#0000FF; font-weight:bold;">return</span> a <span style="color:#CC00FF; font-weight:bold;">TypeError</span> because the single argument is <span style="color:#9966CC; font-weight:bold;">not</span> a <span style="color:#CC00FF; font-weight:bold;">Symbol</span>
          should add the values
          should multiply the values
          should subtract the values
      given there isn<span style="color:#996600;">'t a specified memo value
        should return the newly injected &quot;memo&quot; value if using a block
        when it is a binary operation
          should add the values
          should multiply the values
          should subtract the values
&nbsp;
Array
  it should behave like an Enumerable object
    inject
      given there is a specified memo value
        should return the newly injected &quot;memo&quot; value if using a block
        when it is a binary operation
          should return a TypeError because the single argument is not a Symbol
          should add the values
          should multiply the values
          should subtract the values
      given there isn'</span>t a specified memo value
        should <span style="color:#0000FF; font-weight:bold;">return</span> the newly injected <span style="color:#996600;">&quot;memo&quot;</span> value <span style="color:#9966CC; font-weight:bold;">if</span> using a block
        <span style="color:#9966CC; font-weight:bold;">when</span> it is a binary operation
          should add the values
          should multiply the values
          should subtract the values
&nbsp;
Finished <span style="color:#9966CC; font-weight:bold;">in</span> <span style="color:#006666;">0.007</span> seconds
<span style="color:#006666;">18</span> examples, <span style="color:#006666;">0</span> failures</pre></div></div>

<p>And of course the gist&#8230;<br />
<a href="https://gist.github.com/1096650" target="_blank">https://gist.github.com/1096650</a></p>
]]></content:encoded>
			<wfw:commentRss>http://techwhizbang.com/2011/07/implementing-rubys-inject-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Object Oriented JavaScript</title>
		<link>http://techwhizbang.com/2011/05/object-oriented-javascript/</link>
		<comments>http://techwhizbang.com/2011/05/object-oriented-javascript/#comments</comments>
		<pubDate>Wed, 11 May 2011 07:10:39 +0000</pubDate>
		<dc:creator>techwhizbang</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[object oriented]]></category>

		<guid isPermaLink="false">http://techwhizbang.com/?p=428</guid>
		<description><![CDATA[This is a presentation I gave recently on Object Oriented JavaScript. There is also source code that goes along with it that can be found here: https://github.com/techwhizbang/js_techtalk Object Oriented JavaScript View more presentations from techwhizbang]]></description>
			<content:encoded><![CDATA[<p>This is a presentation I gave recently on Object Oriented JavaScript. There is also source code that goes along with it that can be found here: <a href="https://github.com/techwhizbang/js_techtalk">https://github.com/techwhizbang/js_techtalk</a></p>
<div style="width:425px" id="__ss_7919789"> <strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/techwhizbang/object-oriented-javascript-7919789" title="Object Oriented JavaScript">Object Oriented JavaScript</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/7919789" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
<div style="padding:5px 0 12px"> View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/techwhizbang">techwhizbang</a> </div>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://techwhizbang.com/2011/05/object-oriented-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JavaScript MVC Pattern</title>
		<link>http://techwhizbang.com/2011/04/javascript-mvc-pattern/</link>
		<comments>http://techwhizbang.com/2011/04/javascript-mvc-pattern/#comments</comments>
		<pubDate>Sun, 10 Apr 2011 21:46:06 +0000</pubDate>
		<dc:creator>techwhizbang</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mvc]]></category>

		<guid isPermaLink="false">http://techwhizbang.com/?p=395</guid>
		<description><![CDATA[There are a lot of excellent JavaScript frameworks to choose from that provide some sort of MVC pattern. Of the most popular frameworks under this broad umbrella include Backbone.js, Sencha ExtJS, and SproutCore. All of these frameworks have their strengths, but I really crave simplicity. I really don&#8217;t want to have to read about a [...]]]></description>
			<content:encoded><![CDATA[<p>There are a lot of excellent JavaScript frameworks to choose from that provide some sort of MVC pattern. Of the most popular frameworks under this broad umbrella include Backbone.js, Sencha ExtJS, and SproutCore. All of these frameworks have their strengths, but I really crave simplicity. I really don&#8217;t want to have to read about a framework for a couple hours and fiddle with it before I become productive. I really don&#8217;t want to scrap all of the &#8220;legacy&#8221; JavaScript written and attempt to shoehorn the framework into my project. I really don&#8217;t need all those super fancy UI widgets. You might be thinking the same thing, but you recognize that the way you&#8217;ve been organizing and/or writing JavaScript is flawed. The biggest mistake I see again and again is that the patterns we adhere to when writing in our favorite server side language are thrown to the wind when using JavaScript. Why? Why? Why? I could speculate and throw my theories out there, but none of that really matters. The thing that matters most is that you have recognized that something is wrong and you&#8217;d like to correct it.</p>
<p>I&#8217;d like to offer up a pattern I follow when writing JavaScript.<br />
Let&#8217;s take a look at the JavaScript MVC pattern I follow.</p>
<p>First things first. In your JavaScript directory, create the following folders.</p>
<ul>
<li>controllers</li>
<li>models</li>
<li>views</li>
<li>handlers</li>
<li>pages</li>
</ul>
<p>Handlers? Pages? What? No worries. I will discuss each of these and of course you can fit and mold this pattern to your needs. My examples assume you&#8217;re using <a href="http://jquery.com/" target="_blank">jQuery</a>, but you could use <a href="http://mootools.net/" target="_blank">MooTools</a>, <a href="http://www.prototypejs.org/" target="_blank">prototype</a>, or none of them.</p>
<h3>Models:</h3>
<p>As an example lets say you have some data that represents <em>projects</em>. Create a file under your models directory called <em>project.js</em>. I like to do &#8220;Object-Oriented&#8221; JavaScript so maybe your project.js would look like this.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Project <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>projectId<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">projectId</span> <span style="color: #339933;">=</span> projectId<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
Project.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">find</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>projectId<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  $.<span style="color: #660066;">getJSON</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'projects/'</span> <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">projectId</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'.json'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">//do whatever with your data</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>I&#8217;d also like to point out that I often like to write the JSON or XML I need (when I can) to the page so that I don&#8217;t make superfluous network calls. In this example I created a function called <em>find</em> that makes an Ajax call, but it could be just as simple to read JSON from a hidden element with a custom attribute called &#8220;data&#8221; on it like so.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/*
* Reads JSON from a hidden element on the page with an attribute called 'data'
* Example: &lt;input type=&quot;hidden&quot; /&gt;
*/</span>
&nbsp;
Project.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">all</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>dataSelector<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">return</span> $.<span style="color: #660066;">parseJSON</span><span style="color: #009900;">&#40;</span>dataSelector.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'data'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>My philosophy on JavaScript models is to keep them centered on the retrieval of the data they represent. Nothing more, nothing less.</p>
<h3>Views:</h3>
<p>This is the area where I feel most people go wrong and is generally my biggest gripe. How many times have you cracked open a .js file and found N-instances of the selector flying all over the code. Let me clarify. For example, you have a project carousel widget on your site and the selector has an id, namely <em>projects</em>. So everywhere, you look</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#projects'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">something</span></pre></div></div>

<p>is recklessly abundant all throughout the code. Good luck re-factoring or repurposing that, even _with_ tests, especially after a few months.</p>
<p>Now, had you captured all the selectors for your <em>projects</em> view in a file managed under the views directory and properly added a layer of encapsulation. It would have taken you 2 seconds to swap whatever existing selectors there were with a new one or perhaps extended your projects view. Sometimes I like to use a view factory to encapsulate my views. Again, you don&#8217;t have to use the factory pattern you could just run the prototype pattern directly. Here is an example:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">ProjectViewFactory <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #003366; font-weight: bold;">function</span> BaseProjectView<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #000066;">name</span> <span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;baseProjectView&quot;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
  BaseProjectView.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">getProjectDataSelector</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#projects'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #003366; font-weight: bold;">function</span> CarouselProjectView<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #000066;">name</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;carouselProjectView&quot;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
  <span style="color: #006600; font-style: italic;">//I hand rolled a simple inheritance mechanism, you can find it under my Github account as inheritance.js</span>
  CarouselProjectView.<span style="color: #660066;">inheritsFrom</span><span style="color: #009900;">&#40;</span>BaseProjectView<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  CarouselProjectView.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">getProjectDataSelector</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#carouselProjects'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
  CarouselProjectView.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">getNextSelector</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">getProjectDataSelector</span>.<span style="color: #660066;">select</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.next'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
  CarouselProjectView.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">getPreviousSelector</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">getProjectDataSelector</span>.<span style="color: #660066;">select</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.previous'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#123;</span>
    getCarouselProjectView<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">new</span> CarouselProjectView<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The fundamental concept is to align your view widgets on a page to a file managed under the views directory. Anytime, you use a selector it better be in a file like this. Never leak a selector outside the views directory. It is a very simple and straightforward rule to remember.</p>
<h3>Controllers:</h3>
<p>I like to keep my controllers slim and trim akin to the principle used very often in the Rails community.<br />
Your controllers should be passed the appropriate views required to activate and listen for the appropriate binding events (ie click, mouseover, etc). The controller should only bind the events and then hand the rest of the actual duties off to what I call a <i>handler</i> (we&#8217;ll discuss handlers next). Here is an example:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">ProjectsController <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
   <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#123;</span>
&nbsp;
   bindEvents <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>projectsView<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #003366; font-weight: bold;">var</span> projectModel <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Project<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #003366; font-weight: bold;">var</span> projectHandler <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> ProjectHandler<span style="color: #009900;">&#40;</span>projectsView<span style="color: #339933;">,</span> projectModel<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
     projectsView.<span style="color: #660066;">getNextSelector</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
       projectHandler.<span style="color: #660066;">updateToNext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
     projects.<span style="color: #660066;">getPreviousSelector</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
       projectHandler.<span style="color: #660066;">updateToPrevious</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>Handlers:</h3>
<p>I&#8217;d like to introduce one more letter in the MVC acronym, &#8220;H&#8221;. A handler is in charge of the dirty work bound to the event triggered. So you can imagine that with a project carousel with a next and previous button that several different things might happen like an image transition, description, numbering, etc.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">ProjectHandler <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>projectView<span style="color: #339933;">,</span> projectModel<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">projectView</span> <span style="color: #339933;">=</span> projectView<span style="color: #339933;">;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">projectModel</span> <span style="color: #339933;">=</span> projectModel<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
ProjectHandler.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">updateToPrevious</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #006600; font-style: italic;">// fill in the details here</span>
<span style="color: #009900;">&#125;</span>
ProjectHandler.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">updateToNext</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #006600; font-style: italic;">// fill in the details here</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h3>Pages:</h3>
<p>The last and final piece of the puzzle. So a page may consist of many different things including a project carousel, recommendations, comments, and whatever else you can dream up. Assuming you followed the rules given above that means you&#8217;ve developed a projects, recommendations, and comments controller along with their corresponding views, models, and handlers.<br />
So a <i>page</i> might look something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">SomeAwesomePage <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#123;</span>
    bindEvents<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #006600; font-style: italic;">//initialize the views needed here</span>
      ProjectsController.<span style="color: #660066;">bindEvents</span><span style="color: #009900;">&#40;</span>projectsView<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      RecommendationsController.<span style="color: #660066;">bindEvents</span><span style="color: #009900;">&#40;</span>recommendationsView<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      CommentsController.<span style="color: #660066;">bindEvents</span><span style="color: #009900;">&#40;</span>commentsView<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Following this pattern lends itself to a very flexible and modular design. It is totally agnostic to other frameworks that you might already be using. The beauty part of this approach is that you can take a pure JavaScript approach without the bulkiness or dependency on yet another pre-defined framework and spin it to the needs of your project. I always encourage testing JavaScript. Recently I&#8217;ve been pairing this pattern with Jasmine.</p>
]]></content:encoded>
			<wfw:commentRss>http://techwhizbang.com/2011/04/javascript-mvc-pattern/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JavaScript Testing with Jasmine</title>
		<link>http://techwhizbang.com/2011/02/javascript-testing-with-jasmine/</link>
		<comments>http://techwhizbang.com/2011/02/javascript-testing-with-jasmine/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 01:35:51 +0000</pubDate>
		<dc:creator>techwhizbang</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[bdd]]></category>
		<category><![CDATA[jasmine]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://techwhizbang.com/?p=385</guid>
		<description><![CDATA[This is a presentation I gave on the use of Jasmine, a BDD testing framework for JavaScript. Examples of Jasmine specs can be found here: https://github.com/techwhizbang/js_techtalk. Have a look at my presentation on Object Oriented JavaScript also. Testing JavaScript with Jasmine View more presentations from techwhizbang.]]></description>
			<content:encoded><![CDATA[<p>This is a presentation I gave on the use of Jasmine, a BDD testing framework for JavaScript. Examples of Jasmine specs can be found here: <a href="https://github.com/techwhizbang/js_techtalk">https://github.com/techwhizbang/js_techtalk</a>.<br />
Have a look at my presentation on <a href="http://techwhizbang.com/2011/05/object-oriented-javascript/">Object Oriented JavaScript</a> also.</p>
<div style="width:425px" id="__ss_7037839"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/techwhizbang/testing-javascript-with-jasmine" title="Testing JavaScript with Jasmine">Testing JavaScript with Jasmine</a></strong><object id="__sse7037839" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=unittestingjavascript-110223193423-phpapp02&#038;stripped_title=testing-javascript-with-jasmine&#038;userName=techwhizbang" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed name="__sse7037839" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=unittestingjavascript-110223193423-phpapp02&#038;stripped_title=testing-javascript-with-jasmine&#038;userName=techwhizbang" 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/techwhizbang">techwhizbang</a>.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://techwhizbang.com/2011/02/javascript-testing-with-jasmine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MongoDB Presentation Part 2</title>
		<link>http://techwhizbang.com/2011/01/mongodb-part-2/</link>
		<comments>http://techwhizbang.com/2011/01/mongodb-part-2/#comments</comments>
		<pubDate>Wed, 19 Jan 2011 21:31:18 +0000</pubDate>
		<dc:creator>techwhizbang</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[nosql]]></category>

		<guid isPermaLink="false">http://techwhizbang.com/?p=373</guid>
		<description><![CDATA[MongoDB Part 2 View more presentations from techwhizbang.]]></description>
			<content:encoded><![CDATA[<div style="width:425px" id="__ss_6631050"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/techwhizbang/mongodb-part-2" title="MongoDB Part 2">MongoDB Part 2</a></strong><object id="__sse6631050" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=mongodbpartii-110119152914-phpapp01&#038;stripped_title=mongodb-part-2&#038;userName=techwhizbang" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed name="__sse6631050" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=mongodbpartii-110119152914-phpapp01&#038;stripped_title=mongodb-part-2&#038;userName=techwhizbang" 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/techwhizbang">techwhizbang</a>.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://techwhizbang.com/2011/01/mongodb-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Intro to MongoDB Presentation</title>
		<link>http://techwhizbang.com/2011/01/intro-to-mongodb-presentation/</link>
		<comments>http://techwhizbang.com/2011/01/intro-to-mongodb-presentation/#comments</comments>
		<pubDate>Thu, 06 Jan 2011 05:38:59 +0000</pubDate>
		<dc:creator>techwhizbang</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[nosql]]></category>

		<guid isPermaLink="false">http://techwhizbang.com/?p=366</guid>
		<description><![CDATA[MongoDB View more presentations from techwhizbang. Here is the second part of the presentation I gave: http://techwhizbang.com/2011/01/mongodb-part-2/]]></description>
			<content:encoded><![CDATA[<div style="width:425px" id="__ss_6463802"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/techwhizbang/mongodb-6463802" title="MongoDB">MongoDB</a></strong><object id="__sse6463802" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=mongodb-110105233629-phpapp02&#038;stripped_title=mongodb-6463802&#038;userName=techwhizbang" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed name="__sse6463802" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=mongodb-110105233629-phpapp02&#038;stripped_title=mongodb-6463802&#038;userName=techwhizbang" 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/techwhizbang">techwhizbang</a>.</div>
</div>
<p>Here is the second part of the presentation I gave:<br />
<a href="http://techwhizbang.com/2011/01/mongodb-part-2/">http://techwhizbang.com/2011/01/mongodb-part-2/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://techwhizbang.com/2011/01/intro-to-mongodb-presentation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 1.389 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-05-20 10:09:32 -->

