April 16, 2012
RequireJS Hell - AMD really is not the answer
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: