Skip to content

Why AMD as the authoring format?

Miller Medeiros edited this page Jun 19, 2013 · 3 revisions

Because AMD is awesome!

easier to automate and deploy

Since most node.js modules are installed through npm it's easier to write it using the AMD format and them convert into a node.js compatible format during npm publish. We use nodefy to convert the AMD modules into regular node.js modules so it won't add any extra overhead for your node.js apps. The opposite approach would be harder to automate.

modularity / flexibility

By keeping each function in a separate package we can require just the methods/packages that are required by our app and let the RequireJS optimizer bundle only what is currently being used. We also have an extra benefit that we split the methods into separate packages so we reduce the chance of name collisions and the code is more organized. AMD is flexible and enables things that wouldn't be possible with a different module system or with a conventional namespace approach (remapping a module, conditionally loading, etc).

Read these links if you still can't see why:

the module format is just a detail

It's fairly easy to write tools to convert between the different formats so it should not be an issue in case in the future we decide to change it.


PS: Your mileage may vary...