I've been looking into several of the JavaScript MVC Frameworks (Backbone.js, Spine, SproutCore,etc.) and it seems to me that all of these are designed to act as 'single-page' applications. All of the examples I see have an index page that act as a front controller, and use #
or #!
style URLs for different pages, and handle the entire rendering of the page.
I have several projects where I would like to use a more 'traditional' style of URLs, and having more structured JavaScript to handle some of the more complicated parts of the application. are JS MVC frameworks the answer here, or should I be looking for something different?
1 Answer 1
JavaScript MVC is just a code organization pattern.
They happen to work well with SPA but they can be used in normal applications.
However you don't actually need a JS MVC framework. You can just write modular JavaScript using some kind module loading strategy.
As long as you separate modules into separate objects / functions / units the code should be structured and clean.
-
I believe the Steal framework can help out with the module loadingChristian Horsdal– Christian Horsdal12/09/2011 20:21:04Commented Dec 9, 2011 at 20:21
-
Steal/RequireJS, scripts and namespaces, and script packagers and dependency managers are all popular module loading strategies. I would actually recommend against steal if your not using javascriptmvc.Raynos– Raynos12/09/2011 20:24:00Commented Dec 9, 2011 at 20:24
-
Where does the business logic sit in a modular pattern? Would it be in it's own main logic module which is loaded in on application init?Ian Jamieson– Ian Jamieson01/24/2015 01:16:53Commented Jan 24, 2015 at 1:16