Angular vs jQuery

Published April 3, 2014

On HN today there is an inflammatory article called 'The Reason Angular JS will fail', which tl;drs to "it's too complicated compared to jQuery".

It's not a well argued opinion, but it is one I'm inclined to agree with.

The comments all jump on the fact it is badly argued and state that comparing Angular's complexity to jQuery's simplicity is apples to oranges because jQuery isn't suitable for building large apps, whereas Angular is.

Yeah, well, no. I don't agree there.

I'm curious how many of those people have actually written a large JS app, instead of just imagined what it might involve. I've been working on what is currently a 70kloc (and growing) JS app for the last 18 months. I have used JS frameworks before, but we don't use any on this project. I think, in general, frameworks have properties that make certain kinds of projects easier to put together, and none of them is closely related to the size of the project.

We briefly looked at Angular but it seemed like it was causing us problems instead of solving them so it didn't survive long (being overly complex didn't help its case).

The statement that Angular is for big apps and jQuery is for small apps seems like a false dichotomy to me.

We use jQuery for manipulating the DOM because without two way data binding, you'd be crazy not to. Data binding is a big attraction of Angular (and others).

I like data binding from a theoretical perspective, but in practice, generating and syncing DOM really is not really a hard or notable problem. It's just a relatively minor implementation issue. I don't think data binding really provides an advantage in terms of time or effort or maintainability - it seems like it should, but you revise your opinion somewhat after spending many hours debugging data binding templates. Processes relying on other people's magic are hard to debug.

Data binding is largely a distraction from things that really do take time and energy, which tend not to be problems touched on by frameworks anyway. Things like "how do I make all these subtly inconsistent but nevertheless intuitive requirements sort of co-exist". Software is a lot about bridging the gap between reality and someone else's vision of how reality should be. That stuff is hard. That's the risk to a big project. Keeping your GUI and data models in sync is not.

But saying that our app is built with jQuery instead of Angular is sort of missing the point. We just use jQuery at the view level and it works very well. But that's all it does. We don't use the DOM to store state, which, I think, is the assertion usually levelled at 'jQuery apps'. It's just a tool for generating DOM a bit easier.

What I am saying is that I am sceptical of Angular being useful for anything more than a CRUD app on steroids, but I am not sceptical at all of jQuery being useful in virtually any HTML/JS project. This is because jQuery (roughly) adopts the philosophy of "do one thing and do it well", which means it's a very good fit for all the use cases it's aiming at. The same isn't true of Angular.

Filed under: javascript, programming

Talk is cheap

Leave a comment:

HTML is not valid. Use:
[url=http://www.google.com]Google[/url] [b]bold[/b] [i]italics[/i] [u]underline[/u] [code]code[/code]
'