<?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>Miško Hevery</title>
	<atom:link href="http://misko.hevery.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://misko.hevery.com</link>
	<description>Testability Explorer</description>
	<lastBuildDate>Fri, 30 Jul 2010 02:29:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>&lt;angular/&gt;: A Radically Different Way of Building AJAX Apps</title>
		<link>http://misko.hevery.com/2010/07/29/a-radically-different-way-of-building-ajax-apps/</link>
		<comments>http://misko.hevery.com/2010/07/29/a-radically-different-way-of-building-ajax-apps/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 02:28:32 +0000</pubDate>
		<dc:creator>misko</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://misko.hevery.com/?p=629</guid>
		<description><![CDATA[

source snippets
]]></description>
			<content:encoded><![CDATA[<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/elvcgVSynRg&amp;hl=en_US&amp;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/elvcgVSynRg&amp;hl=en_US&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
<p><iframe src="https://docs.google.com/present/embed?id=d449gch_254g873k7ff" frameborder="0" width="410" height="342"></iframe></p>
<p><a src="https://docs.google.com/document/pub?id=1ZHVhqC0apbzPRQcgnb1Ye-bAUbNJ-IlFMyPBPCZ2cYU">source snippets</a></p>
]]></content:encoded>
			<wfw:commentRss>http://misko.hevery.com/2010/07/29/a-radically-different-way-of-building-ajax-apps/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How JavaScript Works</title>
		<link>http://misko.hevery.com/2010/07/14/how-javascript-works/</link>
		<comments>http://misko.hevery.com/2010/07/14/how-javascript-works/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 01:17:32 +0000</pubDate>
		<dc:creator>misko</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://misko.hevery.com/?p=625</guid>
		<description><![CDATA[Just a quick presentation I have done on JavaScript.
video:

slides:

]]></description>
			<content:encoded><![CDATA[<p>Just a quick presentation I have done on JavaScript.</p>
<p>video:<br />
<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/ljNi8nS5TtQ&amp;hl=en_US&amp;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/ljNi8nS5TtQ&amp;hl=en_US&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
<p>slides:<br />
<iframe src="http://docs.google.com/present/embed?id=d449gch_253cz63vddn" frameborder="0" width="410" height="342"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://misko.hevery.com/2010/07/14/how-javascript-works/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Dependency-Injection and JavaScript closures</title>
		<link>http://misko.hevery.com/2010/05/29/dependency-injection-and-javascript-closures/</link>
		<comments>http://misko.hevery.com/2010/05/29/dependency-injection-and-javascript-closures/#comments</comments>
		<pubDate>Sun, 30 May 2010 04:59:53 +0000</pubDate>
		<dc:creator>misko</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://misko.hevery.com/?p=623</guid>
		<description><![CDATA[As you can tell I am a big fan of DI, but I kept hearing that DI is not needed with dynamic languages, so after using JS for many months I am happy to say that DI is important there as well. In other words dependency managment and controll matters. But it is different.
Say you [...]]]></description>
			<content:encoded><![CDATA[<p>As you can tell I am a big fan of DI, but I kept hearing that DI is not needed with dynamic languages, so after using JS for many months I am happy to say that DI is important there as well. In other words dependency managment and controll matters. But it is different.</p>
<p>Say you have a class for greeting with DI.</p>
<pre>class Greeter {
  String greeting;
  Greeter(String greeting) {
    this.greeting = greeting;
  }
  void greet(String name) {
    System.out.println(this.greeting + name);
  }
}</pre>
<p>Since the class only has one responsibility it only has one method. Now we can rewrite this in JavaScript in OO way like this:</p>
<pre>function Greeter(greeting) {
  this.greeting = greeting;
}
Greeting.prototype.greet = function(name){
  alert(this.greeting + name);
};</pre>
<p>While this code is fine, it does not follow the spirit of JavaScript which is a functional language. Why have a Greeter noun when you can just have greet verb. (see: <a href="http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html">Execution in the kingdom of nouns</a>) So let&#8217;s rewrite it in functional style:</p>
<pre>function greetFactory(greeting) {
  return function(name) {
    alert(greeting + name);
  };
}</pre>
<p>so usage changes from:</p>
<pre>var greeter = new Greeter('Hello ');
greeter.greet('misko');</pre>
<p>to:</p>
<pre>var greet = greetFactory('Hello ');
greet('Misko');</pre>
<p>Notice that in all cases the DI of greeting is preserved just fine. Now here comes an interesting thing. Objects have scopes. For example the alert method in JavaScript (or System.out.println method in Java) needs to be DI as well since we want to verify that the right thing is printed in test. But the alert method needs to be injected not just into our function but most likely into hundreds of other functions in our application. It is kind of a singleton. So in java we have to do this:</p>
<pre>class Greeter {
  String greeting;
  OutputStream out;
  Greeter(OutputStream out, String greeting) {
    this.out = out;
    this.greeting = greeting;
  }

  void greet(String name) {
    out.println(this.greeting + name);
  }
}</pre>
<p>The JavaScript equivalent would be:</p>
<pre>function greetFactory(alert, greeting) {
  return function(name) {
    alert(greeting + name);
  };
}</pre>
<p>But that means that we are no better than Java in injecting the same thing everywhere. The trick is in realizing that object injection is nested in scopes, and that every factory which needs alert share the same alert so we can rewrite this like this;</p>
<pre>function createFactories(alert) {
  return {
    greetFactory: function(greeting) {
       return function(greet) {
          alert(greeting + greet);
       };
    },
    someOtherFactory: function(...) {
       return function(...){ alert(...); };
    }
  };
}</pre>
<p>When you are ready to bootstarap your app you can:</p>
<pre>var factories = createFactories(myAlert);
var greet = factories.createGreet('Hello ');
greet('Misko');</pre>
]]></content:encoded>
			<wfw:commentRss>http://misko.hevery.com/2010/05/29/dependency-injection-and-javascript-closures/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Do it Yourself &#8211; Dependency Injection</title>
		<link>http://misko.hevery.com/2010/05/26/do-it-yourself-dependency-injection/</link>
		<comments>http://misko.hevery.com/2010/05/26/do-it-yourself-dependency-injection/#comments</comments>
		<pubDate>Wed, 26 May 2010 17:10:26 +0000</pubDate>
		<dc:creator>misko</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://misko.hevery.com/?p=619</guid>
		<description><![CDATA[A friend of mine has put together a set of documents which talk about do-it-yourself dependency-inject. Being that I am a fan of DI and how it helps with testability I wanted to share it with you. It is a good read for anyone interested in getting better at DI.
by Chad Parry
I want to evangelize [...]]]></description>
			<content:encoded><![CDATA[<p>A friend of mine has put together a set of documents which talk about <a href="http://blacksheep.parry.org/archives/diy-di/print/">do-it-yourself dependency-inject.</a> Being that I am a fan of DI and how it helps with testability I wanted to share it with you. It is a good read for anyone interested in getting better at DI.</p>
<p>by Chad Parry</p>
<p>I want to evangelize this technique so that people know a lightweight way they can adopt DI. I think we need to refine the definition of dependency injection. It shouldn&#8217;t mean the use of a framework like Guice, because that&#8217;s just one possible implementation. It should mean the separation of glue code from business logic. The glue code, (which is represented by annotations in Guice, but could just as well be static helpers), is neither easy nor important to test. On the other hand, the business logic should be made easy to test. The secret to testability does not lie in removing untestable code as much as in segregating the untestable code.</p>
<p>The “dependency injection” (DI) technique is a way to improve testability and maintainability of object-oriented code. Typically adoption of dependency injection is coupled with adoption of a dependency injection framework, such as <a rel="external" href="http://code.google.com/p/google-guice/">Guice</a> <sup>[1]</sup> or <a rel="external" href="http://www.springsource.org/">Spring</a> <sup>[2]</sup>. These materials show how dependency injection can be accomplished without any framework. The same benefits provided by frameworks can be realized using “do-it-yourself” (DIY) handcrafted code. This model is named DIY-DI, pronounced <em>die-die</em>.</p>
<ul>
<li><strong><a rel="external" href="http://docs.google.com/present/view?id=dg4jbg5c_7cwkvrhfq">State of the Art Testability</a> <sup>[3]</sup></strong> (online slide deck, also available in <a rel="external" href="http://blacksheep.parry.org/wp-content/uploads/2010/03/State-of-the-Art-Testability.ppt">PowerPoint</a> <sup>[4]</sup>)</li>
<li><strong><a rel="external" href="http://blacksheep.parry.org/wp-content/uploads/2010/03/DIY-DI.pdf">DIY-DI</a> <sup>[5]</sup></strong> (accompanying how-to manual)</li>
<li><strong><a rel="external" href="http://blacksheep.parry.org/wp-content/uploads/2010/03/DIPresentation.zip">DIPresentation</a> <sup>[6]</sup></strong> (accompanying code examples)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://misko.hevery.com/2010/05/26/do-it-yourself-dependency-injection/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Move over Java, I have fallen in love with JavaScript</title>
		<link>http://misko.hevery.com/2010/04/07/move-over-java-i-have-fallen-in-love-with-javascript/</link>
		<comments>http://misko.hevery.com/2010/04/07/move-over-java-i-have-fallen-in-love-with-javascript/#comments</comments>
		<pubDate>Thu, 08 Apr 2010 04:20:16 +0000</pubDate>
		<dc:creator>misko</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://misko.hevery.com/?p=616</guid>
		<description><![CDATA[I spent the past year developing &#60;angular/&#62; in JavaScript (client) and Ruby on the server, and I have totally changed my opinion of dynamic languages, and I wanted to share some thought with you.
Tests are a must
Compilers are great at telling you that you have miss-typed something or that you assumptions about classes are wrong, [...]]]></description>
			<content:encoded><![CDATA[<p>I spent the past year developing <a href="http://www.getangular.com">&lt;angular/&gt;</a> in JavaScript (client) and Ruby on the server, and I have totally changed my opinion of dynamic languages, and I wanted to share some thought with you.</p>
<h3>Tests are a must</h3>
<p>Compilers are great at telling you that you have miss-typed something or that you assumptions about classes are wrong, but so is executing the code. So if all of my code is already exercised by the tests, than why do I need to have additional check of the compiler. Compile does not make the need for tests to go away, but the tests do make the need for compiler to go away. So if you have close to 100% coverage than you don&#8217;t need compiler to tell you that you mistyped something.</p>
<p>To get close to 100% coverage, you need to do tests first, and it has to be second nature to you. I run all of my JavaScript tests on every save across most browser using <a href="http://misko.hevery.com/2009/12/04/there-are-lots-of-ways-to-tests-your-javascript-but-there-is-only-one-jstestdriver/">JSTestDriver</a> and all my tests execute under a second. This instant feedback on every save is as good as having Eclipse underline your code that you made a mistake, and so I really don&#8217;t miss the compiler.</p>
<p>I can see how a dynamic language can be a nightmare if you don&#8217;t have tests.</p>
<h3>Tests are easier to write</h3>
<p>Since there are is no compiler to harrass you about types, it is very easy to fake out dependencies. Are you expecting a complicated class, but you know that in your test you are only exercising one method which should return a constant? Piece of cake! Create a nameless object with a single property which has the method and you are done.</p>
<h3>Typing is a lot of typing</h3>
<p>Typing as the name implies, is just that a lot of typing.</p>
<pre>Java:
  List&lt;Book&gt; books = new ArrayList&lt;Book&gt;();

JavaScript:
  var books = [];</pre>
<p>Look how much longer java line is and how much shorter JavaScript is. Is there any information missing? Both say that I have a list of Books, but one says it by convention (variable names ending in &#8217;s&#8217; are arrays of the name) where as the other is explicit and makes me repeat myself by typing book three times and List twice. (Tests, prove that my code works, no need for compiler.)</p>
<h3>Code Density</h3>
<p>Code Density in dynamic languages are phenomenal! All of the endless casting, coercing and repetition in declaration simply is not there resulting in very dense code. But, I am master Eclipse jedi and  can generate all of that verbosity with few keystrokes so typing is not an issue! True, but reading/compression is! 10 lines of code are easier to understand than 100, and in JavaScript those 10 lines often do more than 100 in Java. (To start with 100 lines of code does not fit on my screen at once.) Turns out JavaScript is still wordy and <a href="http://jashkenas.github.com/coffee-script/">CoffeeScript</a> is even better!</p>
<h3>Functions as first class citizens &amp; Classes with single methods are functions</h3>
<p>Having functions as first class citizens which can be passed around is awesome! See <a href="http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html">Execution in the Kingdom of Nouns</a>! Functions are verbs, and you need both, verbs and nouns to make a sentence.</p>
<p>Recently I got an email from someone pointing out that doing proper <a href="http://misko.hevery.com/code-reviewers-guide/flaw-class-does-too-much/">Single Responsibility Principle</a>, often resulted in classes which had exactly one method. Odd? Well, actually, it is a function in disguise.</p>
<h3>Function closure == Constructor injection</h3>
<p>If Class with one method is a function, than dependency injection for that class is the functions closure. Where the function is created specifies what are its dependencies and its visibility, nicely solving the dependency injection problem for functions.</p>
<h3>JavaScript is so simple</h3>
<p>I am constantly in awe, just how simple JavaScript really is! I can explain all of the rules of JavaScript to you in few hours, something which I can not do with Java. And yet, I feel like JavaScript is so much more powerful than Java because it has functions as first class citizens.</p>
<h3>Everything is still true</h3>
<p>All of the things which I have talked about in my blog is still true. Dependency Injection is a must and JavaScript&#8217;s dynamic nature does not make go away. Anyone who claims that DI is only for Java and that his language somehow makes it exempt form the rules of managing your dependencies, needs to lear more about DI. Similarly global state is a bad idea, and JavaScript is extra bad here, as global is the default and you have to do extra typing to get propers scoping, same goes to functions and their default affinity to global state. Bad JavaScript, Bad! Separation of <a href="http://misko.hevery.com/2008/07/08/how-to-think-about-the-new-operator/">wiring from logic</a> still holds true and no amount monkey patching, will keep you sane in the long run.</p>
<h3>Where did the inheritance go?</h3>
<p>I have written 10,000&#8217;s of lines of JavaScript and I am yet to come across a need for inheritance. Where did it go? Proper use of inheritance == polymorphic behavior but one can get that with duck typing just by implementing the right kind of methods.</p>
<h3>Scaling the Team</h3>
<p>I have heard this many times before: I like (insert your dynamic language here) for the first 1000 lines than I miss my types. Well, I have written 10,000&#8217;s of lines and I don&#8217;t miss the compiler one bit, quite the opposite I have learned to loath when I am back in Java and the compiler gets in the way. So why is my experience different? One word: Tests! I am very serious about testing, and so are my team mates! As long as you have tests, lack of compiler is not a problem and the code scales just fine across more team members. But argument can be made that it scales better:</p>
<ol>
<li>Less code to maintain, write and understand</li>
<li>If you can&#8217;t understand it, just rewrite it, after all its just couple of hundred lines, how long can it take you?</li>
</ol>
<h3>JavaScript on the Server</h3>
<p>Developing web-applications means that you have to be expert in both Java and JavaScript, but lets fix that problem by moving JavaScript to the server. <a href="http://nodejs.org/">Node.js</a> is a perfect example of that, and I love it.</p>
<h3>Non-blocking API</h3>
<p>Non-blocking API are a stroke of Genius! In short it makes it impossible to write slow tests. After all how can you make the tests slow if all method calls return immediately? That is the reason why I can execute 400 test in under 500ms an every save.</p>
]]></content:encoded>
			<wfw:commentRss>http://misko.hevery.com/2010/04/07/move-over-java-i-have-fallen-in-love-with-javascript/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
		<item>
		<title>Growing Object-Oriented Software, Guided by Tests</title>
		<link>http://misko.hevery.com/2010/01/06/growing-object-oriented-software-guided-by-tests/</link>
		<comments>http://misko.hevery.com/2010/01/06/growing-object-oriented-software-guided-by-tests/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 18:18:09 +0000</pubDate>
		<dc:creator>misko</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://misko.hevery.com/?p=611</guid>
		<description><![CDATA[Recently I have came across an excellent book on how to develop code with testing in mind, and I wanted to share it with you. The book is called Growing Object-Oriented Software, Guided by Tests and is written by Steve Freeman and Nat Pryce.
The book starts right at the beggining as to why we want [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I have came across an excellent book on how to develop code with testing in mind, and I wanted to share it with you. The book is called <a href="http://www.amazon.com/gp/product/0321503627?ie=UTF8&amp;tag=testabexplor-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0321503627">Growing Object-Oriented Software, Guided by Tests</a><img style="border:none !important; margin:0px !important;" src="http://www.assoc-amazon.com/e/ir?t=testabexplor-20&amp;l=as2&amp;o=1&amp;a=0321503627" border="0" alt="" width="1" height="1" /> and is written by Steve Freeman and Nat Pryce.</p>
<p>The book starts right at the beggining as to why we want to develop test first and covers advanced topics such as testing persistance, threads, and asynchronous code. I particulary like the style with which the book delivers the message. They start by building a simple application and add new requirements to it, morphing the codebase in the process. As they do so they introduce new classes and walk the reader through the thought process considering alternatives finally choosing a solution. This gives the reader a good understanding as to what to think about when looking at code. Of course all of these changes are driven by tests, and a lot of discussion is spent on explaining why a test was written in a particular way and how to refactor it as it grows with the applications, so that tests do not become a liability.</p>
<p>Reading the book I sometimes felt that I was listening to myself, especially when the authors warned about global state, singletons, overusing mocks, and doing work in constructors among other things. But unlike myself, who draws sharp lines between right and wrong, the authors did a good job of presenting things on the gray scale of benefits and drawbacks. The book shows what a typical code most people will write, and then show how tests point a way towards refactoring.</p>
<p>If you are newbie, or an intermediate to developing with tests than this book is a must for your library!</p>
]]></content:encoded>
			<wfw:commentRss>http://misko.hevery.com/2010/01/06/growing-object-oriented-software-guided-by-tests/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>There are lots of ways to tests your JavaScript, but there is only one JsTestDriver</title>
		<link>http://misko.hevery.com/2009/12/04/there-are-lots-of-ways-to-tests-your-javascript-but-there-is-only-one-jstestdriver/</link>
		<comments>http://misko.hevery.com/2009/12/04/there-are-lots-of-ways-to-tests-your-javascript-but-there-is-only-one-jstestdriver/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 14:56:54 +0000</pubDate>
		<dc:creator>misko</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://misko.hevery.com/?p=607</guid>
		<description><![CDATA[Difference between JsTestDriver and other testing solution is the difference between flying economy and flying First Class. If you are serious about testing and TDD, than JsTestDriver is for you.
It is not another Assertion Framework
JsTestDriver as the name suggest, is not another assertion framework, but rather test runner. It can easily integrate with other assertion [...]]]></description>
			<content:encoded><![CDATA[<p>Difference between JsTestDriver and other testing solution is the difference between flying economy and flying First Class. If you are serious about testing and TDD, than JsTestDriver is for you.</p>
<p><strong>It is not another Assertion Framework</strong><br />
JsTestDriver as the name suggest, is not another assertion framework, but rather test runner. It can easily integrate with other assertion frameworks out there. There are already adapters for <a href="http://code.google.com/p/js-test-driver/wiki/XUnitCompatibility">QUnit, and Yahoo Testing Frameworks, as well as Ruby autotest runner</a>. We will help you integrate your favorite test runner.</p>
<p><strong>Speed</strong><br />
JsTestDriver is blink of an eye fast. <a href="http://www.getangular.com">&lt;angular/&gt;</a> is no small JavaScript project and it has about 300 unit tests and 10K lines of JavaScript. With JsTestDriver I can execute all of the tests on all major browser in under 400ms. That means that I run all of my tests on every save, giving me instantaneous feedback.</p>
<p><strong>IDE Integration</strong><br />
It is nice to be able to run your unit tests in a browser but it is better to be able to run them from the the IDE. We have integration with <a href="http://code.google.com/p/js-test-driver/wiki/UsingTheEclipsePlugin">Eclipse</a> and InteliJ with instant run on every change. We even marshal the browser console into the IDE console for easier debugging.</p>
<p><strong>Continuos Build Integration</strong><br />
If you are serious about testing, than you are serious about <a href="http://code.google.com/p/js-test-driver/wiki/ContinuousBuild">continuous integration</a>. Because JsTestDriver can be controlled from the command line, it can easily integrate into your continuous build. Single command starts the browsers, runs the tests, and reports the test results in a XML file which is compatible with most continuos integration servers such as Hudson.</p>
<p><strong>Code Coverage Built In</strong><br />
JsTestDriver allows JavaScript instrumentation on the fly, which means that it can instrument your code for <a href="http://code.google.com/p/js-test-driver/wiki/CodeCoverage">coverage and generate LCOV</a> format, which can be easily converted into source annotated report of your code. This is done transparently and works on all browsers.</p>
<p><strong>Remote Test Execution</strong><br />
I develop on Mac, but need to test on IE. I run JsTestDriver on my build machine which can be accessed by HTTP and have IE always captured. No matter where I am in the world, I can run my tests against IE. This allows me to have a small browser farm ready to do my bidding.</p>
<p><strong>Support form Mobile Browsers</strong><br />
Just as I can capture desktop browsers, I can also capture mobile browsers. This allows me to develop in my favorite IDE and have my tests run on every save on the mobile platform.</p>
]]></content:encoded>
			<wfw:commentRss>http://misko.hevery.com/2009/12/04/there-are-lots-of-ways-to-tests-your-javascript-but-there-is-only-one-jstestdriver/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>DZone Interview &#8211; Benefits of Testable Code</title>
		<link>http://misko.hevery.com/2009/11/18/dzone-interview-benefits-of-testable-code/</link>
		<comments>http://misko.hevery.com/2009/11/18/dzone-interview-benefits-of-testable-code/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 10:20:48 +0000</pubDate>
		<dc:creator>misko</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://misko.hevery.com/?p=604</guid>
		<description><![CDATA[http://java.dzone.com/articles/benefits-testable-code
]]></description>
			<content:encoded><![CDATA[<p><a href="http://java.dzone.com/articles/benefits-testable-code">http://java.dzone.com/articles/benefits-testable-code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://misko.hevery.com/2009/11/18/dzone-interview-benefits-of-testable-code/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to get Started with TDD</title>
		<link>http://misko.hevery.com/2009/11/17/how-to-get-started-with-tdd/</link>
		<comments>http://misko.hevery.com/2009/11/17/how-to-get-started-with-tdd/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 09:50:12 +0000</pubDate>
		<dc:creator>misko</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://misko.hevery.com/?p=599</guid>
		<description><![CDATA[Best way to learn TDD is to have someone show you while pairing with you. Short of that, I have set up an eclipse project for you where you can give it a try:

hg clone https://bitbucket.org/misko/misko-hevery-blog/
Open project blog/tdd/01_Calculator in Eclipse.
It should be set up to run all tests every time you modify a file.

You may [...]]]></description>
			<content:encoded><![CDATA[<p>Best way to learn TDD is to have someone show you while pairing with you. Short of that, I have set up an eclipse project for you where you can give it a try:</p>
<ol>
<li><span style="font-family: monospace; white-space: pre;">hg clone <a href="https://bitbucket.org/misko/misko-hevery-blog/">https://bitbucket.org/misko/misko-hevery-blog/</a></span></li>
<li>Open project <span style="font-family: monospace, 'Times New Roman', 'Bitstream Charter', Times, serif;"><span style="white-space: pre;">blog/tdd/01_Calculator</span></span> in Eclipse.</li>
<li>It should be set up to run all tests every time you modify a file.
<ul>
<li>You may have to change the path to java if you are not an Mac OS.</li>
<li>Project -&gt; Properties -&gt; Builders -&gt; Test -&gt; Edit</li>
<li>Change location to your java</li>
</ul>
</li>
<li>Right-click on Calculator.java -&gt; Run As -&gt; Java Application to run the calculator</li>
</ol>
<p>Your mission is to make the calculator work using TDD. This is the simplest form of TDD where you don&#8217;t have to mock classes or create complex interactions, so it should be a good start for beginners.</p>
<p>TDD means:</p>
<ol>
<li>write a simple test, and assert something interesting in it</li>
<li> implement just enough to make that tests green (nothing more, or you will get ahead of your tests)</li>
<li>then write another test, rinse, and repeat.</li>
</ol>
<p>I have already done all of the work of separating the behavior from the UI, so that the code is testable and properly Dependency Injected, so you don&#8217;t have to worry about running into testability issues.</p>
<ul>
<li>Calculator.java: This is the main method and it is where all of the wiring is happening.</li>
<li>CalculatorView.java: This is a view and we don&#8217;t usually bother unit testing it has cyclomatic complexity of one, hence there is no logic. It either works or does not. Views are usually good candidates for end-to-end testing, which is not part of this exercise.</li>
<li>CalculatorModel.java: is just a PoJo which marshals data from the Controller to the View, not much to test here.</li>
<li>CalculatorController.java: is where all of your if statements will reside, and we need good tests for it.</li>
</ul>
<p>I have started you off with first &#8216;testItShouldInitializeToZero&#8217; test. Here are some ideas for next tests you may want to write.</p>
<ul>
<li>testItShouldConcatinateNumberPresses</li>
<li>testItShouldSupportDecimalPoint</li>
<li>testItShouldIgnoreSecondDecimalPoint</li>
<li>testItShouldAddTwoIntegers</li>
</ul>
<p>I would love to see what you will come up with and what your thoughts are, after you get the whole calculator working. I would also encourage you to post interesting corner case tests here for others to incorporate. If you want to share your code with others, I would be happy to post your solutions.</p>
<p>Good luck!</p>
<p>PS: I know it is trivial example, but you need to start someplace.</p>
]]></content:encoded>
			<wfw:commentRss>http://misko.hevery.com/2009/11/17/how-to-get-started-with-tdd/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>GTAC 2009 &#8211; JsTestDriver</title>
		<link>http://misko.hevery.com/2009/11/06/gtac-2009-jstestdriver/</link>
		<comments>http://misko.hevery.com/2009/11/06/gtac-2009-jstestdriver/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 16:58:02 +0000</pubDate>
		<dc:creator>misko</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://misko.hevery.com/?p=595</guid>
		<description><![CDATA[Google Tech Talk
October 22, 2009
ABSTRACT
Presented by Jeremie Lenfant -Engelmann, Google, at the 4th Annual Google Test Automation Conference, October 21st, 22nd, 2009, Zurich, CH
The proliferation of JavaScript unit-testing frameworks in the JavaScript community shows that no one has yet found the magical combination of features to make JavaScript testing a no-brainer. We like to believe [...]]]></description>
			<content:encoded><![CDATA[<p><span style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: transparent; background-position: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;">Google Tech Talk<br />
October 22, 2009</p>
<p>ABSTRACT</p>
<p>Presented by Jeremie Lenfant -Engelmann, Google, at the 4th Annual Google Test Automation Conference, October 21st, 22nd, 2009, Zurich, CH</p>
<p>The proliferation of JavaScript unit-testing frameworks in the JavaScript community shows that no one has yet found the magical combination of features to make JavaScript testing a no-brainer. We like to believe that JsTestDriver will change that by redefining JavaScript testing frameworks and as a result will deliver something which at first glance seems impossible. As a developer of JavaScript I want to write my production and test code in my favorite IDE. When I make a code change, I want a save action to trigger a rerun off all of my tests on all browsers and platforms and report the results under 1 second. All of this without ever leaving my favorite IDE. JsTestDriver achieves all of the above by capturing any number of browser slaves from multiple platforms. In order to run at high speed we do not render our results in the browser but report the errors on the command line. JsTestDriver also loads and parses JavaScript files eagerly, only reloading files that have changed. JsTestDriver can execute hundreds of tests per browser and execute them on all of the captured browsers in parallel. Thanks to these practices we achieve extremely high throughput. We want to be a test-runner platform and allow others to build assertion frameworks on top of JsTestDriver. This way the open-source community can focus on building a better way of testing and not worry about how to run the tests across all of the browsers, platforms and in a continuous build environment.<br />
<a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: transparent; color: #0033cc; text-decoration: none; background-position: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;" title="http://code.google.com/p/js-test-driver" dir="ltr" rel="nofollow" href="http://code.google.com/p/js-test-driver" target="_blank">http://code.google.com/p/js-test-driver</a></p>
<p>Bio: Jeremie Lenfant-Engelmann works for Google and is the lead developer of JsTestDriver.</span></p>
<p><span style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: transparent; background-position: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;">Video: <a href="http://www.youtube.com/watch?v=aDKGGZv-T4M">http://www.youtube.com/watch?v=aDKGGZv-T4M</a></span></p>
<p><span style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: transparent; background-position: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;"><br />
</span></p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/aDKGGZv-T4M&#038;hl=en&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/aDKGGZv-T4M&#038;hl=en&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://misko.hevery.com/2009/11/06/gtac-2009-jstestdriver/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
