Friday, April 22, 2011

This kind of “I broke things, so now I will jiggle things randomly until they unbreak” is not acceptable.

Linus Torvalds

Wednesday, April 20, 2011

Using jQuery deferreds is a little like courting a woman: you have to be careful not to make promises you can’t keep.


Friday, April 15, 2011

learning Javascript used to mean you weren’t a “serious software developer”. today, not learning Javascript means the same thing.

James Governor

Tuesday, April 12, 2011

Using QUnit with RequireJS

I have really been enjoying James Burke’s RequireJS library: and have recently applied it to a project at my day job. When it came to testing the application, I decided on QUnit for unit testing, and started poking into using it with RequireJS. 

I was able to successfully run tests using the RequireJS approach, i.e., define a test module, with the code to be tested as explicit dependencies, and waiting to start the tests until the module and all its dependencies are loaded. Async behavior is handled via QUnit.stop()/start() as described in the QUnit API:

        function (moduletotest1, moduletotest2, moduletotest3) {
            return {
                RunTests: function () {
                    test(“mod1test”, function () {
                        moduletotest1.ajaxyMethod(arg, function(result) {
                              deepEqual(result, matchExpression);

                    test(“mod2test”, function () {
                        moduletotest2.ajaxyMethod(arg, function(result) {
                              equal(result, matchExpression);

Then in the QUnit page script:

QUnit.config.autostart = false;
          function (testModule) {

Works like a charm!

Friday, April 8, 2011

On inventing JS module formats and script loaders

Link: On inventing JS module formats and script loaders

Nice post by James Burke, author of RequireJS, (which I have fully embraced in my latest production app) on why the Asynchronous Module Definition (AMD) appears to be winning the JavaScript module wars. It’s a clear, concise, and cogent argument.