@Mohamed, I have used the controller/action architecture in a full fledged enterprise application and it is very elegant and pleasant to maintain/extend. The trick is to organize your logic in several utility modules (such as the ones I have in the "scripts/utils" folder: alert, form, helpers, tooltip, etc) and to use a base class for your controllers. I use the base controller class called "scripts/utils/basecontrol.js" to handle the page transitions and even model popups, so my derived controllers can change pages or trigger a modal popup simply by calling the base controller actions with options like this:
- this.view({
- url: 'views/pages/index.html',
- selector: '#main_container',
- fade: false,
- fnLoad: function(el) {
- $('.tweets', el).relatedTweets({
- query: '#javascript',
- n: 50
- });
- }
- });
@thecountofzero, thanks for all the contributions! It helped me get up to speed with CanJS. PS -- I didn't mean to take over the thread but was in the spirit of code evolution :)