Skip to content

FrontTrends 2010

Last week I gave a talk at FrontTrends 2010. Here's the code from my talk, and a brief summary of it.

Test-first JavaScript

My talk was entitled Test-first JavaScript and was a hands-on tutorial on TDD with JavaScript. I spent a few minutes presenting the central idea of TDD - Clean code that works, now (Kent Beck), and the four steps:

  1. Write a test
  2. Watch it fail
  3. Pass the test
  4. Remove duplication

Then I fired up Emacs and spent the better part of an hour live coding, TDD-ing the start of a live search jQuery plugin. The sample code is available on GitHub, but heed this warning: About half of this code was written "before a live audience", and the rest was prepared in order to show the final demo (which I failed to do anyway).

The code is only the start of a plugin, and isn't actually functional for anything else than displaying suggestions. The most important part of the presentation was not the code itself, but rather the process of writing it - guided by tests. So take the code for what it is. Instructions for running the hackety Node.js server and testing the whole thing is available on GitHub.

How did it go?

There was a surprising amount of people on my talk, and I want to thank you all for showing up! Only a few have voted for the talk so far, but judging from what they had to say, people had a good time.

I actually messed up my final demo, which is to be expected when one sets out for a full hour of live coding, but I don't think it really mattered. The demo was mostly for a small wow-effect as the topic is a bit dry on its own. It seems people got the message despite some technical issues. After the presentation it hit me that my error was to omit jquery.js when concatenating the scripts towards the end.

Questions, questions, questions!

There were lots of questions during my talk, and I really appreciated them. People seemed engaged and had lots of good comments. I'd love to discuss testing and JavaScript anytime, so hit me on Twitter, here, or on if you're interested in having me talk more about this, discussing something or whatever!

Marcin Kasperski has posted a very nice summary of FrontTrends 2010, including a very flattering review of my talk, check it out! (It's in Polish, but Google translate does the job). Thanks Marcin!

Possibly related