Introduction to Bishop
This paper presents an architecture for server side web applications. The architecture is based upon the smalltalk MVC (Model, View, Controller) architecture which is used to build GUI applications. IntroductionThe architecture of web applications has evolved from pure client-server based (with various thin/smart/fat/dumb clients) to something that more and more resembles the MVC pattern. Of course the web is still client-server, it is the server that is implemented with a MVC architecture. A webserver serving static html pages to a browser is an example of a classic client-server architecture, a slightly more advanced example is a cgi application that generates dynamic html pages on a per request basis. This server model doesn't do a good job when it comes to handle the complex requirements of today's web applications. The MVC architecture is an architecture well suited for gui based applications. One benefit of the MVC architecture is that since the application is divided into distinct parts, maintenance and upgrades are (relatively) easy to implement. The conventional MVC architecture is (obviously) not very well suited for developing server side web applications, due to the fact that they are ust server side. Something slightly different is needed. Existing "MVC" architectures for web applicationsMany have tried, few have succeeded. There has been several attempts to implement the MVC pattern for web applications. Some of them have been fairly successful and been used to build large websites, while others barely made it to freshmeat.net's new developer's tools announcement page. One common problem for many of these "MVC" implementations are that the don't implement a pure MVC architecture. A pure MVC implementation has a well defined model, view and controller and they are clearly separated. One of the first MVC implementations that came around was Microsoft's ASP. ASP is a "server side scripting language" [3]. In ASP the view and the controller are implemented in the script code as html and javascript/vbscript respectively. The model can be implemented as COM objects but is, in practice, also implemented in the script code. This tight coupling between the model, view and controller makes an ASP application hard to maintain and understand. Example of similar technologies are JSP and PHP. Another approach to implement the MVC pattern is the "template based architecture". In a template based architecture, the view is a separate html template (file) that are populated with dynamic data from the model and controller. Hence, the view is clearly separated from the model and controller. However, the controller is often implemented in the model, which makes both the model hard to use and the controller hard to understand. Examples of template based architectures are WebMacro [2] and TEA [5]. An organization tends to develop its own platform for web applications. Often is one of the above mentioned implementations used. This architecture leads to another problem, the hashmap. The hashmap is a global container for all variables used by the application. While this strategy might seem appealing for novice software engineers, the use of the hashmap has several drawbacks:
Solving the problem, introducing Bishop
To effectively implement MVC in a server side web context we must describe
the model, view and controller separately. While it might be possible to
describe these using one language we suggest that three are used: Bishop,
WebMacro and Java.
The Bishop language can do the following:
Bishop is an XML based language. It is easy to learn since it only has about 5 constructs. The following is an example of a login request for web application:
When the script is interpreted the following happen:
It is not possible, nor is it intended that any domain, or model, functionality is implemented in Bishop. While it is possible to abuse the usage of Bishop, it is not encouraged. Just as it is possible to abuse Java (hashmaps for instance) and WebMacro. Using Bishop, Java and WebMacro cleanly as intended it will provide you with an environment and architecture that reduces complexity and hence development and maintenance time and cost of web application projects. The usage of a XML language for describing controllers makes some people think that there are disastrous impact on performance, imagine having to parse and validate XML documents for each request! This is however not an issue since pared and validated requests are cached for future use, which means that there is no reason why a Bishop solution should be any slower than a bare-bone servlet implementation. ConclusionExisting architectures for building web application are complex and error prone. A new way of implementing the MVC pattern in this context is necessary. The usage of a controller description language is necessary. This paper suggest the use of the triad of Bishop, WebMacro and Java for the foundation of Web MVC solutions. Bishop is available for download from bishop.sourceforge.net References
|
|||||||||||||||
[home] | [introduction] | [webmacro] | [model interaction] | [developer's guide] | [reference] | [terms and definitions] |