Talkin JavaScriptMVC is Hard
Wednesday 03 February, 2010 by moschel
Today, I gave a talk at jQueryConf about JavaScriptMVC. It didn't go great. One tactless audience member even asked me to fast forward my presentation - ouch. I consider myself a very good presenter / speaker. I spoke at a Dreamweaver meetup the week before and got rave reviews. Speaking at every JS.Chi, I've also had a ton of practice. However, this didn't go as well, and I've come up with a few reasons:
- I wrote my speach to specifically address John Resig's comments on why there doesn't need to be a jQuery Enterprise. This was stupid. Don't write a talk for 1 person when you give it to 120.
- People actually like to see code. I tried to keep it all on a very high level to keep it understandable. Challenge people.
- I spoke much too long about the problems before giving solutions. 10 miniutes of the current problems of JS development isn't exciting w/o talking about the solutions.
- JavaScriptMVC is big, and complex. And, you don't understand how it helps unless you've worked on a big project, and really started using it.
How to talk about JMVC
Here's how I plan todo it in the future:Most Important Point: JavaScriptMVC is 2 things - integrated development tools and an repeatable MVC architecture. The benefit of JMVC is that it provides a clear path to adding functionality and does a lot of the things you should be doing on your project extremely easily.I will also break down JMVC by functionality instead of by benefit. But, as this was a jQuery conference, a comparison would have helped. Take the example of twitter's page, with the load more tweets button done in jQuery:
$(function(){
handleDelete = function(){
.... delete tweet ..
}
$('.tweet .delete').click(handleDelete)
$('.loadMore').click(function(){
$.get('/more',function(html){
var html = $(html);
html.find('.delete').click(handleDelete)
$('#tweets').append( html )
})
})
})
vs JMVC
$.Controller.extend('TweetsController',{onDocument: true},{
".loadMore click" : function(){
$.get('/more', function(html){$('#tweets').append(html)})
},
".tweet .delete click" : function(){
... delete tweet ...
}
})
And I would list the advantages, such as the forced constraint of controllers, not being lost in a nest of anonymous functions, etc. I would slowly build this up to show how using views and models can also make a difference.
Finally, I would use the build tools to test, compress, document, and get errors from the application.
Subscribe to:
- Jupiter
- Open Source
- JavaScriptMVC