My dear Nicolas

My dear Nicolas,

This time I will do it "old school", via blogs and not Twitter, not to repeat last time's quid pro quo.

Yeaaaaaaaah, it's about Javascript, again. And I am going to complain. Again. But not without some due praise this time ;)

So, here I am, working again on a web application, and you know me, for the love of God I cannot design, but boy, how do I love my web apps to be "rich" like we used to say (wawazzit... 10 years ago, an eternity in our field). Damn, you met me as a Flash™ specialist. 

Well, I am dabbling again. Here is the code if you want to have a look https://github.com/sinmaniphel/scriptus_write (it's pretty much a WIP at the time, it's quick and dirty and I am working on making that manageable) . And, well, I have still much to learn, but you are right : the JS ecosystem has matured enough to be pretty damn interesting. 

Well, Web Development has matured ridiculously these past years. I have stuck to Java for years simply because of Maven and how it simultaneously simplified project management, steel tempered the build process, and actually leveraged on the strong open source community to make Java development akin to buying candy at the grocery store. 

And lo, now that I don't have the rig to go back to my comfort zone, I turn around and it's finally the same thing everywhere. Damn, even Lisp has its own package manager. 

And JS has... Well, npm, Bower, Grunt... And it's the candy store all over again. Almost ridiculously easy. And jQuery has become Javascript's Spring. Damn, it's actually becoming something.

And yet, still not...

Well, Javascript is not what I expected it to be anymore. And still has several of its initial flaws, with tons of workarounds to hide them. 

My main concern is not portability anymore. It's size, complexity, and the hell they are to manage. And their consequences on JS' usability.

I have been learning again and here is how it went.

At first I was merely playing. With Bootstrap and jQuery loaded by default, there were several things I could do out of the box. It was, oh, so easy. Ajax call ? Simply use $.ajax (dont ask me to use $.get I don't have any faith in synchronous operations in a global asynchronous environments). I could add some nice components like a boostrap date time picker, and an overkill vis timeline. I could generate my content with Handlebars templates. Nice.

Quickly, you guessed it, it became a boilerplate. My reflex in that case is to decouple and separate responsibilities.

The widespread support for the ES6 class construct helped me for some time. Until, classes or not, I came to a >1k lines script file. 

That's not how I have been advocating code maintenance for years. 

Next point is that I don't want, ever, anymore, manage my dependencies manually. Obviously, asking my server what scripts to load was not an option. 

But then again, there would be import and export in ES6, right, supported like the rest ? I know you know better. I did not. 

So, I had gathered things around, and went to AMDwith requirejs. 

And then I was : are you fucking kidding me ? 

Nico, I am affraid to say, the thing is "C function pointers arithmetic" "Java J2EE" "Java Swing" complexity-level. 

Web developpers have been tooting for years that Javascript is simple, Javascript is efficient, other languages are too complex, Flash is dead, Java is dead, etc.

Reality check : wrong ! Javascript is the most hellish language I have been working with for years. (including ActionScript 1,2,3, Java, C++ and C#, Ada, severall shell scripts, XSLT, and some other hideous things I self-censored) 

Sure it is versatile, feature-rich and almost everywhere. So was Flash (thanks to the high penetration rate of the player). And so is Java. Its core, undue, advantage being the monopoly on leveraging on the HTML as a GUI in real time. The real value is HTML/CSS, Javascript is the pain you have to deal with in such a context.

Being a script ? Nah, that's lost. Why ?

So I went further. Grunt, traceur-compiler + browserify  webpack + babel + handlebars-loader, moved my files to a src folder, and I have now some decent ES6 code transpiled to ES5, and soon minified because it's already taking more space than the whole Quake2 source code. 

So here I am. A packager. A builer. Code "compiled" to an unreadable form in a "dist" folder. Where have I ever felt that ?... That's right, Java and Maven. My Gruntfile.js feels as complex as some advanced POMs.  

Understand me, Nicolas, I will continue to do my thing, because you are right, there are so many interesting features in the Javascript ecosystem. And well because it's not I have a great choice in the matter, I am buidling a web app. 

Should I not bitch about it ? Yeah, I will bitch about it allright all along.

I have been struggling for days, and I am a senior level architect. Damn, I used to be paid to handle such messy code management and the dire consequences it led to.  

And I am not building a web app for an entreprise. I am building an Open Source app, and if it is good enough, I want my target audience to tinker with it, easily and focused on the features and not the technicalities. And as a target audience, I cannot expect them to have my skills. I can't ask them to have any skill out of the box. 

And what makes me mad beyond words is that JS developpers are given shit and are happy for it. 

I have been mocked and mocked again for years as a Flash ActionScript developper. I knew better than staying on a sinking ship. And my final decision was not on the language. Same language, full compliance on the ecma-262 version 3, and it actually evolved, because we forced the implementer to do so

Javascript is twenty years years old. When I left the rich-web development world, 8 years ago, there was a promise. The version coming version was a coming of age. Ecma-262 version 4. Partly thanks to the OpenSource Flash intiative (chiefly Aral Balkan, mainly Nicolas Canasse) we also had the tools provided by Adobe to integrate it in our browser, with the Project Tamarin. Aaaaaaaaaaaand that was ditched. Mostly because of Google and Microsoft. I have read the arguments for the canning and still cannot fathom them out. (and at the time JSon was emerging, they went to E4X instead, sound choice)

ES4 was aimed at providing the ability to develop at large, ergo to develop in large teams or over long timeframes. 

And the consequences are already visible.

The ecoystem, all these features, everything is far too fragile. Have a look on OpenHub and see for yourself. If I were to defend a "buy vs build" strategy, I would be at loss, there is almost nothing I can defend. In a sound strategy, a less than 500 lines script maintained once a year (if not only an initial commit) by a sole contributor is not something you depend on it's something you build to be safe. 

If I am not wrong, and rarely am in such matters, the leftpad fiasco was just the beginning. It's not an OS community, it's people publishing the hacks they wrote single-handedly. Because there is no way it could be otherwise, it has been "decided".

So yes, Nicolas, Javascript is wonderful. The javascript environment is wonderful. I love, positively love what I achieve to do with it. 

But my users deserve better if I want them to be able to hack.

The ecosystem deserves better. The ecosystem deserves to be an ecosystem of features and not an ecosystem of workarounds provided by a community shuned by the maintainers of their core tool. 

CasperJs deserves better and you deserve better. 

Not written in 140 characters.