TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Aren't Ember and Angular a "wrong" kind of framework, similar to J2EE?

20 pointsby aarturalmost 12 years ago
I&#x27;m looking at the new wave of Javascript frameworks (Backbone, Ember, Angular) and can&#x27;t shake the feeling they are much more similar in style to J2EE than to more saner Rails or Django. They take you out of control of your code - they call you and you must fit their world view. They are &quot;everything&quot; and &quot;nothing&quot; at the same time - they offer you &quot;everything&quot; to build a web app, but at the same time it&#x27;s hard to say what concrete functionality they really offer. There is little &quot;meat&quot; inside their code: it&#x27;s just an abstract model that you MUST work with.<p>Compare it to Django where in view functions you can do whatever you want - you are in control of what&#x27;s happening, and functionalities you need are available as &quot;library style&quot; calls. Can&#x27;t Javascript frameworks work like that?<p>I&#x27;m asking the question because these frameworks receive much praise nowadays with little to no critique, so maybe my all-or-nothing-framework hate (I began career as J2EE programmer) is inappropriate here.

8 comments

brianchualmost 12 years ago
It&#x27;s really hard to answer this question when Backbone is lumped together with Angular and Ember. What Backbone offers is a light layer of structure over your code. Yes, it doesn&#x27;t give you much, but I believe its sole purpose is to avoid the jQuery spaghetti that forms once you start writing more than 100-200 lines of JavaScript. Backbone doesn&#x27;t give you many opinions, but I personally agree with you in that Backbone gives you a few opinions (not many), but not enough meat to justify those few opinions. It&#x27;s basically a guideline as to how to structure different components of your app and how to communicate and share data between components. That being said, as far as I&#x27;m aware, you can more or less do anything you want to the DOM in Backbone Views. And Backbone certainly does offer some features: routing, an event system, and a data syncing system.<p>Backbone is probably several times less restrictive and controlling than something like, say, Ember or Angular. I&#x27;ve only used Angular, so let me comment on that. I think Angular definitely offers some powerful features that justify its structure. Two-way data binding, a system for reusable components (directives), a structure for organizing animations, a system for managing data from RESTful APIs, a full testing scaffold&#x2F;system, etc. <i>It&#x27;s not uncommon for jQuery and even Backbone apps that are rewritten in Angular to cut their codebase &gt;2x.</i><p>I&#x27;ve heard that Ember is even more restrictive&#x2F;opinionated than Angular, and perhaps it is more powerful as a result - I don&#x27;t know. I&#x27;ve been satisfied with Angular.<p>That being said, there are tradeoffs for using frameworks. For example, you should only do DOM manipulation inside Angular directives. Honestly I think this is a positive, due to various powerful structural features of directives (reusability, modularity, customizability), but for some this can be a negative.<p>Moreover, because these frameworks are just contained in JavaScript files, you can selectively apply these frameworks, where necessary, to different parts of your web sites.<p>Ultimately, I think frameworks like Angular or Ember <i>are</i> as restrictive <i>and</i> as powerful as frameworks like Rails and Django. Backbone would be like Flask or Sinatra.
评论 #6008600 未加载
lstamouralmost 12 years ago
Don&#x27;t forget to have a look at HTML5 Web Components e.g. Dart&#x27;s Web UI. <a href="http://www.dartlang.org/articles/web-ui/" rel="nofollow">http:&#x2F;&#x2F;www.dartlang.org&#x2F;articles&#x2F;web-ui&#x2F;</a><p>I&#x27;d say that, being simply linked HTML5, CSS and JS, is about as lightweight a view-controller system one can build. It&#x27;s like a Rails&#x2F;Django where you can skip the ERB, because it&#x27;s all HTML. Personally, I can&#x27;t wait for it to catch on (and get refined with further implementations and bug fixes, particularly for server-side, progressive enhancement or non-JS approaches).<p>For pure JS, have a look at Polymer. <a href="http://www.polymer-project.org/" rel="nofollow">http:&#x2F;&#x2F;www.polymer-project.org&#x2F;</a> (Dart&#x27;s looking at using most of this itself in future, perhaps AngularJS 2 and Ember will follow...)
评论 #6010437 未加载
joeldiditalmost 12 years ago
(Slightly related..) I like AngularJS, but I very strongly disagree with the idea of the one page app. I don&#x27;t know what else to say. It just seems wrong. Javascript was meant to make the page more dynamic and responsive, not take over the entire experience and (possibly) slow everything down. It&#x27;s supposed to be a layer, not everything.
markchatkhanalmost 12 years ago
These days it&#x27;s all about modularizing and separating concerns.<p>Angular let&#x27;s you create a front-end completely decoupled from a backend and backend agnostic.<p>Angular is also in fact completely agnostic about your model. You can plug in any kind of model as long as you can parse it in javascript.<p>With this kind of architecture, it&#x27;s a lot easier to do things like re-use a backend for multiple front ends, for example a mobile-site and a desktop site and a native iOS app and a blackberry app. It&#x27;s also easier to maintain and change each individual piece.<p>JS frameworks are only a front-end though, you also need to adapt your backend into a modern API style, rather than a html spitter-outter.
评论 #6008363 未加载
zcrar70almost 12 years ago
J2EE was very verbose - both Ember and Angular make it a key priority to make it quick and easy to do very powerful things.<p>However, I agree with some of your premise. Both Angular and Ember have very opinionated and restrictive world-views. That&#x27;s what allows them to create an environment where you can do great things quickly. But it also makes it harder to create things that don&#x27;t fit into that world-view.
rektidealmost 12 years ago
Frameworks help you build a system on top of the web. Rails and Django are systems underneath the web.<p>Building up or building down, none of these technologies are inherently web themselves, they are their own self-establishing bias.<p>Look at Polymer or Custom Elements if you are interested in building web technologies that are themselves truly of the web.
评论 #6028883 未加载
bmm6oalmost 12 years ago
Comparing JS libraries with web server frameworks is pretty apples-to-oranges, first of all. But MVC frameworks pretty much have to be &quot;everything&quot;. Can you use a desktop UI library without going with it completely?
评论 #6032311 未加载
factorialboyalmost 12 years ago
I think Angular is pretty declarative and doesn&#x27;t do any &quot;magic&quot; unless you ask it to.<p>Can&#x27;t say the same about Ember though.