Knock JavaScriptMVC's Back Out
I've read a lot of articles and tweets comparing JavaScriptMVC, BackboneJS, and KnockoutJS. A lot of good things can be said about these frameworks. Backbone is largely similar to JavaScriptMVC's MVC components, and Knockout has a really amazing observable system.
But it gets under my skin when people compare how easy it is to 'get up to speed on' these frameworks. JavaScriptMVC's API is, in my opinion, just as simple as any other framework. Here's how you setup a model to talk to your server:
$.Model('Todo',{
findAll : '/todos',
findOne : '/todos/{id}',
create: 'POST /todos',
update: 'PUT /todos/{id}',
destroy : 'DELETE /todos/{id}'
},{})
Here's how you can findAll those todos and render them in a list using an ejs template:
Todo.findAll(function(todos){
$('#todos').html('todoList.ejs',todos);
});
Here's a jQuery widget that listens for clicks on those todos and delete them from the server:
$.Controller('Todos',{
'a.destroy click' : function(el){
var todoEl = el.closest('.todo')
todoEl.model().destroy(function(){
todoEl.remove();
})
}
});
$('#todos').todos();
It's simple. But, JavaScriptMVC does have a much longer 'ramp' up speed than these frameworks simply because it's got almost everything. Take a look at its core features. It's getting started guide alone takes you through:
- creating files and folders for your app
- writing code for it
- documenting it
- testing it
- building a production build
Many apps might not need all this. But I promise that if yours does, you and your team's total ramp-up speed will be far faster with JavaScriptMVC than some piecewise collection.
I wouldn't try to dissuade anyone from trying out any other library or framework. Just make sure you are comparing apples to apples. Not an apple to an orchard. Of course, if you just want a few apples, you can download just JMVC's core MVC parts.
Subscribe to:
Related Content
About Jupiter
Jupiter is dedicated to making JavaScript an easy and enjoyable place to develop kick ass apps. We open-source everything and provide expert web application development, support, and training.
Recent Posts
- Significant Whitespace
- 3.2 $.Controller - Templated Event Binding
- Deferreds and 3.1
- jQuery Resize Event
- FuncUnit Humor
- Having your Cake and Eating it without Getting Fat
- Why You Should Never Use jQuery Live
- Knock JavaScriptMVC's Back Out
- Advanced jQuery Training at SF jQuery Conf 2011
- JavaScriptMVC and List Performance
JavaScript development, design, and consulting.