Aranea—Web Framework Construction and Integration Kit
Total Page:16
File Type:pdf, Size:1020Kb
Aranea—Web Framework Construction and Integration Kit Oleg Murk¨ Jevgeni Kabanov Dept. of Computer Science and Engineering, Dept. of Computer Science, Chalmers University of Technology, University of Tartu, SE-412 96 Goteborg,¨ Sweden J. Liivi 2, EE-50409 Tartu, Estonia [email protected] [email protected] ABSTRACT proaches and ideas are tried out. Indeed, many very good Currently there exist dozens of web controller frameworks ideas have been proposed during these years, many of which that are incompatible, but at the same time have large por- we will describe later in this paper. On a longer time- tions of overlapping functionality that is implemented over scale the stronger (or better marketed) frameworks and ap- and over again. Web programmers are facing limitations on proaches will survive, the weaker will diminish. However, in code reuse, application and framework integration, extensi- our opinion, such situation also has a lot of disadvantages. bility, expressiveness of programming model and productiv- 1.1 Problem Description ity. In this paper we propose a minimalistic component model First of all let’s consider the problems of the web frame- Aranea that is aimed at constructing and integrating server- work ecosystem from the viewpoint of application develop- side web controller frameworks in Java. It allows assembling ment. Framework user population is very fragmented as a most of available web programming models out of reusable result of having many incompatible frameworks with simi- components and patterns. We also show how to integrate lar programming models. Each company or even project, is different existing frameworks using Aranea as a common using a different web framework, which requires learning a protocol. In its default configuration Aranea supports both different skill set. As a result, it is hard to find qualified developing sophisticated user interfaces using stateful com- work force for a given web framework. For the same reason ponents and nested processes as well as high-performance it is even harder to reuse previously developed application stateless components. code. We propose to use this model as a platform for frame- Moreover, it is sometimes useful to write different parts work development, integration and research. This would of the same application using different approaches, which allow combining different ideas and avoid reimplementing might prove impossible, as the supporting frameworks are the same features repeatedly. An open source implementa- incompatible. Portal solutions that should facilitate in- tion of Aranea framework together with reusable controls, tegrating disparate applications provide very limited ways such as input forms and data lists, and a rendering engine for components to communicate with each other. Finally, are ready for real-life applications. frameworks are often poorly designed, limiting expressive- ness, productivity and quality. System programmers face additional challenges. Creators 1. INTRODUCTION of reusable components have to target one particular frame- During the last 10 years we have witnessed immense ac- work, consequently their market shrinks. Framework de- tivity in the area of web framework design. Currently, signers implement overlapping features over and over again, there are more than 30 actively developed open source web with each new feature added to each framework separately. frameworks in Java [10], let alone commercial products or Many useful ideas cannot be used together because they other platforms like .NET and numerous dynamic languages. have been implemented in different frameworks. Not to mention in-house corporate frameworks that never We think that web framework market would win a lot if saw public light. Many different and incompatible design there were two or three popular platforms with orthogonal philosophies are used, but even within one approach there philosophies that would consolidate proponents of their ap- are multiple frameworks that have small implementation dif- proach. Application programmers would not have to learn a ferences and are consequently incompatible with each other. new web framework at the beginning of each project. Writ- The advantage of such a situation is that different ap- ing reusable components and application integration would be easier and more rewarding. Framework designers could try out new ideas much easier by writing extensions to the platform and targeting a large potential user-base. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are 1.2 Contributions not made or distributed for profit or commercial advantage and that copies In this paper we will describe a component framework bear this notice and the full citation on the first page. To copy otherwise, to that we named Aranea. Aranea is written in Java and al- republish, to post on servers or to redistribute to lists, requires prior specific lows assembling server-side controller web frameworks out permission and/or a fee. PPPJ 2006, August 30–September 1, 2006, Mannheim, Germany. of reusable components and patterns. Aranea applications Copyright 2006 ACM ...$5.00. are pure Java and can be written without any static con- 1 different implementation and is more general in terms of where sequential programming can be applied. This topic is discussed in Section 7.1 as one of extensions. All web frameworks have to handle such aspects as con- figuration, security, error handling and concurrency. We explain how Aranea handles these issues in Section 5. One of the most important differentiating factors of Aranea, is in our mind its ability to serve as a vehicle for integration of existing frameworks due to its orthogonal de- sign. We discuss this topic in Section 6. Finally, we see Aranea as a research platform. It it very easy to try out a new feature without having to write an entire web framework. A framework is assembled out of independent reusable components, so essentially everything can be reconfigured, extended or replaced. If Aranea be- comes popular, writing a new component for Aranea would also mean a large potential user base. Naturally, there are still numerous framework extensions to be made and further directions to be pursued. These are described in Section 7. Last, but not least, Aranea is based on great ideas originating from prior work of many people. When possible, we reference the original source of idea at the time of introducing it. In Section 8 we compare Aranea with some of the existing frameworks. 2. BACKGROUND Figure 1: A sketch of a rich user interface. As we mentioned in the introduction, our aim is to sup- port most of programming models and patterns available in the existing controller frameworks. We present here, un- figuration files. In Section 2 we describe our approach and avoidably incomplete and subjective, list of profound ideas motivation. We find that one of the strengths of this frame- used in contemporary web controller frameworks. work is its conceptual integrity—it has very few core con- The first important alternative is using stateless or reen- cepts that are applied uniformly throughout the framework. trant components for high performance and low memory The number of core interfaces is small, as is the number of footprint, available in such frameworks as Struts [3] and methods in the interfaces. Components are easy to reuse, ex- WebWork [19]. tend and test, because all external dependencies are injected Another important approach is using hierarchical com- into them. The details of the Aranea core abstractions are position of stateful non-reentrant components with event- explained in Section 3. based programming model, available in such frameworks as In different configurations of Aranea components we can JSF [8], ASP.NET [4], Seaside [21], Wicket [20], Tapestry mimic principles and patterns of most existing server-side [5]. This model is often used for developing rich UI, but web controller frameworks as well as combine them arbitrar- generally poses higher demands on server’s CPU and mem- ily. Possible configurations are described in Section 4. We ory. concentrate on implementation of server-side controllers, but The next abstraction useful especially for developing rich we also intend to support programming model where most UI is nested processes, often referred to as modal processes, of UI is implemented on the client-side and server-side con- present for instance in such web frameworks as WASH tains only coarse-grained stateful components corresponding [26], Cocoon [2], Spring Web Flow [18] and RIFE [14]. roughly to active use-cases. They are often referred to by the name of implementation Of particular interest is the configuration supporting pro- mechanism—continuations. The original idea comes from gramming model that allows expressing a rich user interface Scheme [25], [22]. as a dynamic hierarchical composition of components that All of these continuation frameworks provide one top-level maintain call stacks of nested processes (we refer to such call-stack—essentially flows are like function calls spanning processes as flows further on). As an example of rich user multiple web requests. A significant innovation can be found interface at extreme, consider Figure 1: multiple interact- in framework Seaside [21], where continuations are combined ing windows per user session, each window contains a stack with component model and call stack can be present at any of flows, flows can call nested flows that after completing level of component hierarchy. return values, flows can display additional UI (side-menu, Yet another important model is using asynchronous re- context information) even when a nested flow is executing, quests and partial page updates, coined Ajax [1]. This allows flows can contain tabbed areas, wizards, input forms, lists, decreasing server-side state representation demands and in- other controls and even other flows. creases responsiveness of UI. At the extreme, this allows cre- Further, the framework facilitates both event-based and ating essentially fat client applications with a sophisticated sequential programming (using continuations).