I’m not sure if it’s been done before, but I may very well be the first GitHub stalker (hold your applause, please). Who is my target you ask? Vision Media, aka TJ Holowaychuk on GitHub, author of ExpressJS, a Sinatra-inspired Web Framework written for NodeJS.
The books Table of Contents are as follows:
- Ch 1: Closures, Scope and Context
- Ch 2: Prototypal Inheritance
- Ch 3: Advanced Meta-programming techniques
- Ch 4: Behavior Driven Development
- Ch 5: Creating a jQuery Clone
- Ch 6: Tools of the trade
The revolution will not be televised, it will be tracked on GitHub
An aside on BDD
Essentially, BDD is an “outside-in” methodology, meaning that you start by identifying outcomes with your clients (internal or external), and then map out the features that will achieve such outcomes. This often happens in a story format.
Overall, it’s fantastic because it allows your clients to stay on the same page as you, the developer. You define concrete outcomes with your clients, and which steps needed to be taken for each feature to work. This means that both you and your clients have a solid understand of what needs to be done, and what “done” truly means. To read more about BDD specifically, check out a great explanation of BDD from the inventor, Dan North.
Using JSpec to implement BDD
With regard to chapter 4, JSpec helps us implement BDD from the developers perspective. Once the outcomes and features have been hashed out into specific steps, or “units,” then the developer can begin doing his/her job! Now, BDD is an extension of test driven development, and therefore implies that we should begin not by writing our implementation, but by writing Unit Tests to ensure that the functionality defined within our story is properly executed! By working this way, developers get the myriad of benefits that come from proper unit testing, such as avoiding regressions (breaking your code).
jspec init mySpecTest
If you’re like me, and you thought “Unit testing is pretty cool, but I really have no idea how to properly implement it,” you will walk away from this book knowing exactly how to use unit tests, and you’ll also probably be bursting with ideas about how you can improve your code and your development methodologies.
Now, while the book totally kicks ass, I did have some minor problems with it. I really think the book needs a good editor. There are some frankly just kind of sloppy grammatical and spelling errors throughout the book, and the writing in general could use a good solid critique to make it a bit better. Also, there’s a lot of source code presented in the book, but the book didn’t come with all of the source in separate files. It had a few files, but it was missing some of the JSpec files that I would have found most interesting.