My dear Nicolas
Par Clément le vendredi, juin 10 2016, 10:22 - Lien permanent
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.
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 yet, still not...
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 AMD, with 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.
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.
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.
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".
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.