Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>When it comes to writing Backbone application, it actually makes a lot of sense to develop it solely on its own. In other words, develop it, as you said, as a <strong>pure</strong> html+css+js application.</p> <p>There are very good reasons to do so:</p> <ol> <li><p>Deployment</p> <p>Consider when you are deploying your application. At some point you will surely want to deploy some modular component of your application. This maybe the backend services which are responsible for serving json to your clients, or it could be a tweak on the UI. Whichever it may be, it is best if you are able to deploy each of them independently. </p></li> <li><p>Modularity</p> <p>It may sound attractive to be able to use some rails magic behind the scenes to help develop your UI. However, consider the modularity of your project. </p> <p>IMO, Backbone (or any AJAX application) is beautiful. And the beauty comes from the very fact that the UI code really has nothing to do with the implementation of your backend. It could talk to a PHP/JAVA/RAILS/PYTHON/YOU-NAME-IT server, and it still wouldn't matter. That is, if you're implementing a RESTFUL server. In fact, the UI code could rest on an NGINX server that serves nothing but static content, and it would still run perfectly fine. This is actually what you want. Your UI code should at no point (during development or production) be aware of your backend's framework or whatever tools your backend supports. It would be a crime to introduce unnecessary dependencies into your Backbone project. </p> <p>Imagine one day when you see fit to migrate to a different architecture which isn't Rails. It would be a nightmare if there are any dependencies at all. Much rather have a UI that is totally independent of your backend implementation.</p></li> <li><p>Packaging</p> <p>You mentioned you're going to use PhoneGap to package your application. This is probably the biggest reason why your project should be independent. You will not have the luxury of loading your js from your servers when you're say, submitting your app to Apple, if you ever plan to do that. All scripts must be packaged into the App which must be standalone.</p></li> </ol> <p>Last but not least, to answer your question about suggestions for 'other approaches'. That is quite vague, so I'm not sure if this suggestion would help, but I wanted to point you to some resources that would help organize your Backbone projects, and make your life easier.</p> <p><a href="http://backbonetutorials.com/organizing-backbone-using-modules/" rel="nofollow">Backbone with RequireJS</a></p> <p>I would argue that this is the most wonderful way to work with Backbone. <a href="http://requirejs.org/" rel="nofollow">RequireJS</a> let's you specify your dependencies in your js files much like you would import in compiled languages, which helps a lot when it comes to organizing your Backbone project, and breaking the code down into smaller modules. The optimization tool that requireJS provides also let's you compress all of your javascript file into a single file. I believe that will come in handy if you want to package your project in PhoneGap.</p> <p><a href="http://documentcloud.github.com/underscore/" rel="nofollow">Underscore</a></p> <p>You mentioned using HandleBar. However, I recommend that you look into underscore's templating engine which is inspired by RoR's templates. And assuming that you're quite comfortable using Rails, the underscore templating engine might just be what you're looking for.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload