Saturday, June 21, 2008

Single Page Application

Normally web application is developed using multiple html pages. Each html page will form the entire html from start to end and flushed into and rendered by browser. What if the entire page is visualized as partial renderable unit and each rendering will be done using Ajax and updated using DOM/Css/Javascript. So we will get or think of nice MVC in the client side where Controller javascript has its job of controlling lifecycle of renderable unit called widget, view has its job of using pleasant color, layouts (all from CSS), data again as java script objects of model (probably imitated or duplicated from the server side model using javascript to java and visa versa - seam remoting will do the same) So effetivly page will get the only data its need and assembles its mark up in the client side, so no more noise html tags, only protien for the application shuttles between server and client. MVC will utilize Comet, Ajax technique extensivly to acheive the requirement.

Comet, Where and How can I use it?

What is Comet?
It is Server Push, it is also called Reverse Ajax. Please look at wikipedia comet.
If we look at where the break even for new technology occurs, then it involves multiple factors like its capabilities are properly understood and started yielding best result for the technology consumer. Industry support, required skill set all maters. Norammly it will start with bleeding edge technology savy people (risk takers) and percolate gratually to mass.

I use to hear from guys, no body will be fired off buying product(software/hardware) from IBM or Microsoft. It is really safe being with big wics and nobody will question them too. It holds true for even bringing new technology into the fold.

If we look at Ajax, in my experience, I worked with Remote Scripting in year 1999/2000 using applets/hidden Frames. I found this trick from one of IBM's article but I totally clueless to find that old article now. But how Ajax got such a phenomenal lime light in the past few years? It is because some web sites which users frequently visits implemented it and user finds it very useful. One such application is google suggest and microsoft web outlook application. Both used Ajax in a good way. So will the same trend make Comet popular? In my purview, comet will defintely make good choice for couple of use cases.
Lets look at what kind of application now implements Comet (Reverse Ajax)
Meebo, Embedded GTalk in the Gmail are very good example of this kind of technique.

Lets look at some application like
1. Dashboard monitoring, notification alert etc.
2. Stock application
3. Chat
4. Game score display application
5. Whatever application which frequently look for changes in the data from the datastore (DB Server, events, notification system or services)

These application will definitely benefit from the comet kind of technique.
DWR, GWT with comet plugin, JQuery with Comet plugin or Dojo Comet toolkit can be used to enable client side comet.
For Server Side,
Comet needs special support from Server, as it needs to address scalability via effective thread management unlike normal application. Comets need multiple open connections to the client, hence special attention needed.
Servlet 3.o spec defines new API in HttpServletRequest/Response for comet kind of interaction. Jetty has been instrumental in driving comet upto Servlet 3.0.
Glassfish has good support as it has Grizzly nio layer.

Other impact,
Comet enabled application normally needs or frequently establish connections to the server. So in corporate environment, it will normally, when it opened and kept for long, will increase the network or internet usage and will be easily increase internet usage rate and you will get caught for heavy internet usage. This will also applicable for Ajax-polling.

What should my future browser do?

I was wondering if Web browser capable of installing javascript extensions like Ajax framework on top of existing runtime (it is little bit more than js caching) with its own security and other aspects built around, we can avoid multiple downloads many a time and go on building rich internet applications without worrying too much about size of the scripts. Browser should be able to
  1. understand different versions of javascript applications
  2. use requested version and able to download like plugins if it is missing
  3. Multiple threads for processing html/js/css or dom updates
  4. use these extension across different domains, so javascript extension and html page should follow set off rules to share across.
this kind of feature will enable creative people to develop rich features and perfectly make the browser as a platform.

Thursday, June 12, 2008

Career advice

Came across nice post about career advice.
Scott, Adams is saying, If you want an average successful life, it doesn’t take much planning. Just stay out of trouble, go to school, and apply for jobs you might like. But if you want something extraordinary, you have two paths:
1. Become the best at one specific thing.
2. Become very good (top 25%) at two or more things.
But he is also recommending option 2.
The first strategy is difficult to the point of near impossibility. Few people will ever play in the NBA or make a platinum album, for ex Sachin Tendulkar or me . So it is hard to getting into that category.
The second strategy is fairly easy. Everyone has at least a few areas in which they could be in the top 25% with some effort. So how easy to mix 2 or more familiar and lovely things which we normally do to become very good at it.