0

As I understand it the "conventional" way to handle page reloads is to duplicate functionality and presentation on the web stack using its controllers, views, and models. I'd appreciate insight on other (possibly better) ways to handle these situations. As well as feedback on the following two approaches:

  1. Reload the js framework based app/suite on every web (stack) app page thus forcing the js framework to handle all routing and rendering

  2. Use the web stack to route interactions and then use backbone to display views depending on the interactions.

Thanks!

Ari
  • 4,121
  • 8
  • 40
  • 56

1 Answers1

0

IMHO the 2. approach is the one Backbone has born to :)

Following this approach we'll finish with what is called Single Page Application.

But to achieve this in medium-large applications can be very exhausting. You have to deal with complicate Router that has to be in charge of initialize or replacing elements, also you have to take care with memory leaks and ghost Views. You have to define a system to refresh your Collections and Models due you are reusing them in every page, ...

So a combination of both approaches can be also a good idea. You can split your application in modules like: ManagingUsers, ManagingPosts, ManagingMedia, create Single Page applications for these modules, containing index, edit, show, ... actions that don't reload the page, and if you move to another module the page will be reloaded and in company of the whole framework and with a healthy memory reset.

fguillen
  • 36,125
  • 23
  • 149
  • 210
  • I'm a bit confused by your post. Approach #2 as I intended is essentially the same as your suggestion (see last paragraph of your post). Consequently, approach #2 does not yield a conventional single page application -- since there are intentional page reloads. Could you clarify what you meant by `Following this approach we'll finish with what is called Single Page Application.` – Ari Aug 06 '12 at 08:18
  • As I understood your _Approach #2_ suggests to load the page once and make every follow page change through _Backbone.Router_ and AJAX calls without any real page reload and I think this match with the SPA pattern. In my first and second paragrapah I said this is a very elegant solution but in the third paragraphs I talk about the posible problems and in the fourth paragraph I talk about a mixed solution. – fguillen Aug 06 '12 at 12:14