title: The role of controllers in Backbone.js
body: <p>If I created a standard webapp with 3 different "states": index, view, edit, would I create a single controller that had 3 different routes? </p>
  
  <p>Assume the index has 4 Backbone.Views associated with it and edit has 3. If one navigates from index to edit: is it standard to change the appearance of the page by simply removing all the index Backbone.Views and rendering the edit ones? That seems like a lot of work - would it be wise to just toggle "display:none" when moving between modes? If so would that functionality be within the Controller's functions?</p>
  
  <p>For instance would the following be a valid way of doing it?</p>
  
  <pre><code>window.MyController = Backbone.Controller.extend({
    routes: {
      '#index':index,
      '#view/:id':view,
      '#edit/:id':edit
    },
  
    switchState: function(state){
      hideStates();
      showState(state);
     },
  
    index: function(){
      switchState(index)
    },
  
    view: function(id){
      switchState('view')
    },
  
    edit: function(id){
      switchState('edit')
    }
  })
  </code></pre>