Live data from Hacker News

2 years with Angular

fse.guru

201–210 of 216 posts

Re: 2 years with Angular

#201
post #188

disclaimer: I'm the author of Mithril.js I've also used Angular for around 2 years for a large application. This article resonates pretty accurately with the problems we were running into before I decided to write Mithril. It can certainly work well (heck, the mobile part of our app was doing just fine because it was specifically designed to be a trimmed down version of the much more powerful desktop app), but perfor…

Big Mithril.js fan here !

Mithril.js seems like something I would study in my maths class (its a good thing). I have spent a good amount of my last year trying to get better at angular and wasting a large amount of my time. Angular.js has seriously colored my image about google's engineering poweress.Looking back I put my intuition and education at the back seat - due to my own insecurity of my intelligence - google must be better than me right ?

Re: 2 years with Angular

#202
"2 years" and "10 projects" - 2 months for each project? And he talks about "big enterprise apps"? lol.

Please links to examples of your code, author.

I wonder how people can't understand all the power of the 'directives' approach it's the MOST powerful thing in web development now and only advice I can give to future inventors of new frameworks: implement 'directives' concept, and then do everything you want else. It's advice after my 3 years with Angular, and counting ;)

Reusable code and TDD is the key for growing apps and directives - most successful following of this way.

---/ please news.ycombinator, treat new line symbols as new line symbols and use ANY modern framework to make this site less slow and more mobile friendly

Re: 2 years with Angular

#203
It's fair to highlight the less-ideal parts of AngularJS, but IMO the ecosystem and testing integration is as important as the framework code itself. Most of the issues the author mentions can be mitigated (eg. use ui-router).

The momentum behind AngularJS is huge, and with the 1.3 release I feel like 90% of webapps can be written well in Angular. Ionic is a great example of pushing AngularJS to the edge with mobile applications.

It really is up to the team to enforce good practices, pair or review code and refactor and unit test components. There is no framework which can make this happen, you need to be disciplined and always look to leanr more and improve the code you have written.

The author certainly does not recommend anything else, so where to now?

Re: 2 years with Angular

#204
post #47

This post reminds me of these other two [0, 1] that ultimately lead Leo Horie to create Mithril [2], a tiny (5 KB down the line) but complete MVC framework that also eschews most of the criticism raised by the OP. The Mithril blog is also worth a look, it addresses a lot of concrete scenarios with recipies to solve common front end problems with the framework. For example, here's a post on asymetrical data binding [3…

That framework has its own problems, like you have to wrap all your data structures into the mithril collections/models so that they can communicate with the views.

> you have to wrap all your data structures into the mithril collections/models so that they can communicate with the views.

Only when you need bidirectional bindings, and you're not forced to use the builtin `m.prop()` helpers, you can easily whip your own if they don't work for your use case.

See my last link for an example.

Re: 2 years with Angular

#205

Earlier quoted context omitted.

There are many ways to check if a object has changed in JavaScript, Angular's version of it is probably however the worst approach. The fact that it loops its a fundamental flaw that can't be taken seriously. Its a hack and should have never passed code review. Diff the virtual DOM to determine the minimal amount of imperative real DOM operations needed. Why is this so hard to understand as the optimal solution? Heck…

I'm not very familiar with React or Angular's history, but wasn't the idea of diffing a virtual DOM something that React kind of came up with, after Angular had been around? Isn't your comment kind of unfair, because you have the advantage of hindsight?

Perhaps I can fill in some of the history.

To the best of my knowledge, React is indeed the first "mainstream" UI framework for JavaScript to be so fundamentally built around a virtual DOM. I think as a minimum the React team deserve credit for popularising the idea and for raising awareness of the underlying performance characteristics of browsers that make the idea relevant in practice.

That said, many of the "big ideas" that have been popularised among front-end web developers in recent years by big name frameworks are not even remotely new to the programming world as a whole.

For example, it's hardly news to anyone who's worked on browser-based UIs that DOM updates are often the bottleneck. However, back in the days of IE6/7 and the early versions of Mozilla or even Firefox and Chrome, JS generally and DOM updates in particular were far slower than they are in modern browsers. People have been writing UI code specifically to minimise DOM updates since long before the likes of Angular and React came along, because what is done today as a performance boost for relatively large and complicated pages used to be a necessity to get acceptable performance out of any JS-based UI at all (the major alternatives being either plugins like Flash or Java, which ran routine UI code much faster in those days, or doing pretty much all of the work server-side using old school web forms).

It's also hardly news to anyone who worked with client-server apps a few years ago, when again things were much slower and more specifically bandwidth was a fraction of what we enjoy today, that sending patches instead of complete data can be an easy performance win. (People have been using the rsync technique for a couple of decades or so.) In the early days of what we might now call web apps, before JSON won and everyone had numerous JSON-friendly persistence and data binding libraries to choose from, a comedian developed a format called XML that accidentally caught on when too many people didn't realise it was a joke. (See also: XMLHttpRequest, the standard tool for retrieving JSON data from servers everywhere.) In order to avoid half the development team retiring before the first test XML data had finished downloading on a typical project, we got pretty good at designing diff/patch formats for these kinds of nested data structures.

Put those two ideas together, and as you can imagine, a lot of web developers wrote a lot of ad-hoc tools whose basic purpose was to take some sort of change set for the underlying data model as input and figure out some sort of reasonably small set of DOM updates to match. The canonical example would be something like updating a container in your underlying data model, where you couldn't afford to rewrite a whole list or table element in your DOM for each inserted/changed/deleted element in the container, so you had to bundle up the changes transaction-style and then flag the DOM for a single update at the end.

Obviously we've learned a lot since the early versions of this, and today we enjoy templating and data binding libraries that can be dropped into projects with negligible effort but do the same jobs we used to spend many days automating on each new project, with all the usual benefits of consolidation and peer review that come from having generic libraries with many users and many contributors. No doubt some of the techniques used in modern frameworks like React are far more widely applicable and systematic than a lot of the old code we used to use. So in this sense, again, perhaps the React team deserve some credit for advancing the state of the art.

Re: 2 years with Angular

#206
post #180

Earlier quoted context omitted.

"A new $scope object from a parent $scope can be treated the same as the new scope inside of a function block because it's how prototypical inheritance works." This seems rather confused. There's lexical scoping with function blocks, and there's prototypical inheritance on objects, and yes in the abstract both are used for dereferencing identifiers. The parent post's point is that Angular's $scope rules are as though…

My thought pattern on lexical scopes in javascript is that they're essentially a new object off of the prototype of the parent lexical scope. At least they have very similar properties. In a new lexical scope, a new variable of the same name as one accessed via closure means I lose reference enclosed variable. In the same way, a new property of the same name as a property in the prototype chain means I lose reference…

The advantage of lexical scope over dynamic scope is predictability. You can reliably* read a javascript program and map each variable access to the scope of that variable (so can a compiler, which accounts for no small portion of the speed of modern javascript implementations).

With dynamic scoping there are no guarantees about where you'll find any nonlocal variable. In practice this caused enough difficulty that the programming language community has moved steadily away from dynamic scoping.

You make an interesting parallel with prototype lookup, but it's worth noting that the prevailing pattern of prototype use mimics the traditional class and instance rubric. In that situation it is also fairly easy and deterministic to pin down where in the prototype chain every identifier is defined.

* with the exception of code which uses `with` statements and certain forms of eval, which is a big part of why those constructs are strongly discouraged by the community

Re: 2 years with Angular

#207
post #49

This seems to be the summary of every tech flame war ever, and applies rather well here: A: I've used tech X in a lot of Y contexts, and I find it's not great. I will generalise slightly imply that tech X is not the panacea that it has been presented as. B: Yeah? Well, I've used tech X in a lot of Z contexts, and I find it works fine! You're wrong! You're using it wrong! Maybe you're not wrong in context Y, but for m…

This is spot on.

Re: 2 years with Angular

#208
post #172
post #120

I think people are failing to see that not all apps are huge monolithic applications; for most of those apps Angular works just fine. In fact we should be striving to get away from all of those monolithic code bases as much as we can. In the cases where we can't get away from that then we should be going with tried and trusted methods of building those apps and probably relying on the server a hell of a lot more for…

Cordova has nothing to do with angular. Why do you bring it up? In fact, angular is probably one of the worst possible frameworks to wrap into a mobile app, because of its abysmal performance.[1] [1] http://matt-esch.github.io/mercury-perf/

That's an older version of Angular being compared against - lots of perf improvements have been made since.

Re: 2 years with Angular

#209
post #200
post #146

Earlier quoted context omitted.

It is a DoubleClick invention that Google bought. They then attached "from Google" to the logo and it took off like a rocket.

> It is a DoubleClick invention that Google bought. Not really. It is the remnants of a failed web startup. They offered a freemium backend as a service, but it didn't take off. http://web.archive.org/web/20091230110525/http://getangular.... http://web.archive.org/web/20100215054417/http://www.angular... Then I believe that one of the founders/authors was hired by google, and... > They then attached "from Google" to…

Interesting. I recently heard in a Podcast that Misko Hevery (a Googler) created Angular as his 20% project with the scope to make it easier for web designers to create dynamic prototypes.

Re: 2 years with Angular

#210
post #200

Earlier quoted context omitted.

> It is a DoubleClick invention that Google bought. Not really. It is the remnants of a failed web startup. They offered a freemium backend as a service, but it didn't take off. http://web.archive.org/web/20091230110525/http://getangular.... http://web.archive.org/web/20100215054417/http://www.angular... Then I believe that one of the founders/authors was hired by google, and... > They then attached "from Google" to…

Interesting. I recently heard in a Podcast that Misko Hevery (a Googler) created Angular as his 20% project with the scope to make it easier for web designers to create dynamic prototypes.

He's the founder/author I was refering to.

It's not the first time I hear that he doesn't mention BRAT Tech LLC when he tells the story behind Angular.

Post reply on HN