I have been learning Ruby & more specifically the rails framework the past few months and am now preparing to dive into Javascript. I know that any good/modern rails app will include javascript within its code. I also know that Javascript/Jquery/Coffescript help with adding some interactivity, style and functionality to web apps.
My question is what is the standard set of problems/features that one approaches with JS (or Jquery/Coffescript ect) vs Ruby/Rails?
Use Rails to:
- Build Extensible applications with MVC (Model, View, Controller) code.
- Manage Data (CRUD - Create, Read, Update, Delete).
- Manage Security (Access) and Authentication (Identity).
- Manage State over time.
- Apply REST for standard actions.
- Apply a 'middle layer' for validations (the database being the backend validator).
- Manage the back end part of AJAX communication and processing.
- Build applications in a TDD/BDD Agile fashion with code that is easy to understand.
- Build API's for communication.
- Provide a full-stack Application Server.
Use Javascript and libraries like jQuery for:
- Improved user interaction - Sliders, highlights, glows, color changes, etc.
- Improved user feedback - the 'front line' for immediate feedback for validations.
- Improved page load speed - less page loads and fewer user experience interrupts.
- Improved User experience with effects. - Transitions, Fades, etc.
- Presenting and Managing interactive contents e.g. maps, video, sounds.
- Tasks that are specific to managing the DOM - HTML, CSS and browser events.
- The front end part of communication via AJAX.
- Making things look & work similarly in different browsers & browser versions.
- Pre-built tools for sliders, image fades, forms, layouts, tool tips, etc.
- Pre-built mini-apps, ready to apply to any data. Isotope is one amazing example!
Some tasks you would do with javascript:
- update parts of a web page without the user having to reload the whole page.
- 3rd party sources eg - I had google map on a site and used almost all javascript for it.
- pop-ups, user interaction
- display videos, interactive images.
Some tasks you would do with ruby/rails:
- all your server side stuff like get data from your models.
- make sense of any data your client sends to your application.
- process your data before sending it to the browser.