views:

272

answers:

4

I am a newbie in web development using javascript libraries. But I recently saw a J2EE web application that uses ExtJS extensively (say 90%) for rendering the web pages. The web pages in question are either simple forms or grids (tabular reports). The JSPs are fairly threadbare and simply delegate to the ExtJS framework (using onReady function) which then makes AJAX calls to the server and renders the pages. There is a separate .js file for each web page that encapsulates all rendering logic within ExtJS functions.

This is the first time I am seeing an application coded this way. I would like to know if this is a common approach to use these days or is this an extreme use of a javascript library. What are some pros and cons of this design ?

+2  A: 

Cons:

  • Pages won't work at all if the user has JavaScript disabled.
  • The user has to wait for the script to be downloaded, parsed, and executed before any content appears. Depending on the design, the user may also have to wait on some AJAX requests after that.
  • Accessiblity is harder to implement.
Annie
Pros: (1) it looks cool (2) it looks cool (3) it looks cool .. :P
Lukman
Wait one time for scripts to load and cache, or wait for every single page to load from the server every time. Hmmmm. Amazing that there are no pros to writing client side UI's (you should mention this to Google).
bmoeskau
I was talking specifically about the question of rendering the initial view in JavaScript--this is different than using AJAX to load updates or making cool-looking client-side UIs, which can be done with progressive rendering.
Annie
+3  A: 

One advantage of a Rich Internet Application is that you free up your server(s) from the rendering responsibility, and delegate this to the clients (the browsers).

In a 3-tier architecture, you would literally take the whole presentation layer away from your hardware. You would just need to serve the static files (XHTML, CSS, JavaScript and images).

Daniel Vassallo
+2  A: 

Pro:

The system looks and behaves much better than with regular plain HTML

Con:

The system is hard to debug and modify if is not coded by developers with good experience on the framework.

You can mitigate that cons by using a server side library such as GWT that even can be used with Ext: GWT-Ext

OscarRyz
I understand your point about 'hard to debug' - to a degree, but I believe that a server side library such as GWT-Ext is going to be hard to debug as well if they don't have experience - i.e. this particular con is a general rule of coding with any library.
Jamie Love
+2  A: 

My company develops RIAs like you describe as its main focus. These applications (some are in Flex, some in ExtJS) are designed to be highly functional applications for a relatively small set of people.

For ExtJS applications, our main approach is to have static HTML and JavaScript files that then build the UI on the client side (for users, they generally experience sub-second load times as everything is cached and JavaScript runtimes in newer browsers are amazingly fast). Whether it is an all-in-one 'HTML' page, or spread across multiple HTML pages depends on the app (or segment of an app).

All data is then served via AJAX requests through web services (mostly ESTful APIs). The ExtJS grid for example can be served with data with such a trivial server side component it's almost embarrassing.

All complex server side components that we write end up being complex business logic that is not suitable for the client side (or is a duplication of client side functionality for security or checking purposes).

All-in-all I am a big fan of this approach, for the right situation. I would not suggest it for public web sites - but it has a really nice niche in the business application space for example.

Jamie Love