Tuesday, November 3, 2015

"I've yet to write a line of javascript code!"

At work we're shifting gears out from Ember and back to Angular. I'd have to admit it feels like a step backwards: to me, Angular is a bit of a "worst of both worlds", with the complexity and opacity of a full framework (lots going on under the hood) but without the feeling of completeness of some other things like Ember.

Dan Wahlin's AngularJS in 20ish Minutes was suggested to me. It starts with the Angular 101 dynamically updating filter search / loop stuff I've seen half a dozen times. But when he says "I've yet to write a line of javascript code!", my reaction doesn't mirror his positive feeling. To me, I hear "I have a new syntax to learn to write programmatic code in! Hope it does exactly what I want once I learn, because if I have to dive into how the magic works it's going to be really tough."

People who are enthusiastic about Angular like having "views" that are so powerful, and that use xhtml-like syntax, but in my heart of hearts I like keeping my program code as code, in something that's clearly the controller, and having a different syntax set for conditional and looping structure that stands out visually from the part of my html that represent DOM elements - and having those templates be extremely lightweight.

But, Angular is massively popular, and picking up experience and fluency in it is going to be great for me.

FOLLOWUP: Googling up about the UI-Router, I see the phrase "AngularJS is what HTML would have been, had it been designed for building web-apps", which I find a bit telling in its arrogance, but also indicative of what I like less about its style. I mean, HTML isn't designed for building web-apps, it does many things, and is agnostic about what you may be doing to get the information from the server to the client. I see parallels to what I wrote about Dietzler's Law: I prefer composable systems that reveal their plumbing. This allows a developer to take a reductionist approach to debugging, isolating components and challenging assumptions at the various levels. When the template is doing a lot of the heavy lifting, it's harder to see where the goofup might be happening. It's also tends to only be amenable to top-down, holistic understanding; a learner can't safely ignore something they don't know, and be confident in their understanding of the other parts: everything is tightly coupled. 

I suppose some of those arguments hold for Ember etc, but still: Angular shows its roots as a quick and dirty prototyper (I feel the default two-way scope coupling emphasizes that) in a way newer frameworks don't, while at the same time ratcheting up the syntaxes to learn, and the meta-syntaxes to master, in order to keep everything looking like HTML tags.

Ironically, I kind of love Web Components, which to me do feel like the "what HTML would be if it was designed for building web-apps".

1 comment:

  1. Oh god, exactly my thoughts!

    Sad thing it is SO hard to explain to clients who "heard angular is awesome" and "want angular because it is so extensible!" sometimes.

    It is cool, the angular is, just most cases it is used there is a better option...