AMD versus CJS. What’s the best format?

JavaScript Harmony will introduce native modules into JavaScript. Finally. And when IE9 finally dies a slow death, we’ll be able to use native modules in the browser. Yay corporate support contracts. In the mean time, there are two competing standards for modules: AMD and CJS Modules 1.1.1. Which one is better? Which one should you be using?

I’ve got an opinion and it may surprise you.

Continue reading

AMD Module Patterns: Singleton

This is the first in a series of posts illustrating how common design patterns can be achieved using AMD-style JavaScript modules. We’ll also look at some new patterns that are somewhat unique to AMD, including one that should be called nothing less than the “Alley oop slam dunk”!

No, no, we’re not going to talk about the “Alley oop slam dunk” first! Let’s start at the basics with the simplest of all design patterns: the Singleton.

Continue reading

The first annual dojoconf!

I just got back from the first ever dojoconf in Washington DC. I asked Dylan and Chris if they were planning to do it annually and I got something equivalent to “F**K YEAH!”

Good. cuz it was awesome. 🙂

I was honored to present about AMD Module Patterns at dojoconf. My slides are here. A half hour is not nearly enough time to present on even a couple of patterns. It didn’t help that I was high on cold medication, so I think I missed half of the points I wanted to make and missed half my slides at the same time. 🙁

To rectify the situation, I will write a blog post on each pattern. My goal is to write about one pattern a day until they’re all done. Wish me luck. 😉

— John

P.S. This was my first time representing a corporation at a conference. I have been a full-time employee at lifeIMAGE in Newton, MA since August 2010. lifeIMAGE sponsored the Hacker Lounge at dojoconf and paid for the awesome dojo minis! (Btw, we’re always hiring javascript engineers!)

What is the fastest way to load AMD modules?

The AMD format for JavaScript modules was created to allow devs to write elegant, modular code rather than the silly global, name-spaced hackfest we’ve been writing. However, AMD has a hidden benefit: it allows modules to be downloaded in parallel, rather than sequentially. This is a potentially huge performance win.

However, does this really matter for production code?
Continue reading