Montiweb - Modular Development of Web Information Systems
Total Page:16
File Type:pdf, Size:1020Kb
MontiWeb - Modular Development of Web Information Systems Michael Dukaczewski Dirk Reiss Bernhard Rumpe Mark Stein Software Engineering Institut f. Wirtschaftsinformatik RWTH Aachen Abt. Informationsmanagement http://www.se-rwth.de Technische Universität Braunschweig http://www.tu-braunschweig.de/wi2 ABSTRACT approach [21, 15, 14] is usually a good choice. Abstract- The development process of web information systems is of- ing from implementation details, the developer can focus on ten tedious, error prone and usually involves redundant steps specifying the essentials of the system. These are in partic- of work. Therefore, it is rather efficient to employ a model- ular (1) means to define the data structure of the applica- driven approach for the systematic aspects that comprise tion, (2) ways that enable the developer to define views on such a system. This involves models for the data structure the data structure and (3) the possibility to connect these that shall be handled by the system (here: class diagrams), views and specify the relevant parts of a complete web ap- various editable and read-only presentations (views) on com- plication. From the models describing these aspects, one binations and extractions of the underlying data (here: a or more code generators can create many necessary parts special view language) and ways to connect these views and of a web-based system. Of course the discussed languages define data flow between them (here: activity diagrams). do not cover every aspect (e.g. complicated authentication or application specific functionality is not covered), but the In this paper, we present the MontiWeb approach to model generators and their frameworks used provide a large part and generate these aspects in a modular manner by incor- of the basic functionality. perating the MontiCore framework. Therefor we shortly in- troduce the infrastructure that helps to develop modular In this paper, we present the web application modeling frame- systems. This involves the whole development process from work MontiWeb. One of the main targets of this approach defining the modeling languages to final code generation as is to come up with running prototypes early and refine those well as all steps in between. We present the text-based class in an agile way until the final system is developed. There- and activity diagram languages as well as a view language fore, the MontiWeb approach does provide defaults. The that are used to model our system. discussed generators are in particular connected to target frameworks and components, that e.g. do provide persis- tence and a standard authentication mechanism that how- 1. INTRODUCTION ever can be replaced and adapted to specific needs. The development of web information systems is a domain that is rather well understood. Quite a number of web Generally DSLs can be designed as graphical or text-based application frameworks offer means to implement such sys- modeling languages. Both have its advantages and disad- tems using a wide range of approaches in almost every mod- vantages. As we do not focus on graphical frontends, but ern programming language (for an overview, we refer to on agile usability, we use a textual notation due to the ad- [30]). However, most of these frameworks still demand a vantages presented in [11] and the fact that both can be vast amount of repetitive and tedious work to implement transformed into eachother. similar parts of a web application: usually a datastructure needs to be implemented following a well-defined and under- The rest of the paper is organized as follows: Section 2 intro- stood scheme, same applies to the persistence mechanisms duces the framework we use to implement the web applica- - either manually written or by using a framework such as tion modeling languages, Section 3 describes the languages JPA [13]. In web systems most of the datastructure need in detail, Section 4 presents related work regarding the mod- appropriate presentations to provide CRUD (create, read, eling of web information systems and Section 5 concludes update and delete) functionality and page flow needs to be this paper and gives an outlook of future extensions. defined for each web application. Depending on the tech- nology employed, the effort needed to implement this varies a lot: frameworks like Apache Struts [2] require the main- 2. DEVELOPING DSLS USING THE MON- tenance of lengthy and unreadable XML files to specify the TICORE FRAMEWORK flow between different pages. As already mentioned in Section 1, we use the modeling framework MontiCore [18, 17, 19] as technological basis for In order to develop such a system as efficient as possible MontiWeb. MontiCore is being developed at RWTH Aachen and thus to reduce laborious and error prone work of man- and TU Braunschweig. It allows the convenient specification ually writing the verbose code and configuration files of a of textual modeling languages and provides an extensive in- web application framework, the adoption of a model driven frastructure to process these. It is designed for the rapid [DRRS09] M. Dukaczewski, D. Reiss, B. Rumpe and M. Stein MontiWeb - Modular Development of Web Information Systems In: Proceedings of the 9th OOPSLA Workshop on Domain-Specific Modeling (DSM‘ 09). Helsinki School of Economics. TR no B-108. Orlando, Florida, USA, October 2009 www.se-rwth.de/publications development of domain specific languages. A modeling lan- is the common case. Modern frameworks like Struts [2] or guage can be defined in an integrated format that combines Tapestry [3] use template engines like Velocity [28], Free- both abstract and concrete syntax in one specification. marker [9] or XML for generating the presentation. The MontiCore-Grammar controller is commonly written in a modern GPL like Java. Since all these technologies are developed independently but 1 grammar Classviews { still describe the same elements on different levels, changes 2 often need to be made in all of them. For example, if a new 3 external Annotation; attribute shall be added to the data structure, all three lay- 4 interface ViewElement; 5 ers are affected and need to be modified. Furthermore, often 6 Classviews = Annotation* name:IDENT glue code in formats such as XML configuration files need 7 "{" Attributes? Views* "}"; to be touched as well. Thus, a model driven development 8 approach can help a lot in these cases: convenient infrastruc- 9 Modifier = (Editor:["editor"] | ture provided, each of these layers can be defined in its own 10 Display:["display"] | Field:["field"]); modeling language and describe the appropriate matter con- 11 cisely. Therefore, adding one field would mainly concern one 12 View = Annotation* Modifier name:IDENT? 13 "{" ViewElement+ "}"; model element and reflect into all other layers automatically. 14 Here the order in which the models are specified is not im- 15 ViewParameter implements ViewElement = portant. Modeling can be an incremental process where the 16 Annotation* Modifier? name:IDENT ";"; different models are written in parallel and independently 17 // ... of eachother and then the consistency between them can be 18 } checked on the model level and be ensured through tested code generation. The three modelling languages with syntax and function in the websystem and interaction are described in the following. Figure 1: Definition of AST (Metamodel) and con- crete textual syntax for Classviews 3.1 Data Structure As shown in Figure 1, a grammar in MontiCore starts with The central aspect of a web information system is the under- the keyword grammar and is identified by a name (here: lying data structure. The language describing it should be Classviews). Non-terminals are notated on the left hand flexible enough to express all necessary aspects and yet easy side of a production (here: Classviews (6), Modifier (9), and domain specific enough to raise the level of abstraction View (12) and ViewParameter (15)) and used on the right above manual implementation. hand side. Keywords are enclosed in double-quotes whereas named elements have a name in front of a colon, followed Three requirements for the data structure description are by the type of element afterwards (e.g., name as the name set: (1) A type system (2) composability and (3) relationship and IDENT as the type of the predefined terminal (6, 12)). between model elements. By a domain specific data type Rules can have a cardinality (e.g. * (6, 7) for 0 to unlim- system special characteristics are assigned to the data. Thus ited occurence, + (13) for 1 to unlimited and ? (7, 12, 16) validation of data, transformation rules, storage mechanisms for optional occurrence) and alternative rules (e.g. (9, 10), and other data-specific functions are easily possible. seperated by the pipe character (|)) are supported. The keyword external marks certain non-terminals as defined Composability of complex data means that one data struc- outside of the actual grammar (3) and needs to be linked to ture can be made up from elementary data types as well as another non-terminal from a different grammar. The key- complex ones defined elsewhere in the model. The relation- word interface (4) implies that the following element is a ships between the data define mapping properties. Since placeholder for arbitrary elements that implement this inter- class diagrams offer enough expressiveness for data model- face. Here, the non-terminal ViewElement can be replaced ing and are generally well-known, MontiWeb uses a textual by the non-terminal ViewParameter or further here ommit- representation of a subset of UML/P [25, 24] class diagrams ted non-terminals (indicated by the three dots (17)). to describe the data structure. In the following we explain how the chosen modeling language met the three require- Besides these constructs, MontiCore supports extension mech- ments for the description of the data structure. An exam- anisms such as grammar inheritance (see [19] for a more ple of such notation is shown in Figure 2.