• Nie Znaleziono Wyników

WebDSL: A Domain-Specific Language for Dynamic Web Applications

N/A
N/A
Protected

Academic year: 2021

Share "WebDSL: A Domain-Specific Language for Dynamic Web Applications"

Copied!
6
0
0

Pełen tekst

(1)

Delft University of Technology

Software Engineering Research Group

Technical Report Series

WebDSL

A Domain-Specific Language for

Dynamic Web Applications

D.M. Groenewegen, Z. Hemel, L.C.L. Kats, E. Visser

Report TUD-SERG-2008-040

(2)

TUD-SERG-2008-040

Published, produced and distributed by: Software Engineering Research Group Department of Software Technology

Faculty of Electrical Engineering, Mathematics and Computer Science Delft University of Technology

Mekelweg 4 2628 CD Delft The Netherlands ISSN 1872-5392

Software Engineering Research Group Technical Reports: http://www.se.ewi.tudelft.nl/techreports/

For more information about the Software Engineering Research Group: http://www.se.ewi.tudelft.nl/

This paper is a pre-print of:

D.M. Groenewegen, Z. Hemel, L.C.L. Kats, and E. Visser. WebDSL: A Domain-Specific Language for Dynamic Web Applications. In G. Kiczales (editor) Companion to the 23rd ACM SIGPLAN Conference on Object-Oriented Programing, Systems, Languages, and Applications (OOPSLA 2008)

@InProceedings{GHKV08,

author = {Danny M. Groenewegen and Zef Hemel and Lennart C.L. Kats and Eelco Visser},

title = {WebDSL: A Domain-Specific Language for Dynamic Web Applications}, booktitle = {Companion to the 23rd ACM SIGPLAN Conference on

Object-Oriented Programing, Systems, Languages, and Applications (OOPSLA 2008)},

year = {2008},

editor = {G. Kiczales},

address = {Nashville, Tenessee, USA}, month = {October},

publisher = {ACM Press}, }

c

copyright 2008, Software Engineering Research Group, Department of Software Technology, Faculty of Electrical Engineering, Mathematics and Computer Science, Delft University of Technology. All rights reserved. No part of this series may be reproduced in any form or by any means without prior written permission of the publisher.

(3)

WebDSL

A Domain-Specific Language for Dynamic Web Applications

Danny M. Groenewegen

Zef Hemel

Lennart C. L. Kats

Eelco Visser

Delft University of Technology, The Netherlands {d.m.groenewegen,z.hemel,l.c.l.kats,e.visser}@tudelft.nl

Abstract

WebDSL is a domain-specific language for the implementa-tion of dynamic web applicaimplementa-tions with a rich data model. It consists of a core language with constructs to define entities, pages and business logic. Higher-level abstractions, model-ing access control and workflow, are defined in a modular fashion as extensions of the core language.

Categories and Subject Descriptors D.1.2 [Programming Techniques]: Automatic Programming; D.2.3 [Software Engineering]: Coding Tools and Techniques

General Terms Languages, Design

1. Introduction

Developing web applications comprises many technical con-cerns, such as data representation, querying, and modifica-tion, input handling, user interface design, and navigation. Often separate languages are used to address these various concerns. For example, a typical web application may use the Java general-purpose programming language, the SQL query language, the JavaServer Faces (JSF) presentation lan-guage with the EL expression lanlan-guage for accessing data and XML for configuration of frameworks.

Having separate languages for different technical do-mains is conceptually appealing, but the way these lan-guages evolved introduced a number of issues for web ap-plication programmers. One issue is the presence of redun-dancy and inconsistency among the languages, as shown by the EL expression language, which is essentially a non-strict subset of Java expressions. Another issue is in the lack of awareness of other languages in different tools that sup-port them. For instance, the Java compiler performs static analysis, but is oblivious of other languages involved, such as SQL queries embedded in Java strings. Lack of static

Copyright is held by the author/owner(s).

OOPSLA’08, October 19–23, 2008, Nashville, Tennessee, USA. ACM 978-1-60558-220-7/08/10.

checking of such expressions increases the chance of in-jection attacks. Integrating aspects defined in different lan-guages often also requires additional boilerplate code, which is repetitive and error-prone to implement.

The WebDSL project aims at providing an integrated web development platform, alleviating the issues associated with a heterogeneous environment. To deal with its inevitably in-creasing complexity that occurs as the project evolves, we formulated the approach of code generation by model trans-formation [2] to ensure a modular and extensible architec-ture, ensuring maintainability of its implementation.

2. WebDSL

WebDSL is a Domain-Specific Language (DSL) for the im-plementation of dynamic web applications with a rich data model [6, 5]. WebDSL consists of smaller sub-languages addressing different technical domains which are statically checked and transformed into one coherent web application. WebDSL provides sub-languages for the specification of data models and for the definition of pages for view-ing and editview-ing objects in the data model. Consider Fig-ure 1, which illustrates a simple web application. Its data model is described using entity definitions (e.g., User1and

ProgressMeeting2), containing properties with a name

and a type. Page definitions3can be parameterized with and

instantiated for specific entities4. They specify a

presenta-tion5 of a web page and its associated entities. Navigation

between pages is expressed in the form of navigate ele-ments that specify linked pages10.

To provide the user with the ability to manipulate enti-ties, the example page specifies input6elements that allow

a user to input different properties of an entity. The modifi-cation of elements is finalized by means of an action7, which

specifies the operation to undertake when the page is to be saved. In the definition of an action definition8 objects can

be further modified and persisted to the database. Actions may affect navigation by specifying return9 with a page

reference.

Building upon the WebDSL core language elements, higher abstractions have been created in WebDSL for ac-cess control and workflow. The acac-cess control abstraction of

SERG WebDSL

(4)

entity User {1

username :: String (id) password :: Secret name :: String manager -> User employees -> Set<User> isAdmin :: Bool } entity ProgressMeeting {2 employee -> User employeeView :: Text managerView :: Text report :: Text approved :: Bool comment :: Text }

define page editUser3 (u : User4) {

title { "Edit User: " output(u.name) }5

section {

header { "Edit User: " output(u.name) } form {

par { "Name: " input(u.name)6 }

par { "Password: " input(u.password) } par { action("Save Changes", saveUser())7 }

}

action saveUser() {8

u.persist(); return viewUser(u);9

}

navigate(home()) { "return to home page" }10

} }

rule page editUser(u : User) { principal = u }11

principal is User with credentials username, password12

procedure meeting(p : ProgressMeeting) {13

process {

(writeEmployeeView(p) |AND| writeManagerView(p)); repeat {

writeReport(p);

(approveReport(p) |XOR| commentReport(p)) } until finalizeReport(p)

} }

Figure 1. WebDSL example

WebDSL [1] offers an integrated and concise way of speci-fying access to the application components. Access is gov-erned by rules that determine access to matching elements11.

The application data can be accessed with the same expres-sions used in the action language, offering a linguistically in-tegrated way to specify access checks. The resulting checks are statically verified and woven into the application. A user representation can be declared using the principal12

defini-tion, which offers a default login facility but is flexible to accomodate other types of authentication as well.

The workflow abstraction, WebWorkFlow [3], is an object-oriented workflow modeling language for high-level scriptions of workflows in web applications. Workflow de-scriptions define procedures13operating on domain objects,

representing coordinated activities between different actors. Procedures, the basic elements of these activities, are com-posed using sequential and concurrent process combinators. These workflow definitions result in task pages, task lists, status pages and navigation between them.

3. Code generation by model transformation

The architecture of WebDSL follows the approach of code generation by model transformation [2]. It has been devel-oped using Stratego/XT, a high-level term rewriting system that integrates model-to-model, model-to-code, and code-to-code transformations. The language provides rewrite

rules for the definition of basic transformations, and pro-grammable strategies for building complex transformations that control the application of rules. Using strategies, the WebDSL generator is divided into different transformation stages. Each consists of a set of rewrite rules that rewrite extensions of the WebDSL core language to more primitive language constructs. Using this technique of compilation by normalization [4], we gradually reduce the semantic gap be-tween input and output model, thus avoiding the complexity associated by directly generating code from the input mode. Extensions of the WebDSL language, such as the access control and workflow abstractions are realized as plug-ins to the base language, extending the generator with new nor-malization rules.

4. Conclusion

WebDSL is a DSL that enables development of web appli-cations at a high level abstraction with less boilerplate code. The approach of code generation by model transformation enables the generator to be easily extended with new, higher-level abstractions as illustrated by the access control and workflow extensions.

Acknowledgements This research was supported by NWO/JACQUARD projects 638.001.610, MoDSE: Model-Driven Software Evolution, and 612.063.512, TFA: Trans-formations for Abstractions.

References

[1] D. Groenewegen and E. Visser. Declarative access control for WebDSL: Combining language integration and separation of concerns. In International Conference on Web Engineering (ICWE 2008). IEEE CS Press, July 2008.

[2] Z. Hemel, L. C. L. Kats, and E. Visser. Code generation by model transformation. A case study in transformation modularity. In J. Gray, A. Pierantonio, and A. Vallecillo, editors, International Conference on Model Transformation (ICMT 2008), volume 5063 of LNCS. Springer, June 2008. [3] Z. Hemel, R. Verhaaf, and E. Visser. Webworkflow: An

object-oriented workflow modeling language for web applications. In K. Czarnecki, editor, International Conference on Model Driven Engineering Languages and Systems (MODELS08), Lecture Notes in Computer Science. Springer, October 2008. [4] L. C. L. Kats, M. Bravenboer, and E. Visser. Mixing source and bytecode. A case for compilation by normalization. In Proceedings of the 23rd ACM SIGPLAN Conference on Object-Oriented Programing, Systems, Languages, and Applications (OOPSLA 2008), LNCS. ACM Press, October 2008. [5] E. Visser. DSLs for the web (talk). In Conference on

Object-Oriented Programing, Systems, Languages, and Applications (OOPSLA 2008), Nashville, Tenessee, USA, October 2008. [6] E. Visser. WebDSL: A case study in domain-specific language

engineering. In Generative and Transformational Techniques in Software Engineering (GTTSE 2007), volume 5235 of LNCS. Springer, 2008.

WebDSL SERG

(5)
(6)

TUD-SERG-2008-040

Cytaty

Powiązane dokumenty

finansowego, „Finanse&#34; 1957, nr 1, s. Timm, Steuern im Sozialismus. Beiträge zur Finanzwissenschaft und zur Geldtheorie. Weralski, Kierunki reformy polskiego systemu

Rozprawy doktorskie na Wydziale Prawa i na Wydziale Filozoficzno-Hi- storycznym UAM oraz na Wydziale Ogólno-Ekonomicznym WSE w Po­

Jakie prawo należy jednak stosować do umów o przewóz lotniczy wykonywanych przez przewoźników sukcesywnych na podstawie jed­ nego listu przewozowego (przewóz bezpośredni) 9

neza „Snu w Dreźnie&#34;. &#34; utwór Mickiewicza został opa- trzony w cenny przypisek: „Miałem sen w Dreźnie 1832 roku marca 23, który ciemny i dla mnie niezrozumiany.

Znaki ciała, wyrażające oddanie czci i poddaństwo, mają tutaj o wiele mocniejszą wymowę niż poprzednie klękanie przed Wahazarem (ko- biety właśnie na kolanach kilka

Tak więc dowiedziałam się, że w domu śpiewają Mickiewicza, mówią Mickiewiczem, że, Boże, ile ja od nich, przez nich mam tego w głowie, w uszach.. Nie wiem, czy matka i

Równoczesne wykonywanie aktywności zawodowych, które mają zróżnicowane źródła zobowiązań, nie stanowi na współczesnym rynku pra- cy praktyk incydentalnych. Na

Deklaracja Komisji Episkopatów Wspólnoty Europejskiej w sprawie przystąpienia nowych państw członkowskich do Unii Europejskiej, ogłoszona w związku z posiedzeniem