Web dev frameworks vs RIA

6 minute read

How do traditional web development frameworks cope with RIAs?

By RIAs, I am referring to the Flex/Silverlight model (Ajax has a hybrid model in my view, so I'm not discussing that here since I don't want to muddle up the question).

Coming back to topic, I see that the traditional web development frameworks are inside-out and RIA development as outside-in:

Traditional web dev frameworks RIA frameworks
Flow: controller ⇒ model ⇒ view (pages) view ⇒ controller ⇒ model

Everything built into the framework. View is generated via templates.

View is designed separately and it's what runs first. Backend is a bunch of web services.

Question: How is this resolved practically?

For example, how do people using Django or Ruby on Rails actually write, say, Flex frontends for their websites?

Do they ditch their templates/rhtml? Do they design the RIA first and then the web service, or the other way around? ... etc.

I couldn't figure out the answer and since there are people out there doing it, I'm hoping the "hoosgot" i.e. lazy web gods will answer.


Swaroop says:

@Danny : Thanks for the example, I get what you are saying.

@Tarique : Haha. So that's the "backend accessed via web services" approach.

@Tim : Thanks, that's the kind of tips I was looking for.

@Mrinal : Whoa, nice flow list :) ... Thanks for the insight, I did want to confirm that templates are not used as much in this way of development.

@Manish : The title was meant to indicate only the conflict of interest w.r.t. the V of MVC (templates vs RIAs), not to be taken in general terms :)

But there is a change in how the backend is designed, right? Previously, most of the work would be done in the controller but now a proper API has to be designed so that the workflow can be invoked by the RIA...

@Raghu : Yes, I agree, but what I was referring to was the contention of how the system is built, specifically w.r.t. the V of MVC and how it affects the backend design :)

Danny says:

I'd suggest that if Web standards are used as a common interface, it really doesn't matter!

Ok, an example. A while ago I needed an easy personal activity tracker. I wanted it in my face a bit on the desktop, which called for something RIA-ish. I wanted the data available in a form that's reusable, and I want a straightforward view on the web (so my colleagues could see what I was working on).

so I wrote a little desktop app in Java. It's essentially MVC, with a fairly trivial domain-specific model - I have activity items with title, description and tags.

Server-side I have a Talis Platform store. The desktop app communicates with the server by POSTing a chunk of the domain-specific information expressed as an RDF/XML doc - the stores have this kind of interface out of the box.

For my simple Web view of the data, I have a little bit of PHP which does a SPARQL query on the store (standard SPARQL-over-HTTP endpoint also comes out of the box) and uses XSLT to transform it into the JSON consumed by SIMILE's Timeline viewer.

Unfortunately I broke the Timeline viewer bit of the app (I think I got out of sync with SIMILE's scripts). But hopefully you get the idea - small domain-specific components, loosely-coupled using a standard general-purpose protocol (HTTP) and standards general-purpose data model (RDF).
For reuse, I can query the store however I like

Tarique Sani says:

Since most RIA web apps have a DB, we do the DB design first then just bake the controllers and do the webservice views (sensible frameworks allow you to have webservices by just creating the compatible views)

We just don't do the front end ;)

Danny says:

oops, forgot a link: http://dannyayers.com/2007/11/02/more-dogfood

Tim says:

In the case of Ruby on Rails, I've seen the rhtml files used to simply output XML which is easily consumed by a Flex application.

Web dev frameworks vs RIA says:

[...] https://www.swaroopch.com/2008/04/14/web-dev-frameworks-vs-ria/ asks Hoosgot, [...]

Mrinal Wadhwa says:

This is what works for me, I'm sure different people have different approaches ..

Start from what the user wants to do.
Forget about the underlying technologies
Design the best way the user could do what he wants
Now choose the best front end technology (RIA if needed) to achieve the above design
If the current technologies cannot achieve your design goto step 2.
Now think about the data that the application needs to pull off the above design
Then think about the server stack that would help you read and write this data as fast as possible or at least as fast as needed to sustain the above experience.
If current technologies cannot achieve 7 goto step 2
Check if this server stack will scale to your needs, if not go to 7
Check any other aspects important to sustain the experience, if fail goto 2 or 7
Check if you have the skills to build in all the above technologies/platforms if not then either learn the new skills or goto 2 or 7

Sorry for the rather long flow, I started off writing some simple points :D

Anyways coming to your question ..

Yes, the templates have no use in 99% of the cases, although I have seen some cases where generation may make sense .. FLOB framework for SAP BSP is a good example http://code.google.com/p/flob/ .. you have to note that the kind of RIAs you can create with this approach is very limiting if you want to follow my algorithm above

The interface to the backend data could vary ... could be SOAP or Rest based web services that give out XML or JSON .. my favorite one though is AMF .. there are AMF servers available for several backend technologies ... LCDS, BlazeDS, AMFPHP, WebORB for (Java, .NET, PHP or ROR), PyAMF, Flourine, Granite Data Services and several others.

Manish Jethani says:

The title of your post should be 'Web dev frameworks and RIA' (you see?)

Instead of generating the HTML view, now your web dev framework (be it Rails or Django or whatever) generates XML or JSON or whatever format that can be consumed easily by your RIA. That's all.

As a Flex developer, you code to the REST-based APIs. You're not even aware of what's enabling that. You don't even know what the guys on the server side are using. As long as they speak HTTP and XML, you're good.

Flex/Silverlight is not putting your server-side frameworks out of business. It's just taking over the responsibility of the UI.

Raghu says:

My 2 Cents...

I will look at what data I have
What does the user want (slightly different from Mrinal's approach as I think you cant deliver to the users what you dont have, atleast, without tricking them)
See what Technology you are using at the backed & what your front end can consume (like Manish says)
Then decide on what approach I take - REST, Web Services, AMF, RTMP ... etc

BTW, check out the new PyAMF (http://pyamf.org/). It provides AMF support for Python.

Data Push in Flex with Java, .NET, PHP, Python, Ruby and more… « FLEXing My Muscle says:

[...] have been going out right implementing solutions on different platforms for AMF. After seeing this post by Swaroop on RIA and Backends, I decided to write this. So, here that the options available for [...]

Nodalities » Blog Archive » Google App Engine and the Joy of WebArch says:

[...] on Swaroop C H’s Web dev frameworks vs RIA : [On the question of how one develops both client- and server-side with frameworks] I’d [...]

Nodalities » Blog Archive » This Week’s Semantic Web says:

[...] Web dev frameworks vs RIA [...]