PDA

View Full Version : Questions from a Rails dev



cjbottaro
2 Jun 2011, 10:04 AM
Hello,

So I've been using Rails (long time) and jQuery Mobile (short time) and am thinking of moving to Rails + Sencha Touch, but have a few questions...

So from what I gather, writing a Sencha Touch app isn't like writing a web app at all. Basically, it's like writing a desktop GUI app... in Javascript. The only reason to communicate with a web server is to persist state (and bootstrap the app). Is that right?

One thing that kind of bothers me is that in a normal Rails app, you spend a lot of time writing models, views, controllers on the server side... and in a Sencha Touch app, that work is duplicated (or replaced) client side.

In a Sencha Touch app, you don't use URLs for navigation? A normal web app is made up of a collection of (dynamically generated) pages, which you navigate between using links. That whole paradigm is done away with in Sencha Touch?

Has anyone used jQuery Mobile? The design philosophy makes intuitive sense to me. It's still just a normal web app. You click on links which make (ajax) requests for pages which are then navigated to. The web server still returns normal HTML responses for new pages. Everything is still done with HTML and CSS.

You can actually make a normal resource based Rail CRUD app with jQuery Mobile very easily... almost using just the scaffolded Rails views.

Unfortunately, jQuery Mobile is (still) in alpha and it shows.

It seems like Sencha Touch kind of obviates so much of what Rails tries to provide as web app framework, which makes me a little uneasy. Has anyone used Sencha Touch with Rails? What's it like? How much of Rails convention is broken?

Thoughts?

mitchellsimoens
2 Jun 2011, 4:04 PM
Welcome to Web 2.0/3.0.

A proper app should be on one page. I would say that work is not duplicated as developing back-end and front-end are separate. Sure, you should (IMHO) develop using MVC patterns on the back-end but why not take that same pattern and apply it to the front-end? Keeping things separate is great!

You say the only reason to have front-end/back-end communication is to persist state. Every web app is going to be data driven so communication between is mainly on this data transfer.

Making a call to the back-end and then present that HTML/CSS is not a great idea for the type of apps that are usually created with Sencha frameworks. I use Sencha Touch (and Ext JS) and PHP together a lot. All PHP's job is is to send back JSON data. Think of it this way, Sencha Touch is the V in MVC. So let Sencha Touch handle the viewing and let your back-end handle getting the data. Both will overlap when it comes to the C part.