As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I want to use a JavaScript framework for a complex web application. I have been looking at Backbone.js, knockout.js and JavaScriptMVC. Being pretty new to client side JavaScript heavy web apps, I'm not sure which one to pick. Each one has a pretty different approach to separate the concerns. Model/View/Controller vs Model/View/ViewModel vs Model/View/Collection.
What do you guys think? What are the deciding factors? Which one would be the easiest to pick up? What has your experience been like?
You can't go wrong either way especially if you are building a complex javascript UI. If you choose not to use either, you will likely wind up with a lot of difficult to debug code. I personally like Backbone but they are both lightweight and allow you freedom in your templating language (I use JQuery templates). I think what made me choose Backbone was the way Knockout mixed its components in with your html:
<span data-bind="text: myItems().count"></span>
You may be able to avoid using constructs like the above with Knockout but that was enough to throw me toward Backbone. I also liked the fact that backbone has dependencies on both underscore and jquery which were already in use in my projects.
To build on HostDude's comment - it's a feature, not a bug :) Part of the concept of knockout is that there's a layer inbetween your Controller/Model and the View. This lets us modularize our HTML into small components that include the data mapping.
So yes the JS bindings are mixed in, but they are not mixed into raw HTML - rather they are added to tiny modularized Jquery templates. By adding those data bindings in explicitly at the jQuery template level, we have total control over what's mapped to what -- without disturbing our underlying application data model at all :) I love Knockout!
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I've read some interesting articles and comparisons on JavaScript MV* frameworks and I do know outline of architecture of most popular ones (Ember, Backbone, Angular) However as a PHP programmer (and Symfony 2 lover) who wants to learn one of those in detail, I am concerned if Meteor (my first choice) is flexible enough to be considered a full stack framework so I can abandon server side (eg. PHP) entirely on most basic apps. Until today I thought that PHP + Angular give more possibilites (although it's more time consuming to maintain both server and client side), however I'd like your opinion on that. From what I've seen in meteor's screencast, it seems pretty awesome.
As many people have mentioned, server-side JS would replace the function of PHP completely. But Meteor is much more than that; it allows you to replace your imperative code with declarative code. Meteor takes care of synchronizing the data and you just decide how to render it. No more passing around messages through AJAX. As one article put it, Meteor has made MVC obsolete.
In my experience with meteor, I'm developing a project and reading the book. What I've been able to do with Meteor in a short time has completely blown my mind. Combined with some excellent frontend frameworks such as bootstrap, I don't really have to do any CSS work either (if I don't want to), and that means I can develop without worrying about styling or AJAX, essentially freeing up my time to create awesome applications with very little legwork.
Besides, as they say, it only takes a weekend to try Meteor out. It's not complicated at all if you have JS experience. However, as it took me a bit to understand, it's not necessary to think with MVC anymore. It only took me a couple of days to build my first meteor app so I suggest you try it out!
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
The last couple of years I've spent working in Flex. Before that I've been building web applications in vanilla JavaScript.
Today I'm switching back to JavaScript but now I'm having trouble in choosing the right JS framework/library for a new medium-size project.
Although all the comments on AngularJS have been positive, I found that getting started with it is not an easy task. The problem is of course the documentation. Although there are tutorials which show you how to do the basic stuff, none explain the concepts or show you how one might structure larger projects.
Before discovering AngularJS I had my mind set at Backbone. The positive side is that there are loads of documentation, tutorials, screencasts, books on the subject. In addition the source code is small and can be used as a reference itself (unlike AngularJS).
So now I'm thinking that Backbone might a better choice for someone who's getting stared with using frameworks in JS programming than AngularJS. Later on, when I manage to train my brain to think in JS, AngularJS might be easier to understand + there will be more documentation available.
I'm now in doubt if that's the right path to choose...
First of all, I'm pretty sure that switching to JavaScript was the right choice.
Selecting a JavaScript MVC framework is indeed a difficult choice, especially because they're popping like popcorns everywhere!
This project might be very helpful regarding this decision: http://addyosmani.github.com/todomvc/
Here is my point of view. Backbone is liberal. It does not impose a rigid structure. It is more a set of conventions than actual code. You will certainly be using something more than just the Backbone framework. This can be challenging, but may result in a better tuned result. Backbone is very extensible by nature, which is a great advantage.
AngularJS augments HTML semantics. Just by saying this you can imagine that it is something much more complex than just "pure" Backbone. Perhaps we may find AngularJS a bit more magical (not magical of course, but things happening with less code, "under the hood", I mean).
They have very different approaches to the problem.
I'm not going to state here every advantage and disadvantage of each one. The link I posted should help you on that.
I too was confused like you, but in short, investigate both, make some spike implementations with both, and check the todoMVC project. Choose wichever suits better your requirements and even personality. :)
A much more fairer comparison could be "Backbone and friends" vs "AngularJS". Don't forget Backbone's friends (plugins and modules).
You can do great things with both.
I've been there past few days. I've implemented a simple CRUD over REST api in both frameworks. Here are my thoughs:
Angular is harder, because it's convention over configuration, new concepts like directives and such, you need to think with extending HTML instead of javascript hacking (which can be not that difficult for flex practitioners).
But in the end I prefer it because it does more than backbone out of the box. You don't need to write jquery stuff. The templating is way more readable than using Backbone and underscore templating. There is less code (easier to maintain), and I like the way I can have a component approach for structuring my clientside code.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm choosing a javascript framework for my Chrome extension programming (localStorage, lots of ajax calls, filtering, json manipulation). Do you recommend AngularJS or Backbone? I started with JS a few months ago (I have PHP and Java background) and the main problem for me is to have a good and clean structure of my web app.
What I like about AngularJS? The two way binding and the concept itself.
What I like about Backbone? It's really simple for beginner. And there are a lot of resources.
Full disclosure: I work on AngularJS, and obviously have a bit of a bias. ;)
If you're looking for an opinionated application structure, I would definitely stick with AngularJS. Backbone provides many helpful utilities, but there are many choices that you have to make about how you want to connect things. From my experience writing medium/large apps with Backbone.js, I've found that I have to put in more effort to keep things organized compared to AngularJS, which has much clearer separation of concerns.
The best choice is to code little projects in these two libraries.
Why not test and see the code from Todo MVC project from Addy Osmani and after that, make your choice ?
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm looking for tutorial(s) on how to refactor JavaScript application into a JavaScript application using one of the existing JS MVC frameworks. Anyone got any?
Yes, I recommend the Backbone-Boilerplate located at GitHub.
This is beneficial because, not only do you get the Backbone MVC, but also require.js AMD, and underscore.js templates. The authors have been consistently active, and the code is impressive to work with.
Here are the associated tutorials:
Introduction
AMD Module setup
Boilerplate
Overview
Router Explanation
These were the tutorials I used to get it up and running. Also included is Node.js and Grunt build system. They are very much worth the effort if you are not familiar with them. I just saw today that a jQuery project is incorporating the Grunt build system. This is a good setup.
UPDATE: Apologies if you were already aware of the boilerplate. I realize it does not directly relate to refactoring. This looks like a good post on refactoring MVC.
Documentation may be sparse as it would be specific to how your codebase is architected. The key notion would be Data maps to Model, GUI maps to View, Collections contain multiple models, and the Router is used to route events.
Hope that helps.
All the best!
Nash
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I keep hearing about many JavaScript frameworks i.e.
jQuery
YUI
DOJO
ExtJs
Prototype
Mootools
Scriptaculous
Spry
and a few more.
Can anyone please tell me what specific purpose, do these framework serve?
I am a user of jQuery only.
This is a short description, based on my experience and knowledge (and IMO):
jQuery -> is the most popular javascript library available (great support available on the net and a lot of plugin written for it), it's simple for all (included designers). It's the best choice for dom manipulation and to write code quickly (ideal for front-end)
DOJO -> advanced js library which offers mechanism for loading js "modules" as necessary
ExtJs -> one of the most advanced and powerful js library. It's build with OOP in mind, it offers an huge number of UI components. It's not intended for designers, it's pretty heavy (size of sources). It's the ideal choice for advanced backoffice UI
Prototype -> the evil! Simply avoid this library, it extends default js objects by causing a lot of troubles
YUI -> similar to ExtJS (ExtJs was born as an extension of YUI, so if you have to choose one of the two go for ext :P)
Mootools -> I don't know :P
Scriptaculous -> as far I know, the best for js animations (it was one of the firs library for this task)
Spry -> it introduces some new "concepts" such dataSet. Few people use it :(
These all are javascript libraries, more or less they share the common purpose albeit with different syntax:
Cross-browser issues handling
Animation
Custom dialogs and widgets
Ability to write lesser code
Specific selector engine
Creation/Modification of DOM
Event Handling
Utility Functions
AJAX
Following article is also interesting to read:
Compare JavaScript frameworks
Given they are all JS frameworks they serve almost the same purpose as jQuery serves, by they differ in things such as ease of use, feature richness, UI components, shielding from browser specific functionality, performance, and many others.