Comment

Comment by latchkey

I can't agree more. I'm just now rewriting a portion of my webapp to be a single page app using angular. I'm blown away at how it simple it is to do some really complicated stuff. This is entirely the result of how it forces me to properly organize my code. For example, when I open up a bootstrap tooltip/popover, I wanted to disable all the buttons on the page. It was as simple as invalidating the ng-form and this just works across many directives and modules (assuming you pass the form through the scope). Doing this the old way with jquery would have been a nightmare.

At first I resisted the templates. I kept trying to use Handlebars to render things cause that is what I was used to. Then I realized that the 2 way data binding (ng-repeat with track by) is just magical. I can take a json blob received from an ajax call and set that on a property on the scope. My template just magically updates only the dom elements that changed. By the way, coffeescript is perfect for the templates because you can just embed them in """ ... """ blocks.

My code is also now organized so much more cleanly. The way directive components are organized forces me to think about reuse. It makes it so much easier to see the dependencies between things and create distinct levels of separation. This allows you to make components that can be moved around easily in case you change the flow of your application or just want to display something on another screen.

My buddy and I came up with a way of taking large cyclical object graph blobs of json and de-duplicating the objects for transfer over the wire. This ends up working perfectly with the aforementioned data binding to minimize the amount of json on the wire, while still retaining our complete object model. https://github.com/jsog/jsog

I'm kicking myself for not picking this up earlier.

parent latchkey 12 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton