2008-07-25

On Server side WEB Application Frameworks

Server side web application frameworks are a dead end.

Now that most mobile phones have good JavaScript support (mostly by the use of WebKit in them) and are not just dumb terminals, it is time to develop only client side web applications and stop using the page-per-request web application model.

The future is REST (to let web crawlers index the web) or maybe other Service-oriented architecture protocol and XML or JSON for the data.

The main problem with server side web application frameworks are the load that impose HTML generation on the server and also the long waits to process an action that maybe the server does not need to deal with.

Struts (both Struts1 and Struts2 aka WebWork) have a problem with its design since although there is a controller that forwards actions to views you already need to know what view you are going to render since you have to pass the correct beans to it thus breaking the Model View Controller (MVC) architectural pattern.

public class MyAction extends ActionSupport
{
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
{
...
request.setAttribute("myBean", myBean);
return mapping.findForward("success");
}
}
Just by having to obtain a bean and attach it to the request for the view to render it you are associating a defined view, making mapping.findForward("success"); unneeded as you could just specify the actual view.

Most server side MVC (like Struts and JavaServer Faces) frameworks are just anachronistic by not supporting REST Web Services and need to be replaced by implementing the controller in the client with JavaScript with XHTML for the view and accessing the data model using REST Web Services.

No comments: