JavaScript Fatigue? Or something more?

AppId is over the quota

There has been a lot of talk recently about a phenomenon called “Javascript Fatigue”, whereby developers are getting confused and worn out trying to keep up with the slew of new tools and methodologies when it comes to developing Javascript.

The problem is they are right, especially when it comes to the tooling. We’ve suddenly gone from a couple a javascript files included into our html to needing to do the following:

Decide what type of new, cutting edge version of JS/ES you are going to write inFigure out what combination of Babel + plugins will work properly with this versionBuild your package.json and figure out what dependencies you neededfigure out the correct Babel config that will compile your codeonce you’ve compiled your code, you need to compile it again so that the module system you are using works properlybut wait, you might also have an intermediary compile step depending on if you are using JSX and the tooling around that

For someone like me who wrote jQuery and was overly concerned with the issues that sprang from cross-browser compatibility before ES2015 or Node was even a thing, this current process is completely baffling. Suddenly, one day we are compiling our Javascript multiple times just to get it work.

I’m not saying these are bad things. Things like React and Node have done wonderful things for web development and allowed us to move forward in the web space in new and exciting ways. The problem is that we’ve created such a barrier around these great things that it is becoming increasingly harder to take advantage of them in a way that is reasonable.

Let me tell you about the times I have tried to use Babel. Yes, plural, because up until recently I could never get it to work. I wrote my ES2015 code, went to find Babel, only to be told that I needed babel-cli, once I got babel-cli I then figure out that it does nothing by itself and you need to download plugins. At this point I was confused, isn’t the point of Babel to compile modern JS code down to code we can use now? Why do we need to install plugins for something to do what it was built to do?

So I go and find the plugin, install that (thus my node_modules folder gets ever larger), and try again. Only this time it doesn’t work because I need to learn the arcane combination of compiler flags to even get it to just work. When did it become easier to compile using GCC/Clang than it is to compile Javascript?

Ok, so now I have a collection of Javascript files that have been transformed into something the browser can use, except it can’t because now I have this whole module system littered throughout my code. Apparently, figuring out how to deal with modules is a challenge left to the coder. So now, I have to figure out how to concatenate my compiled Javascript code so that it will work with these modules. So I go and grab Browserify because at the time, it seems like the most commonly used software to achieve this.

After again figuring out the ancient incantations of the compiler flags that would make even kernel developers blush, and again writing more config files, I finally have compiled my ES2015 code down to something I can include in my browser.

After all this, I load up my test.html file, and bask in the ‘hello world’ application I have just written in the new hotness that is ES2015. Except, now I have 2 actual source files (I was experimenting with ES2015 modules), 2 compiled files, 1 concatenated build.min.js file, and a ridiculous amount of configuration and build files.

This is what Javascript fatigue is, a complicated maze of dependencies that don’t quite fit together, tools which require mountains of configuration and cli flags, and multiple steps that should be folded down into one tool but for some reason are not.

If Javascript is to continue to thrive as it has been, then we need to as a community have a serious discussion about how we do things. We need to build tools that are easy to use and require one, if not a small number of steps. Imagine being able to download just one build tool that by default allows you to write something like ‘jsc /some/js/dir -o /some/build/dir –enable-jsx’ which not only does all the compilation but handles things such as modules etc for you, so that we can spend more time on building great applications and spend less time on downloading and configuring tools.

View the original article here