The more and more I look into RequireJS, the AMD Spec, and it's general overall usefulness, the more it sticks out as a broken appendage in the javascript world. Let me ask you, would you enjoy it if I went over to your house took your arm and snapped it in two? No. You wouldn't, or maybe you would. A lot of you would because that is exactly what RequireJS does. It stacks your code into two separate clauses cache's those results, and then delegates. All for the cost of what?

Cleanliness? Nope, I now have twice as much codebase as before spread out over twice as many files. Speed? Ahaha... ha, no. It takes about 2 ~ 3 hours longer just to determine not only if RequireJS will handle the plugin, script, or code correctly; If it doesn't then I must now find a way to do it, either through one of it's plugins or through editing the third party script myself. So where does that leave us? Optimization? No, now not only is your codebase cluttered about in some sort of maniacal structure of disorder and annoyance, you also must now clutter third party with extra bulk, unneeded bulk.

I call this "RequireJS Hell"; Somewhat like "Dependency Hell" but worse. A thousand times worse. Now, you might be saying... there is no code here! Where are our examples!? I present you with a better question, have you really looked at RequireJS, and how it is delegating your code? Maybe you have, maybe you enjoy spending those extra few hours trying to get it to work with some third party plugin you shouldn't be using but want to anyway. But for a team who has limited time, time is important. Very, very important.

Taken from the horses mouth... "But here is the plain truth: the perceived extra typing and a level of indent to use AMD does not matter. Here is where your time goes when coding; Thinking about the problem; Reading code;" ...yes, this is actually on the page. Let me explain not only how absurd but utterly idiotic this statement is; On one level you have extra typing, most of this "extra" typing comes from RequireJS wrapping all of your code into it's modules which is copy-pasta but not for everything, and on those not for everything codebases you now have more problems to think about, and more code to read than before.

You see that? It does matter, it does make a difference. I for one will never understand how or why people believe this is "optimizing"; All it does is bulk up your code, spread your files out, and cache things that for the most part don't really affect anything or shouldn't be cache'd in most cases.

To help show the pains of what RequireJS is:

hurt-speed

  • Rudy

    ~Two years later, could you share what are you using to modularize your code these days? Or did you go back to good old namespaces with concat and minification and script loaders where async resources are needed?

    Just curious.