I have a web app I would like to gradually refactor by adding structure to it.
I have narrowed down the options to Backbone (with some plugins), Ember.js and AngularJS
My goal is to refactor that app, which has the usual jQuery spaghetti and gradually add some structure to it.
Requirements
- not a “all or nothing” framework, e.g. allow gradually moving code from “before” to “after” without rewriting the app from scratch (winner – Backbone?)
- something that has a future, people seem excited about and has a big company behind it (Angular takes this bullet)
- Let me sometimes do things “my way” and not force a paradigm (Backbone a clear winner here)
- Something that will really boost my productivity and remove the need for boilerplate code
(Angular + Ember) - Something that is good not just with the obvious things, but also the complex things, e.g. animation transitions, nested models, handling modal dialog views, drag and drop support, widget system etc
One option is to become an advanced developer in all 3 and then, the other is to ask people who did something similar
I know that with Backbone I can do everything I want, but I want to know if I’m not to “careful” and wonder if I’m not missing out by not taking the risk of using AngularJS / Ember.js
Questions
So my specific, answerable, constructive (as much as I could) questions are:
- Is Angular / Ember able to support drag and drop without bending over backward?
- Can either of these frameworks support animation transitions well?
- Which of these 2 frameworks is easier to “add in” gradually and not to fully rewrite things “their way”
- Which of these has better support for NoSQL /document based models as in MongoDB like documents (e.g. a JSON doc rather than a relational model)
- Which of these has better built in support for complex models (similar to #4)
Both Ember Data, and Backbone-relational seem to come from a relational database paradigm, and I wonder if there is anything that can build a model from an arbitrary multilevel / nested tree like structure without having to define a NoSQL model in a relational like data structure (e.g. hasMany, belongsTo instead of just a JSON like document).
Also I don’t want to stop using JqueryUI because it’s not 100% done the “Ember way” or the “Angular way”, is Backbone really my best option?
Are the nice bells and whistles that come with Angular / Ember are in a trade-off with flexibility?
Is it a good architectural choice to use either Angular or Ember when refactoring an existing jQuery callback pasta in a gradual, iterative approach?
4
I think your question is missing a critical constraint, but you address it within the comments. Specifically, how much time do you have to invest in this refactor?
Time allotted is going to be the trump card requirement and renders your detailed questions a bit moot.
For this current refactoring window, you’ve been allocated one week. That’s really not enough time to learn a brand new framework and complete meaningful refactoring for even a modest project. Adding in your outside time constraints, and you have perhaps 40 to 50 hours to apply.
That limited timeframe means you need to pick the framework you’re most comfortable with now. Based upon your description and research, Backbone is the front runner for selection.
Yes, you may be “missing out” on some neat new feature of the other frameworks. Presuming that all three frameworks are “live” and still being developed, you’re going to see that “lacking-feature” difference regardless of the framework you pick. The frameworks will keep moving forward even if you can’t keep refactoring your project. Part of any design is to eliminate potential paths to follow so you can focus your top choice. An inherent part of that path elimination is that you will be missing out on feature XYZ that only the less attractive framework has. But that gets us back to time being your overriding constraint.
I would encourage laying out a prioritized list of areas that are going to be refactored. You need to include verification activities along with that refactoring, and I would encourage allowing for some schedule slack to handle the unexpected issues with conversion.