views:

333

answers:

2

I am learning Python and building my first web app. I have been going thru the django tutorials and just beginning to think about how to do the client side. I want it to be web 2.0-ish, and will need some AJAX/javascript functionality for displaying lists from the database, and cool things like date choosers, auto-completion, etc.

It seems html/css/javascript (esp. jquery) is the most popular option. Being a newbie I am intrigued by frameworks like qooxdoo and sproutcore, but don't understand exactly how they work. For example:

  1. Can I easily reuse code from one app into another?
  2. Can you have one page static pages easily also?
  3. Are they only one page, kind of like gmail? Does it matter?
  4. Is it really any easier than not using it? I mean is the learning curve for the framework equal to learning html/css/javascript?
  5. Are these type of apps slower to load because they have a lot of overhead?

Or,

What are the pros/cons of using/not using one of these?

Any advice for a beginner is welcome!

+3  A: 

You have to bare in mind, the T in HTML stands for text. HTML is designed to show documents. JavaScript added interactivity to these documents. This was, "perverted" (in a way) up to a point, where JavaScript was used to create desktop-app-like experience manipulating DOM objects.

Nowadays, if you look at web apps, there are three main categories:

  1. web sites
    Such apps basically are content/document delivery services. you can browse, search, edit and post some documents. that's basically it. stackoverflow is a good example for this category.
  2. web interfaces
    Such apps present a web frontend to an application that actually runs on a server. They act as interface to a business logic, that runs on the server. Online banking apps are a good example, or web interfaces for different kinds of services. The classic google page is, in a way.
  3. RIAs
    These apps completely run on the client. They obtain data from the server and provide a user interface, that allows manipulating that data right on the client side and possibly submitting a progress/result.

Of course there're apps that cannot be classified in just one of those categories.
Now for web sites, it is very important to produce semantic, clean and valid HTML, for a number of reasons. SEO and accessibility being the most important ones.
For web interfaces and RIAs, this in not the case. Here, on the client side, the most important thing is usability. For web interfaces it is desirable avoiding whole page refreshs and facilitating user input to a maximum. For RIAs, this is a must. Both categories do not use HTML to represent documents, but to build a user interface. For web interfaces, classical forms may do the trick, depending on the complexity of user input, so you can either treat them as web sites or as RIAs for this consideration.

While websites use HTML to represent actual data, CSS to define its visual appearence and JavaScript to add interactivity, web interfaces and RIAs use DOM objects to create a UI, CSS to skin that UI and JavaScript to implement client side business logics.

So while the platform you are using is the same, you're really doing something completely different. Think of it like text mode. The characters on the screen may be representing text, or GUI elements. (I suppose web interfaces would be command prompts in this analogy :D).

Frameworks like qooxdoo and sproutcore are designed to facilitate the creation of RIAs. Since the DOM is in a way misused in this approach, they provide the necessary abstraction to bridge between UI-logics and the underlying DOM-manipulation. They nullify the need for HTML and CSS, because these are not tools designed to create interactive UIs.

Depending on what you intend to do, you will have to choose an appropriate tool.

greetz
back2dos

back2dos
+5  A: 

Here is an answer from the qooxdoo perspective:

Can I easily reuse code from one app into another?

Yes, you can. You can organize your code in "libraries" which can be included in multiple apps. But each app will be an individual whole (think of it as a binary with the library code being linked in statically), there is no manual copying around of .js files.

Can you have one page static pages easily also?

I'm not sure what you mean here.

Are they only one page, kind of like gmail?

Yes, you build single-page applications with qooxdoo.

Does it matter? Is it really any easier than not using it? I mean is the learning curve for the framework equal to learning html/css/javascript?

That largely depends on your background. If you have a good grasp on OO, maybe even experience with an OO interface library like Qt or Swing, picking up qooxdoo should be very straight-forward. In such a case I would argue the learning effort is less than compared to html/css/javascript, as you are basically working against an OO class library that shields the underlying technology from you. (Which is a good thing. Getting e.g. cross-browser CSS right is tough).

Are these type of apps slower to load because they have a lot of overhead?

I would say so. You pay a penalty for the infrastructure. But if a real web GUI is what you want, it's worth it.

What are the pros/cons of using/not using one of these?

As said elsewhere, it really depends on what you want to achieve. From your question I gather that you don't just want to "display lists from a database", but you want an interactive user interface, with high-level widgets (date chooser), cross-browser event handling (auto-completion), maybe other controls, layout management, and such. For such a case I say the pros outweigh the cons.

But it's an investment, too much for a one-shot project I'd say. And if you just want a few list views, stick with the Django templates, maybe spiced up with a bit of Javascript thrown in.

ThomasH
I am interested in this for a certain project, but if it works well, I most likely will be using it again. I don't mind learning new technology.From what has been said, I will be creating a small web site with the normal about, faq, home, ... pages. Inside this will be either a web interface or ria area that contains the application. It seems I need to determine if I want my app to behave like a 'souped up web site' (web interface) or like a desktop app (ria) and then make my choices. It seems that it is possible to make very nice apps either way?
Steve
Just be aware that with a web interface you still have the most disruptive part of the web experience - the page change. qooxdoo supports application islands on a normal page with its 'inline' application type. But if you want your visitors to easily switch between web pages, you want to make sure these are light and load fast. Which somewhat limits what you can do... You might want to look at qooxdoo's Showcase sample app, which looks rather "page'ish" but is in fact a single (inline) application (http://preview.tinyurl.com/3yzbayw).
ThomasH
Thanks for making it clear that I can use qooxdoo 'inline' with other web page content. I had seen the sample page before and was impressed with the nice clean look of the apps.
Steve