Tuesday, April 6, 2010

We don't need MVC framework on the server side today

I got this thought several years ago when I evaluated Ajax libraries for one project about upgrading an old enterprise application written in PHP and Java. I recalled this because I interviewed with one employer who intends to select Zend Framework now (in 2010). Its implementation of MVC is one of reasons for them to choose Zend Framework. Zend framework could be good candidate for implementing enterprise application. However, I do not think a Rich Internet Application or a Single Page Application needs a MVC framework on the server side today.

Many software vendors talked about Ajax when Ajax was becoming popular. However, many of them talk about their own server side framework, which i personally do not like. I divide those Ajax frameworks into two classes. One is client side pure JavaScript library. The other is Ajax framework running on the server side to generate client side Ajax widget. Personally, I like the pure javascripts libraries for developing Single page enterprise application.

It is not necessary to adopt MVC framework on the server side if we are developing a Single page Web application because we will not generate View on the server side. Supposing we are using ExtJS or Dojo to developing a Single page Web application. All views (widgets) could be written in JavaScript. Browser can either download whole views at one time or dynamically download views on demand. Therefore, why do we still need a MVC framework on the server side? I believe that we only need a front control framework on the server side to supply data (modal) to render views downloaded in browser. With this design, we clearly divide view development and models developing. Also, it is possible to divide developing team into two group. One is good at JavaScript coding and will focus on JavaScript code. The other is good at PHP coding or Java coding and will focus on server side programming. Furthermore, we can avoid mixing HTML, Javascript, and PHP or Java code as much as possible. A designed protocol will link server side and client side applications. JSON could be a good candidate technique to be used for delivering data between browser and server.

Maybe, it could be good idea to implement an Javascript MVC framework in browser?

No comments:

Post a Comment