Lecture Notes in Computer Science Commenced Publication in 1973 Founding and Former Series Editors: Gerhard Goos, Juris Hartmanis, and Jan van Leeuwen
Editorial Board David Hutchison Lancaster University, UK Takeo Kanade Carnegie Mellon University, Pittsburgh, PA, USA Josef Kittler University of Surrey, Guildford, UK Jon M. Kleinberg Cornell University, Ithaca, NY, USA Friedemann Mattern ETH Zurich, Switzerland John C. Mitchell Stanford University, CA, USA Moni Naor Weizmann Institute of Science, Rehovot, Israel Oscar Nierstrasz University of Bern, Switzerland C. Pandu Rangan Indian Institute of Technology, Madras, India Bernhard Steffen TU Dortmund University, Germany Madhu Sudan Microsoft Research, Cambridge, MA, USA Demetri Terzopoulos University of California, Los Angeles, CA, USA Doug Tygar University of California, Berkeley, CA, USA Moshe Y. Vardi Rice University, Houston, TX, USA Gerhard Weikum Max Planck Institute for Informatics, Saarbruecken, Germany
6210
Shmuel Katz Mira Mezini Jörg Kienzle (Eds.)
Transactions on Aspect-Oriented Software DevelopmentVII A Common Case Study for Aspect-Oriented Modeling
13
Editors-in-Chief Shmuel Katz The Technion Department of Computer Science Haifa 32000, Israel E-mail:
[email protected] Mira Mezini Darmstadt University of Technology Department of Computer Science 64289 Darmstadt, Germany E-mail:
[email protected]
Guest Editor Jörg Kienzle McGill University School of Computer Science H3A 2A7 Montreal, QC, Canada E-mail:
[email protected]
Library of Congress Control Number: 2010934940 CR Subject Classification (1998): D.2, F.3, D.3, C.2, K.6, D.1
ISSN ISSN ISBN-10 ISBN-13
0302-9743 (Lecture Notes in Computer Science) 1864-3027 (Transactions on Aspect-Oriented Software Development) 3-642-16085-9 Springer Berlin Heidelberg New York 978-3-642-16085-1 Springer Berlin Heidelberg New York
This work is subject to copyright. All rights are reserved, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, re-use of illustrations, recitation, broadcasting, reproduction on microfilms or in any other way, and storage in data banks. Duplication of this publication or parts thereof is permitted only under the provisions of the German Copyright Law of September 9, 1965, in its current version, and permission for use must always be obtained from Springer. Violations are liable to prosecution under the German Copyright Law. springer.com © Springer-Verlag Berlin Heidelberg 2010 Printed in Germany Typesetting: Camera-ready by author, data conversion by Scientific Publishing Services, Chennai, India Printed on acid-free paper 06/3180
Editorial
Welcome to Volume VII of the Transactions on Aspect-Oriented Software Development. This volume is a special issue on A Common Case Study for Aspect-Oriented Modeling with guest editor Jörg Kienzle, under the management of one of the coeditors-in-chief, Shmuel Katz. This issue has an unusual format. The first paper presents the case study, a relatively complex crisis management system, and the subsequent ones each apply different modeling techniques to it. In this way, a wide variety of notations and abstraction techniques for modeling aspect systems are demonstrated and evaluated for the same case study. This should allow readers to understand the relative strengths of each approach, and encourage cross-fertilization among the techniques. The background and the approaches in the special issue are described in the guest editor’s foreword. We thank him for his effort and commitment in producing such a high-quality special issue. The next issue of TAOSD will also focus on a special topic: industrial applications of aspect technology, with guest editors Wouter Joosen and Christa Schwanninger. One of the major impediments to broader industrial adoption of AOSD is the lack of accessible experience reports on the application of AOSD in commercial software projects. This special issue will offer a collection of such examples, experience reports, and success stories, and will present insights gained that should be of value to potential and existing industrial users, as well as of interest to researchers concerned with overcoming the practical obstacles to using aspects. A new special issue on Modularity Concepts in Programming Languages is also scheduled for 2011, and will be edited by Gary Leavens and Klaus Ostermann. This issue will highlight original and innovative modularity concepts. Of course, we continue to encourage regular submissions on all topics connected to modularity and the development of aspect-oriented software, especially when a single system decomposition does not adequately address all concerns. We are happy to welcome five new editorial board members: Wouter Joosen, Gary Leavens, Klaus Ostermann, Mario Südholt, and Eric Tanter. They all are outstanding researchers in software engineering and AOSD, and we look forward to benefiting from their insights and experience. We thank the editorial board for their continued guidance and input on the policies of the journal, the choice of special issues, and associate-editorship of regular submissions. Thanks are also due to the reviewers, who volunteered significant time, despite their busy schedules, to ensure the quality of articles published in the journal. Most importantly, we wish to thank the authors who have submitted papers to the journal so far. This issue also marks a change in the editors-in-chief of the journal. In accordance with journal policy, Harold Ossher has finished his term, and will continue as a regular associate editor. We would like to thank him personally for his advice, and especially for providing an outstanding example of how to edit a journal. We close with two short messages:
VI
Editorial
Note from Harold Ossher, the outgoing editor-in-chief: I would like to thank the authors, reviewers, editorial board members and co-editor-in-chief, all of whom contributed so much to the journal during my term, and who were always a pleasure to work with. I am excited by this special issue and those currently in the works, and am confident that, under the leadership of world-renowned experts Shmuel Katz and Mira Mezini, the journal will grow and flourish. Note from the editorial board: The entire editorial board thanks Harold for his exceptional leadership and service as editor-in-chief. His guidance has been invaluable over the last years. We also welcome Mira Mezini as the new co-editor-in-chief, along with Shmuel Katz. Mira, Professor of Computer Science at the Darmstadt University of Technology, is well known to the research community, and has made numerous fundamental contributions to AOSD, including the CeasarJ language, innovative implementation techniques for aspect languages, and new language constructs to improve modularity and separation of concerns. We look forward to future development of the journal under her leadership.
June 2010
Shmuel Katz Mira Mezini Co-Editors-in-Chief
A Common Case Study for Aspect-Oriented Modeling Guest Editor’s Foreword
Aspect-oriented modeling (AOM) focuses on modularizing and composing crosscutting concerns within software models — models that can be used to describe or analyze properties of a system under development.This can be done within different modeling notations, at different levels of abstraction, and at different moments during the software development process. To date, there exist many AOM techniques for different modeling notations (e.g., for class diagrams, sequence diagrams, state diagrams, protocol machines, component diagrams, live sequence charts, SDL, use cases, etc..) and many AOM approaches that can be applied at different phases of software development (requirements, analysis, architecture, design, implementation) or to different domains (e.g., to software product lines, modeling security, modeling fault tolerance, etc...). A considerable number of papers in journals and high-quality conference proceedings have been published on AOM. Fourteen successful workshops on AOM have been organized at the AOSD conference and the MoDELS conference in the last 8 years [1]. There is also the series of workshops entitled Early Aspects that falls within the context of AOM [2]. Finally, two special issues of the journal Transactions on Aspect-Oriented Software Development have already been published in related areas: Vol. III on “early aspects — analysis, visualization, conflicts and composition", in 2007 [3] and Vol. VI on “aspects and model-driven engineering", in 2009 [4]. Despite the many sources of information on AOM, it is not easy for people who want to use AOM to choose an appropriate technique. Comparing different AOM approaches with each other to highlight the advantages and disadvantages of each one is not trivial, because each research team applies their AOM approach within a different context. Finally, it is not clear nowadays how several AOM approaches that apply to different phases of software development could be combined to produce a coherent aspect-oriented software development process. To remedy this situation, this special issue assembles 9 papers that apply AOM techniques and approaches to the same case study. Due to the specific nature of the special issue, the selection criteria for the papers was not, as it is in general the case for journal papers, novelty. Rather, the papers gathered here were chosen based on how well they describe how a particular, mature AOM approach is applied to the case study. As a result, all papers cover a significant part of the case study, presenting in-depth models that modularize functional as well as non-functional concerns, followed by an analysis of the strengths and weaknesses of the presented approach. Thanks to the effort of the reviewers, the resulting collection of papers provides a valuable resource for many researchers and practitioners:
VIII
Guest Editor’s Foreword
– Those who want to learn about AOM find in this special issue a concise collection of descriptions of solid and mature AOM approaches. They only have to take the time to understand one case study in order to appreciate the sample models shown in all papers. – Those who want to apply AOM for a particular purpose and are looking for the most appropriate AOM technique can use the papers presented in this special issue to identify the most promising approach(es). By identifying similarities between their problem and the case study they should be able to determine candidate AOM approaches easily. – Those working on their own AOM approach can readily identify approaches that were able to handle concerns that their own approach is not able to handle elegantly. This stimulates cross-fertilization between approaches and collaborative research. – Those engineering researchers that are working on enhancing software development processes can use the example models presented in this special issue to understand the potential benefits of using AOM techniques at different phases of the software development life-cycle. Case Study The broad domain of the case study is crisis management systems (CMS), i.e., software that facilitates coordination of activities and information flow between all stakeholders and parties that need to work together to handle a crisis. CMSs can be used to handle many types of crises (e.g., natural disasters, epidemics, accidents, attacks, etc...) and may have to interface and interoperate with different types of external services (e.g., military systems, police systems, government, medical services, etc...). CMSs also exhibit many non-functional properties, e.g., they must be highly available, dependable and secure. A detailed, non-aspectoriented description of the case study is presented in the first paper of this special issue. The research papers that follow are therefore not self-contained, i.e., they do not describe the case study again, but simply refer the reader to the case study document for details if needed. Overview of Papers The order in which the papers in this special issue are presented roughly corresponds to the software development phases in which the AOM approaches are applied. Requirements Modeling with the Aspect-Oriented User Requirements Notation (AoURN): A Case Study The approach presented in this paper focuses on the requirements elicitation and engineering phase. The authors, Gunter Mussbacher, Daniel Amyot, João Araújo, and Ana Moreira, show how they applied the Aspect-Oriented User Requirements Notation (AoURN) to model all use cases, non-functional requirements and stakeholders of the crisis management system as individual concerns. The models presented are very abstract, in the sense that they do not model
Guest Editor’s Foreword
IX
detailed data nor message exchanges. However, AoURN scenario definitions can be analyzed, enabling regression-testing of the scenario model. The paper demonstrates how concern dependencies and conflicts among concerns can be captured, as well as how conflict resolutions and trade-offs are documented. In addition, the paper presents a qualitative comparison of aspect-oriented techniques for scenario-based and goal-oriented requirements engineering. Relating Feature Models to Other Models of a Software Product Line: A Comparative Study of FeatureMapper and VML* This paper concentrates on aspect-oriented modeling in the context of software product line development. The authors, Florian Heidenreich, Pablo Sánchez, João Santos, Steffen Zschaler, Mauricio Alférez, João Araújo, Lidia Fuentes, Uirá Kulesza, Ana Moreira, and Awais Rashid, investigate the problem of establishing a relationship between concerns expressed at a high level of abstraction in a feature model to other models that describe the details of a product line. To better understand the different approaches that can be used to accomplish this task, the paper applies two different approaches to the crisis management system case study: FeatureMapper as a representative of declarative approaches and VML* as a representative of operational approaches. The paper illustrates how to express product derivation and mapping of features to models using both approaches in the context of a car crash crisis management system and a flood crisis management system. Aspect-Oriented Development Using Protocol Modeling In this paper, the authors, Ashley McNeile and Ella Roubtsova, describe how they use the Protocol Modeling approach to perform formal specification of the event-based interaction between the crisis management system and the environment. The interactions specified in the requirements of the crisis management system are decomposed into multiple protocol machines that specify the behavior of different concerns. The global system model is obtained by composing the protocol machines using CSP parallel composition. The paper illustrates how the system model can be simulated, and finally validated against the use cases defined in the requirements document. Using VCL as an Aspect-Oriented Approach to Requirements Modeling As the title suggests, this paper, authored by Nuno Amálio, Pierre Kelsen, Qin Ma, and Christian Glodt, presents the Visual Contract Language (VCL), an approach that uses aspect-oriented techniques to produce a modular, concise requirements specification. VCL’s primary goal is to enable abstract visual modeling of software systems, where resulting models have an underlying formal semantics rooted in the Z specification language. VCL’s models are based on data with an object-oriented structure; behavior is described by explaning how data is transformed using operation specifications comprised of pre- and post-conditions. VCL is well-suited for building abstract models of systems that can describe detailed requirements models or high-level designs. The approach is illustrated on a considerable part of the crisis management system’s functional
X
Guest Editor’s Foreword
requirements, as well as on non-functional concerns such as authentication, access control, and session management. Workflow Design Using Fragment Composition: Crisis Management System Design through ADORE Adore, presented in the paper authored by Sébastien Mosser, Mireille BlayFornarino, and Robert France, is an AOM approach that aims at facilitating business process design. Adore allows Service-Oriented Architecture (SOA) developers to model complex orchestrations of services by composing models of smaller orchestrations called orchestration fragments. Adore can also be used to weave fragments that address new concerns into existing application models. Finally, consistency checks can be used to identify problematic interactions between fragments and base models. The approach is illustrated on the crisis management system by modeling several of the car crash crisis management system use cases, including the effects of non-functional requirements such as persistence, security, and statistical logging. Modeling the Car Crash Crisis Management System Using HiLA In this paper, the authors Matthias Hölzl, Alexander Knapp, and Gefei Zhang, present the HiLA approach, whose primary goal is to improve the modularity of UML state machines by extending the notation with aspect-oriented features. Especially when modeling history-dependent and synchronization concerns, HiLA helps reduce the model complexity by being highly declarative. Since the weaving result is also a state machine, it can be validated by formal methods, such as model checking and theorem proving. HiLA can be used for requirements analysis as well as for design. In the paper, the usefulness of HiLA is illustrated by applying it to methodologically turn use case descriptions of the crisis management system into state machines: for each main success scenario a base state machine is developed; all extensions to this main success scenario are covered by aspects. Aspect-Oriented Design with Reusable Aspect Models The Reusable Aspect Models (RAM) approach, presented in this paper by Jörg Kienzle, Wisam Al Abed, Franck Fleurey, Jean-Marc Jézéquel, and Jacques Klein, allows a modeler to express the structure and behavior of the design of a system under development using class, state, and sequence diagrams encapsulated in several aspect models. RAM supports aspect hierarchies, where aspects at a high level of abstraction reuse structure and behavior defined by lower-level aspects. Design decisions, such as deciding on interaction patterns, concrete data structures and algorithms, guide the decomposition of high-level aspects into lower-level ones. The lowest level aspects model the system in such detail that mapping the model to source code is straightforward. The usefulness of RAM is illustrated by presenting 23 high-level and detailed design aspect models of the “create mission” functionality of the server backend of the car crash crisis management system.
Guest Editor’s Foreword
XI
A Graph-Based Aspect Interference Detection Approach for UMLBased Aspect-Oriented Models This paper, authored by Selim Ciraci, Wilke Havinga, Mehmet Aksit, Christoph Bockisch, and Pim van den Broek, describes a technique and tool called GrACE that can be used for automatic detection of conflicts between aspect models. Execution constraints of aspect models, expressed in Computation Tree Logic (CTL), can be verified using model checking on the composed model. As GrACE accepts UML 2.2 sequence diagrams as input, it is usable by approaches at different levels of abstraction employing these diagrams. However, GrACE’s execution semantics makes the approach most suitable for analyzing detailed OO design models. The approach is presented by modeling several of the mission scenarios defined for the car crash crisis management system, as well as a monitoring non-functional requirement. Discovery of Stable Abstractions for Aspect-Oriented Composition in the Car Crash Management Domain This paper is slightly different from the others, since it covers several phases of software development. The authors, Dimitri Van Landuyt, Eddy Truyen, and Wouter Joosen, describe an approach that aids developers in discovering stable domain abstractions when developing a system. Based on use case engineering and domain modeling techniques, their method provides a systematic approach for discovering domain abstractions that are suitable for aspectual composition in requirements, software architecture, detailed design models, and finally in the implementation. Furthermore, the approach described provides architectural guidelines on how to design pointcut interfaces that are based on these stable domain abstractions. The approach is illustrated on the car crash crisis management system, starting with the use cases, presenting an architecture model, and then showing the design and implementation details of employee assignment and strategy selection. May 2010
Jörg Kienzle
References 1. Aspect-Oriented Modeling Workshop Series. http://www.aspect-modeling.org/ 2. Early Aspects Workshop Series. http://www.early-aspects.net/ 3. Rashid, A., Aksit, M. (eds.) Transactions on Aspect-Oriented Software Development III - Special Issue on Early Aspects, LNCS, vol. 4620. Springer, Heidelberg (2007) 4. Katz, S., Osher, H. (eds.): Transactions on Aspect-Oriented Software Development VI - Special Issue on Aspects and Model-Driven Engineering, LNCS, vol. 5560. Springer, Heidelberg (2009)
Editorial Board
Mehmet Akúit Shigeru Chiba Siobhán Clarke Theo D‘Hondt Robert Filman Bill Harrison Wouter Joosen Shmuel Katz Gregor Kiczales Shriram Krishnamurthi Gary T. Leavens Karl Lieberherr Mira Mezini Oege de Moor Ana Moreira Harold Ossher Klaus Ostermann Awais Rashid Douglas Schmidt Mario Südholt Eric Tanter
University of Twente, The Netherlands Tokyo Institute of Technology, Japan Trinity College Dublin, Ireland Vrije Universiteit Brussel, Belgium Google, USA Trinity College Dublin, Ireland Katholieke Universiteit Leuven, Belgium Technion-Israel Institute of Technology, Israel University of British Columbia, Canada Brown University, USA University of Central Florida, USA Northeastern University, USA Darmstadt University of Technology, Germany University of Oxford, UK New University of Lisbon, Portugal IBM Research, USA University of Marburg, Germany Lancaster University, UK Vanderbilt University, USA Ecole des Mines des Nantes, France University of Chile, Chile
List of Reviewers Mehmet Aksit Omar Aldawud João Araújo Olivier Barais Aswin van den Berg Christoph Bockisch Ruzanna Chitchyan Thomas Cottentier Kendra Cooper Krzysztof Czarnecki Johan Fabry Frank Fleurey Robert France Lidia Fuentes Jeff Gray Phil Greenwood Iris Groher Nicolas Guelfi
Stefan Hanenberg Øystein Haugen Wouter Joosen Jacques Klein Gunter Mussbacher Ana Moreira Clémentine Nebut Carlos Parra Hridesh Rajan Ella Roubtsova Americo Sampaio Pablo Sánchez Christa Schwanninger Lionel Seinturier Dominik Stein Bedir Tekinerdogan Hans Vangheluwe Robert Walker
Table of Contents
Crisis Management Systems: A Case Study for Aspect-Oriented Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . J¨ org Kienzle, Nicolas Guelfi, and Sadaf Mustafiz
1
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN): A Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Gunter Mussbacher, Daniel Amyot, Jo˜ ao Ara´ ujo, and Ana Moreira
23
Relating Feature Models to Other Models of a Software Product Line: A Comparative Study of FeatureMapper and VML* . . . . . . . . . . . . . . . . . . Florian Heidenreich, Pablo S´ anchez, Jo˜ ao Santos, Steffen Zschaler, Mauricio Alf´erez, Jo˜ ao Ara´ ujo, Lidia Fuentes, Uir´ a Kulesza, Ana Moreira, and Awais Rashid Aspect-Oriented Development Using Protocol Modeling . . . . . . . . . . . . . . . Ashley McNeile and Ella Roubtsova
69
115
Using VCL as an Aspect-Oriented Approach to Requirements Modelling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Nuno Am´ alio, Pierre Kelsen, Qin Ma, and Christian Glodt
151
Workflow Design Using Fragment Composition: Crisis Management System Design through ADORE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . S´ebastien Mosser, Mireille Blay-Fornarino, and Robert France
200
Modeling the Car Crash Crisis Management System Using HiLA . . . . . . . Matthias H¨ olzl, Alexander Knapp, and Gefei Zhang
234
Aspect-Oriented Design with Reusable Aspect Models . . . . . . . . . . . . . . . . J¨ org Kienzle, Wisam Al Abed, Franck Fleurey, Jean-Marc J´ez´equel, and Jacques Klein
272
A Graph-Based Aspect Interference Detection Approach for UML-Based Aspect-Oriented Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Selim Ciraci, Wilke Havinga, Mehmet Aksit, Christoph Bockisch, and Pim van den Broek
321
Discovery of Stable Abstractions for Aspect-Oriented Composition in the Car Crash Management Domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Dimitri Van Landuyt, Eddy Truyen, and Wouter Joosen
375
Author Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
423
Crisis Management Systems: A Case Study for Aspect-Oriented Modeling J¨org Kienzle1 , Nicolas Guelfi2 , and Sadaf Mustafiz1 1
2
School of Computer Science, McGill University, Montreal, Canada
[email protected],
[email protected] Laboratory of Advanced Software Systems, University of Luxembourg, Luxembourg
[email protected]
Abstract. The intent of this document is to define a common case study for the aspect-oriented modeling research community. The domain of the case study is crisis management systems, i.e., systems that help in identifying, assessing, and handling a crisis situation by orchestrating the communication between all parties involved in handling the crisis, by allocating and managing resources, and by providing access to relevant crisis-related information to authorized users. This document contains informal requirements of crisis management systems (CMSs) in general, a feature model for a CMS product line, use case models for a car crash CMS (CCCMS), a domain model for the CCCMS, an informal physical architecture description of the CCCMS, as well as some design models of a possible object-oriented implementation of parts of the CCCMS backend. AOM researchers who want to demonstrate the power of their AOM approach or technique can hence apply the approach at the most appropriate level of abstraction.
1 Introduction The need for crisis management systems has grown significantly over time. A crisis can range from major to catastrophic affecting many segments of society. Natural disasters (e.g. earthquakes, tsunamis, twisters, fire, floods, etc...), terrorist attacks or sabotage (explosions, kidnapping, etc...), accidents (plant explosion, pollution emergency, a car crash, etc...), and technological disruptions are all examples of emergency situations that are unpredictable and can lead to severe after effects unless handled immediately. Crisis management involves identifying, assessing, and handling the crisis situation. A crisis management system facilitates this process by orchestrating the communication between all parties involved in handling the crisis. The CMS allocates and manages resources, and provides access to relevant crisis-related information to authorized users of the CMS. Different existing AOM approaches and techniques are meant to be used during different phases of software development. As a result, different AOM approaches work with different kinds of models and modeling notations. To make sure that all AOM approaches and techniques are somehow applicable to this case study, we present a collection of models that describe the CMS at different levels of abstraction: 1. Short, informal requirements text describing the domain of crisis management systems in more detail. It also mentions some non-functional requirements of a CMS, S. Katz et al. (Eds.): Transactions on AOSD VII, LNCS 6210, pp. 1–22, 2010. c Springer-Verlag Berlin Heidelberg 2010
2
J. Kienzle, N. Guelfi, and S. Mustafiz
2.
3.
4.
5. 6.
e.g. security and dependability. This text, presented in Section 2 on page 2, probably contains information that is important to everyone who wants to work on this case study. Feature diagrams highlighting the software product line aspect of crisis management systems. Crisis management systems can be used to handle many types of crises (e.g., natural disasters, epidemics, accidents, attacks, etc...) and may have to interface and interoperate with different types of external services (e.g., military systems, police systems, government, medical services, etc...). The feature diagram models are presented in Section 3 on page 6. Use cases describing a particular CMS suitable for dealing with car crash crises. The Car Crash CMS (CCCMS) use case model description can be found in Section 4 on page 8. A domain model of the car crash crisis management system that documents the key concepts, and the domain vocabulary of the CCCMS is presented in Section 5 on page 16. An informal description of a possible physical architecture for the car crash crisis management system is presented in Section 6 on page 18. Some detailed design models for the car crash crisis management system backend are given in Section 7 on page 19.
2 Crisis Management System: Requirements The user requirements outlined in this section are based on a draft of a real requirements document for crisis management systems created by the company Optimal Security [1]. The general objectives of a crisis management system (CMS) include the following: – – – – – –
To help in the coordination and handling of a crisis; to ensure that an abnormal or catastrophic situation does not get out of hand; to minimize the crisis by handling the situation using limited resources; to allocate and manage resources in an effective manner; to identify, create, and execute missions in order to manage the crisis; to archive the crisis information to allow future analysis.
2.1 Crisis Scenario of a Car Crash Crisis Management System A crisis management scenario is usually triggered by a crisis report from a witness at the scene. A coordinator, who is in-charge of organizing all required resources and tasks initiates the crisis management process. The coordinator has access to the camera surveillance system. The surveillance system is an external system used to monitor traffic on highways or other busy routes. The cameras are installed only in specific locations. If a crisis occurs in locations under surveillance, the crisis management system can request video feed that allows the coordinator to verify the witness information. A super observer, an expert in the field (depending on the kind of crisis), is assigned to the scene to observe the emergency situation and identify the tasks necessary to cope with the situation. The tasks are crisis missions defined by the observer. The coordinator is then required to process the missions by allocating suitable resources to each task.
Crisis Management Systems: A Case Study for Aspect-Oriented Modeling
3
Depending on the type of crisis, human resources could include firemen, doctors, nurses, policemen, and technicians, and hardware resources could include transportation systems, computing resources, communication means (such as PDAs or mobile phones), or other necessities such as food or clothes. Animals, for instance police dogs, are also used as resources in some situations. The human and animal resources act as first-aid workers. Each first-aid worker is assigned a specific task that needs to be executed to recover from the abnormal situation. The workers are expected to report on the success or failure in carrying out the missions. The completion of all missions would allow the crisis to be concluded. 2.2 Scope of the CMS A crisis management system (CMS) should include the following functionalities: – initiating a crisis based on the external input from a witness, – processing a crisis by executing the missions defined by a super observer and then assigning internal and/or external resources, – wrapping up and archiving crisis, – authenticating users, – handling communication between coordinator/system and resources. A CMS replaces existing crisis management systems that a) still manually keep track of important crisis-related information and that b) operate largely without automated support for crisis resolution strategies to respond to a crisis. 2.3 Non-functional Requirements of the CMS The crisis management system shall exhibit the following non-functional properties: – Availability • The system shall be in operation 24 hours a day, everyday, without break, throughout the year except for a maximum downtime of 2 hours every 30 days for maintenance. • The system shall recover in a maximum of 30 seconds upon failure. • Maintenance shall be postponed or interrupted when a crisis is imminent without affecting the systems capabilities. – Reliability • The system shall not exceed a maximum failure rate of 0.001%. • The mobile units shall be able to communicate with other units on the crisis site and the control centre regardless of location, terrain, and weather conditions. – Persistence • The system shall provide support for storing, updating, and accessing the following information on both resolved and on-going crises: type of crisis, location of crisis, witness report, witness location, witness data, time reported, duration of resolution, resources deployed, civilian casualties, crisis management personnel casualties, strategies used, missions used, location of super observer, crisis perimeter, location of rescue teams on crisis site, level of emissions from crisis site, log of communications, log of decisions, log of problems encountered.
4
J. Kienzle, N. Guelfi, and S. Mustafiz
–
–
–
–
–
• The system shall provide support for storing, updating, and accessing the following information on available and deployed resources (both internal and external): type of resource (human or equipment), capability, rescue team, location, estimated time of arrival (ETA) on crisis site. • The system shall provide support for storing, updating and accessing the following information on crisis resolution strategies: type of crisis, step-by-step guide to resolve crisis, configuration of missions required, links to alternate strategies, applications to previous crises, and success rate. Real time • The control centre shall receive and update the following information on an on going crisis at intervals not exceeding 30 seconds: resources deployed, civilian casualties, crisis management personnel casualties, location of super observer, crisis perimeter, location of rescue teams on crisis site, level of emissions from crisis site, estimated time of arrival (ETA) of rescue teams on crisis site. • The delay in communication of information between control centre and rescue personnel as well as amongst rescue personnel shall not exceed 500 milliseconds. • The system shall be able to retrieve any stored information with a maximum delay of 500 milliseconds. Security • The system shall define access policies for various classes of users. The access policy shall describe the components and information each class may add, access, and update. • The system shall authenticate users based on the access policies when they first access any components or information. If a user remains idle for 30 minutes or longer, the system shall require them to re-authenticate. • All communications in the system shall use secure channels compliant with AES-128 standard encryption. Mobility • Rescue resources shall be able to access information on the move. • The system shall provide location-sensitive information to rescue resources. • Rescue resources shall communicate their location to the control centre. • The system shall have access to detailed maps, terrain data, and weather conditions for the crisis location and the routes leading to it. Statistic Logging • The system shall record the following statistical information on both on-going and resolved crises: rate of progression, average response time of rescue teams, individual response time of each rescue team, success rate of each rescue team, rate of casualties, and success rate of missions. • The system shall provide statistical analysis tools to analyse individual crisis data and data on multiple crises. Multi-Access • The system shall support at least 1000 witnesses calling in at a time. • The system shall support communication, coordination, and information access for at least 20000 rescue resources in deployment at a time. • The system shall support management of at least 100 crises at a time. • The system shall support management of at least 200 missions per crisis at a time.
Crisis Management Systems: A Case Study for Aspect-Oriented Modeling
5
– Safety • The system shall monitor emissions from the crisis site to determine safe operating distances for rescue resources. • The system shall monitor weather and terrain conditions at crisis site to ensure safe operation and withdrawal of rescue resources, and removal of civilians, and casualties. • The system shall determine a perimeter for the crisis site to ensure safety of civilians and removal of casualties to a safe distance. • The system shall monitor criminal activity to ensure safety of rescue resources, civilians and casualties. • The safety of rescue personnel shall take top priority for the system. – Adaptability • The system shall recommend alternate strategies for dealing with a crisis as the crisis conditions (e.g., weather conditions, terrain conditions, civilian, or criminal activity) change. • The system shall recommend or enlist alternate resources in case of unavailability or shortage of suitable resources. • The system shall be able to use alternate communication channels in case of unavailability or shortage of existing channels. • The system shall be able to maintain effective communication in areas of high disruption or noise at the crisis site. – Accuracy • The system shall have access to map, terrain, and weather data with a 99% accuracy. • The system shall provide up-to-date information to rescue resources. • The system shall record data on receipt without modifications. • The communication between the system and rescue resources shall have a maximum deterioration factor of 0.0001 per 1000 kilometres. 2.4 Car Crash Crisis Management System Some of the models presented in this paper focus on one particular CMS: the car crash crisis management system (CCCMS). The CCCMS includes all the functionalities of general crisis management systems, and some additional features specific to car crashes such as facilitating the rescuing of victims at the crisis scene and the use of tow trucks to remove damaged vehicles. Scope of the CCCMS. A car accident or car crash is an incident in which an automobile collides with anything that causes damage to the automobile, including other automobiles, telephone poles, buildings or trees, or in which the driver loses control of the vehicle and damages it in some other way, such as driving into a ditch or rolling over [2]. Sometimes, a car accident may also refer to an automobile striking a human or animal. Our CCCMS addresses car crashes involving single or multiple vehicles, humans, or other objects. This case study is, however, limited to management of human victims
6
J. Kienzle, N. Guelfi, and S. Mustafiz
only and does not provide rescue missions specifically for animals. First-aid animal workers are not included in the scope of this case study either. Car crash-specific functionalities include the following: – facilitating the rescue mission carried out by the police by providing them with detailed information on the location of the crash; – managing the dispatch of ambulances or other alternate emergency vehicles to transport victims from the crisis scene to hospitals; – facilitating the first-aid missions by providing relevant medical history of identified victims to the first-aid workers by querying databases of local hospitals; – facilitating the medical treatment process of victims by providing important information about the crash to the concerned workers, i.e. paramedics, doctors, upon arrival at the hospital; – managing the use of tow trucks to remove obstacles and damaged vehicles from the crisis scene. CCCMS Actors. The actors involved in the CCCMS are defined in this section. – Coordinator oversees management of the crisis by coordinating the resources and communicating with all the CMS employees and external workers. – Super Observer is dispatched to the crisis scene to evaluate the situation and define the necessary missions to cope with the crisis. – CMS Employee is an internal human resource who is qualified and capable of performing missions related to his field of expertise. The worker acts as a facilitator actor when he is in-charge of or operating local resources (e.g. tow trucks or ambulances). – External Worker is an external resource who is specialized and capable of performing missions related to his field of expertise. The worker acts as a facilitator actor when he is in charge of or operating external resources (e.g. police trucks or fire trucks). – System Admin is the specialist who maintains the system and creates all profiles of workers and resources to feed the crisis management database. – Witness is the person who reports the crisis by calling the crisis management center. – Phone Company is an external entity contacted for verification of witness purposes. – Surveillance System is an external entity which monitors traffic in highways and cities with the use of cameras.
3 Crisis Management System: Feature Models Because there are so many different kinds of crises, the domain of crisis management systems is very broad. However, any crisis management system has a common set of responsibilities and functionalities. It is, therefore, natural to build a framework or product line of crisis management systems, which can be specialized to create crisis management systems for a particular kind of crisis and a particular context. A feature diagram
Crisis Management Systems: A Case Study for Aspect-Oriented Modeling
Fig. 1. Crisis Management Systems Feature Diagram – Part 1
Fig. 2. Crisis Management Systems Feature Diagram – Part 2
7
8
J. Kienzle, N. Guelfi, and S. Mustafiz
Fig. 3. Crisis Management Systems Feature Diagram – Part 3
listing many possible features of a crisis management system is given in Figs. 1 to 3. It has been taken from [3]. Selection of some features requires the selection of other features. Examples of such dependencies are: – Natural Disasters requires Fire Department and External Company – Terrorist Attack requires Army Special Unit and Police and Police Special Unit and Public Hospital – Major Accident requires Police and Fire Department and Public Hospital and Private Hospital and Independent First-Aid Doctor and Private Ambulance Company – Plant Explosion requires Police and Fire Department and Public Hospital – Nuclear Plant Explosion requires The Army and Army Special Unit Fig. 4 presents a possible set of features selected for the car crash CMS.
4 Car Crash Crisis Management System: Use Cases Use cases [4,5] are a widely used formalism for discovering and recording behavioral requirements of software systems, since they can be effectively used as a communication means between technical because as well as non-technical stakeholders of the software under development. In short, use cases are stories of using a system to meet goals. They are in general text-based, but their strength is that they both scale up or scale down in terms of sophistication and formality, depending on the need and context.
Crisis Management Systems: A Case Study for Aspect-Oriented Modeling
Fig. 4. Car Crash Crisis Management Systems Feature Diagram
9
10
J. Kienzle, N. Guelfi, and S. Mustafiz
Crisis Management System: Car Crash Case Study
1
Surveillance System
> inc
lud e lud
>>
<<
Capture Witness Report
inc
Witness 1
Phone Company *
>
e>
lude>
<
<<
<<
inc
> e> lud inc <<
1.. *
*
Resolve Crisis
Coordinator
Assign IntResource
lud
CMS Employee
e>
>
*
Request ExtResource
Execute Mission
e>>
Resource
clud
Authenticate User Execute SuperObserver Mission 1
Super Observer
<
*
Execute Rescue Mission
*
FirstAid Worker
Execute Helicopter Transport Mission
External Resource System
1
*
Hospital ResourceSystem
Execute Remove Obstacle Mission
Pilot
Fig. 5. CCCMS: Standard Use Case Diagram
Fig. 5 shows the use cases related to the summary-level goal Resolve Crisis in the CCCMS by means of a use case diagram. Details of all the use cases that directly relate to the summary level use case Resolve Crisis are given in section 4.1. The listed use cases are: Resolve Crisis, Capture Witness Report, Assign Internal Resource, Assign External Resource, Execute Mission, Execute SuperObserver Mission, Execute Rescue Mission, and Authenticate User. Use cases describing other missions, such as the Execute Helicopter Transport Mission, or Execute Remove Obstacle Mission are not shown for space reasons. Likewise, details of use cases related to the management of the resource database are not included for space reasons and such use cases would, for instance, include: – – – –
Creating records for CMSEmployees Managing access rights of CMSEmployees Updating the availability of CMSEmployees due to sickness or vacation Dealing with problems of the CMS-controlled vehicles that are not related to a crisis
Finally, following a dependability-oriented requirements engineering process such as DREP [6], exceptional situations that a CMS might be exposed to should also be considered. For this case study, several exceptional situations were discovered that affect the context in which the system operates, and that require the system to react in a certain way to continue to provide reliable and safe service. The situations are: – Severe Weather Conditions: Bad weather makes helicopter transportation impossible. – Strike: A strike affects the availability of CMS employees and external workers. – Risk of Explosion: Leaking gas and open fire threatens the safety of workers.
Crisis Management Systems: A Case Study for Aspect-Oriented Modeling
11
– VIP Victim: One of the crash victims is a VIP (such as for instance, the president). Handling of the crisis should, therefore, be coordinated by the appropriate office. – Criminal Case: The reason for the crash is of criminal nature, and therefore the rescue missions have to be carried out accordingly. To detect and handle the above situations, we added the following exceptional actors: WeatherInformationSystem, NationalCrisisCenter. The detailed handler use cases that describe the functionality that such a reliable CCCMS is to provide are not described in this document for space reasons. 4.1 Textual Use Cases The use cases presented here follow a textual template. The main success scenario is a numbered list of lines of text (subsequently named steps) that describes the possible interactions between the primary actor, potential secondary actors, and the CCCMS (subsequently named System) that occur to reach a particular goal. Alternate ways of achieving a goal, or situations in which the goal cannot be reached, are described in the extension part of the template. Resolve Crisis Use Case 1: Resolve Crisis Scope: Car Crash Crisis Management System Primary Actor: Coordinator Secondary Actor: Resource Intention: The intention of the Coordinator is to resolve a car crash crisis by asking employees and external workers to execute appropriate missions. Main Success Scenario: Witness places a call to the crisis centre, where it is answered by a Coordinator. 1. Coordinator captures witness report (UC 2). 2. System recommends to Coordinator the missions that are to be executed based on the current information about the crisis and resources. 3. Coordinator selects one or more missions recommended by the system. For each mission in parallel: 4. For each internal resource required by a selected mission, System assigns an internal resource (UC 3). 5. For each external resource required by a selected mission, System requests an external resource (UC 4). 6. Resource notifies System of arrival at mission location. 7. Resource executes the mission (UC 5). 8. Resource notifies System of departure from mission location. 9. In parallel to steps 6-8, Coordinator receives mission status updates from System. 10. In parallel to steps 6-8, System informs Resource of relevant changes to mission or crisis information. 11. Resource submits the final mission report to System. 12. In parallel to steps 4-8, Coordinator receives new crisis-related information from System. 13. Coordinator closes the file for the crisis resolution. Use case ends in success.
12
J. Kienzle, N. Guelfi, and S. Mustafiz
Extensions: 1a. Coordinator is not logged in. 1a.1 Coordinator authenticates with System (UC 10). 1a.2 Use case continues with step 1. 4a. Internal resource is not available after step 4. 4a.1 System requests an external resource instead (i.e., use case continues in parallel with step 5). 5a. External resource is not available after step 5. 5a.1 Use case continues in parallel with step 2. 6a. System determines that the crisis location is unreachable by standard transportation means, but reachable by helicopter. 6a.1 System informs the Coordinator about the problem. 6a.2 Coordinator instructs System to execute a helicopter transport mission (UC 09). 6a.3 Use case continues with step 6. 6b. Resource is unable to contact System. 6b.1 SuperObserver notifies System that resource arrived at the mission location. 6c. Although Resource should be at mission location by now, Resource has not yet notified System. 6c.1 System requests Resource to provide an update of its location. 6c.2 Use case continues at step 6. 7a. One or more further missions are required in step 6. 7a.1 Use case continues in parallel with step 2. 7b. The mission failed. 7b.1 Use case continues with step 2. 8a. Resource is unable to contact System. 8a.1 SuperObserver notifies System that resource is leaving the mission location. 8b. Although mission should be completed by now, Resource has not left mission location. 8b.1 System requests Resource to provide the reason for the delay. 8b.2 Use case continues at step 7. 9a. Changes to mission are required. 9a.1 Use case continues in parallel with step 2. 11a. Resource never files a mission report. 11a.1 Mission use case ends without mission report. 12a. Changes to mission are required. 12a.1 Use case continues in parallel with step 2.
Capture Witness Report Use Case 2: Capture Witness Report Scope: Car Crash Crisis Management System Primary Actor: Coordinator Secondary Actor: PhoneCompany, SurveillanceSystem Intention: The Coordinator intends to create a crisis record based on the information obtained from witness. Main Success Scenario: Coordinator requests Witness to provide his identification. 1. Coordinator provides witness information1 to System as reported by the witness.
Crisis Management Systems: A Case Study for Aspect-Oriented Modeling
13
2. Coordinator informs System of location and type of crisis as reported by the witness. In parallel to steps 2-4: 2a.1 System contacts PhoneCompany to verify witness information. 2a.2 PhoneCompany sends address/phone information to System. 2a.3 System validates information received from the PhoneCompany. 3. System provides Coordinator with a crisis-focused checklist. 4. Coordinator provides crisis information2 to System as reported by the witness. 5. System assigns an initial emergency level to the crisis and sets the crisis status to active. Use case ends in success. Extensions: 1a,2a. The call is disconnected. The base use case terminates. In parallel to steps 3-4, if the crisis location is covered by camera surveillance: 3a.1 System requests video feed from SurveillanceSystem. 3a.2 SurveillanceSystem starts sending video feed to System. 3a.3 System starts displaying video feed for Coordinator. 4a. The call is disconnected. 4a.1 Use case continues at step 5 without crisis information. 5a. PhoneCompany information does not match information received from Witness. 5a.1 The base use case is terminated. 5b. Camera vision of the location is perfect, but Coordinator cannot confirm the situation that the witness describes or the Coordinator determines that the witness is calling in a fake crisis. 5b.1 The base use case is terminated. 1 2
Witness information includes the first name, last name, phone number, and address. Crisis information includes the details about the crisis, the time witnessed, etc...
Assign Internal Resource Use Case 3: Assign Internal Resource Scope: Car Crash Crisis Management System Primary Actor: None Secondary Actor: CMSEmployee Intention: The intention of System is to find, contact, and assign a mission to the most appropriate available CMSEmployee. Main Success Scenario: System selects an appropriate CMSEmployee based on the mission type, the emergency level, location and requested expertise. In very urgent cases, steps 1 and 2 can be performed for several CMSEmployees concurrently, until one of the contacted employees accepts the mission. 1. System sends CMSEmployee mission information. 2. CMSEmployee informs System that he accepts the mission. Use case ends in success. Extensions: 1a. CMSEmployee is not logged in. 1a.1 System requests the CMSEmployee to login. 1a.2 CMSEmployee authenticates with System (UC 10). 1a.3 Use case continues at step 1. 1b. CMSEmployee is unavailable or unresponsive. 1b.1 System selects the next appropriate CMSEmployee.
14
J. Kienzle, N. Guelfi, and S. Mustafiz 1b.2 Use case continues at step 1. 1b.1a No other CMSEmployee is available. Use case ends in failure. 2a. CMSEmployee informs System that he cannot accept the mission. 2a.1 System selects the next appropriate CMSEmployee. 2a.2 Use case continues at step 1. 2a.2a No other CMSEmployee is available. Use case ends in failure.
Request External Resource Use Case 4: Request External Resource Scope: Car Crash Crisis Management System Primary Actor: Coordinator Secondary Actor: ExternalResourceSystem (ERS) Intention: The System requests a mission from an external resource, such as a fire station, police station or external ambulance service. Main Success Scenario: 1. System sends mission request to ERS, along with mission-specific information1 . 2. ERS informs System that request can be processed. Use case ends in success. Extensions: 2a. ERS notifies System that it partially approves request for resources. Use case ends in degraded success. 2b. ERS notifies System that it cannot service the request. Use case ends in failure. 1
Mission-specific information includes things such as the location and emergency level of the mission, the quantity of vehicles requested, special characteristics of the aid worker or vehicle, etc...
Execute Mission Use Case 5: Execute Mission Intention: The Resource executes a mission to help resolve a crisis. ExecuteMission is an abstract use case. The details of the interaction for specific missions are presented in child use cases, such as ExecuteSuperObserverMission (UC 6) or ExecuteRescueMission (UC 7).
Execute SuperObserver Mission Use Case 6: Execute SuperObserver Mission Scope: Car Crash Crisis Management System Primary Actor: SuperObserver Secondary Actor: None Intention: The intention of the SuperObserver is to observe the situation at the crisis site to be able to order appropriate missions. Main Success Scenario: SuperObserver is at the crisis location. 1. System sends a crisis-specific checklist to SuperObserver. 2. SuperObserver feeds System with crisis information. 3. System suggests crisis-specific missions to SuperObserver. Steps 4-8 is repeated as many times as needed. 4. SuperObserver notifies System of the type of mission he wants to create.
Crisis Management Systems: A Case Study for Aspect-Oriented Modeling
15
5. System sends a mission-specific information request to SuperObserver. 6. SuperObserver sends mission-specific information1 to System. 7. System acknowledges the mission creation to SuperObserver. 8. System informs SuperObserver that mission was completed successfully. 9. SuperObserver judges that his presence is no longer needed at the crisis location. Use case ends in success. Extensions: 7a. Mission cannot be created and replacement missions are possible. 7a.1 System suggests replacement missions to SuperObserver. 7a.2 Use case continues with step 4. 7b. Mission cannot be created and no replacement missions are possible. 7b.1 System suggests notifying the NationalCrisisCenter. 7b.2 Use case continues with step 4. 8a. Mission failed. 8a.1 System informs SuperObserver and Coordinator about mission failure. 8a.2 Use case continues with step 4. 1
Mission-specific information includes things such as the quantity of vehicles requested, special characteristics of the aid worker or vehicle, etc...
Execute Rescue Mission Use Case 7: Execute Rescue Mission Scope: Car Crash Crisis Management System Primary Actor: FirstAidWorker Secondary Actor: HospitalRS Intention: The intention of the FirstAidWorker is to accept and then execute a rescue mission that involves transporting a victim to the most appropriate hospital. Main Success Scenario: FirstAidWorker is at the crisis location. 1. FirstAidWorker transmits injury information of victim to System. Steps 2 and 3 are optional. 2. FirstAidWorker determines victim’s identity and communicates it to System. 3. System requests victim’s medical history information from all connected HospitalResourceSystems. FirstAidWorker administers first aid procedures to victim. 4. System instructs FirstAidWorker to bring the victim to the most appropriate hospital. 5. FirstAidWorker notifies System that he is leaving the crisis site. 6. FirstAidWorker notifies System that he has dropped off the victim at the hospital. 7. FirstAidWorker informs System that he has completed his mission. Use case ends in success. Extensions: 4a. HospitalResourceSystem transmits victim’s medical history information to System. 4a.1 System notifies FirstAidWorker of medical history of the victim relevant to his injury. 4a.2 Use case continues at step 4.
Execute Helicopter Transport Mission Use Case 8: Execute Helicopter Transport Mission Scope: Car Crash Crisis Management System
16
J. Kienzle, N. Guelfi, and S. Mustafiz
Primary Actor: Pilot Secondary Actor: None Intention: The intention of the Pilot is to accept and then execute a transport mission that involves transporting a CMSEmployee to and from a mission location. Main Success Scenario: To be defined.
Execute Remove Obstacle Mission Use Case 9: Execute Remove Obstacle Mission Scope: Car Crash Crisis Management System Primary Actor: TowTruckDriver Secondary Actor: None Intention: The intention of the TowTruckDriver is to accept and then execute a remove obstacle mission that involves removing a crashed car from a mission location. Main Success Scenario: To be defined.
AuthenticateUser Use Case 10: AuthenticateUser Scope: Car Crash Crisis Management System Primary Actor: None Secondary Actor: CMSEmployee Intention: The intention of the System is to authenticate the CMSEmployee to allow access. Main Success Scenario: 1. System prompts CMSEmployee for login id and password. 2. CMSEmployee enters login id and password into System. 3. System validates the login information. Use case ends in success. Extensions: 2a. CMSEmployee cancels the authentication process. Use case ends in failure. 3a. System fails to authenticate the CMSEmployee. 3a.1 Use case continues at step 1. 3a.1a CMSEmployee performed three consecutive failed attempts. 3a.1a.1 Use case ends in failure.
5 Car Crash Crisis Management System: Domain Model The domain model offers insight into the problem domain, in our case, the car crash crisis management system. Taking the form of a UML class diagram, it provides a description of the concepts of the problem domain relevant to the CCCMS, by representing the concepts as classes, attributes, and associations between classes. Although any domain concept could be added to the domain model, we decided to include here only concepts that must define information that must be recorded for the purpose of fulfilling the system’s responsibilities over time. In other words, the domain model presented here only contains concepts that are used to describe the necessary information to fulfill system goals. Because of size constraints, the domain model is split into two parts. The top part of Fig. 6 depicts the Crisis and Mission concepts and how they relate to the other concepts, whereas the bottom part shows the generalization/specialization hierarchies inherent in the domain of the CCCMS.
Crisis Management Systems: A Case Study for Aspect-Oriented Modeling
gatheredMedium 0..*
Medium Coordinator
assignedTo 1 observedBy 1..*
Witness
involvedVictim 0..*
Victim
Crisis emergencyLevel 0..* affectedArea startTime endTime status detailedInfo
1
witnessCL 1
CrisisType
CheckList
missionCL
1
CarCrash
1
0..*
Mission emergencyLevel location startTime endTime status detailedInfo 0..* crashedVehicle 0..1 transportedBy
0..1 wasIn
involvedW Worker 0..* missionLeader 1
CMSEmployee
0..* 1 employer 0..*
Vehicle
Victim deceased concious mobile injury
Medium
Photo
SysAdmin
Movie
Sound
Worker gsm expertise
CMSEmployee loginId password accessRights status
Coordinator
External ResourceSystem
MobileEmployee
Person name address identification phone dateOfBirth
Witness
ExternalWorker
ExternalWorker id currentLocation
Car
MobileEmployee currentLocation pdaNumber
Vehicle license serialNumber color
Truck
Bike
Train
Helicopter
Ambulance SuperObserver
Logistician
FirstAidWorker
Pilot
External ResourceSystem name address phone
MedicalRS
HospitalRS
Private AmbulanceRS
GovernmentRS
PoliceRS
Fire DepartmentRS
LogisticRS
Road RepairRS
TowingRS
MechanicRS
Fig. 6. CCCMS Domain Model
SurveillanceRS
CleaningRS
17
18
J. Kienzle, N. Guelfi, and S. Mustafiz
6 Car Crash Crisis Management System: Informal Physical Architecture Description A typical architecture for a crisis management system contains many machines that are connected with different types of networks. Fig. 7 gives an overview of the kinds of machines and communication networks that could be used in an instance of the CCCMS.
Police System
Government Fire Department System System
Hospital System
Cellular Phone
Surveillance System GPS
Laptop
VPN Gateway
File Server
PDA
Authentication Server
GSM Antenna
Terminal
Relational Database
Macintosh
Single Server or Server Cluster
Desktop PC
Logging Host
Workstation
Long-term Storage
Phone
Fig. 7. CCCMS: Physical Architecture
The backend of the system is composed of a server or a server cluster that implements most of the business functionality. Local CMS employees, such as the coordinators and the system administrators, use terminals or desktop machines to access the backend through a private network. External services and mobile CMS employees with laptops are connected to the backend by means of virtual private networks on top of public networks. Cell phones, GPS (Global Positioning System) devices, and PDAs (Personal Desktop Assistants) are reached using a GSM (Global System for Mobile Communications) antenna. In the network layer, several protocols can be used to transport the communications: GSM for voice, GSM for SMS (Short Message Service), UDP/TCP/IP for voice, and
Crisis Management Systems: A Case Study for Aspect-Oriented Modeling
19
TCP/IP for data exchange. In the application layer, several protocols can be used to transport the communications: proprietary protocols, or standardized protocols (HTTP, SMTP, POP3, IMAP, XMPP, etc...).
7 Car Crash Crisis Management System: Selected Design Models During design, a blue print of a solution that satisfies the requirements defined by the analysis models is devised. In object-oriented design, the conceptual state has to be mapped to objects, and then the developer has to decide how the conceptual state changes specified in every system operation are to be implemented by interacting objects at run time. The concepts identified during analysis, in our case e.g. Crisis, Mission, CMSEmployee are initial candidates for becoming design objects that hold the application state. However, some concepts may be implemented using several objects, or, alternatively, some concepts may be implemented as attributes. The granularity of objects affects several aspects of the system under development. Too fine-grained decomposition leads to systems with thousands of objects and such systems might be hard to understand and maintain due to their high coupling, and generate huge communication overhead. On the other hand, a coarse decomposition leads to bulky architectures, and objects with unclear responsibilities, which can also be hard to understand and maintain. Good designers try to maximize object coherence, while minimizing object coupling. The idea of this section is to present some design models of a possible object-oriented design of the CCCMS backend. Currently, the only functionality that is designed is the CreateMission functionality that is triggered by the SuperObserver when ordering missions to deal with the crash. 7.1 Creating Missions Summary of Functionality. The CreateMission functionality allows the SuperObserver to inform the CCCMS about a mission that needs to be accomplished to deal with the crash. The system has to store the relevant mission information, determine the candidate CMSEmployees that could accomplish the mission, establish contact with at least one of them and propose the mission to him. The design of CreateMission also implements some secondary functionality. For instance, it takes care of gathering statistics on how many potential candidate employees the system was able to choose from when assigning the mission. In addition, it makes sure that employees have properly logged into the system (and hence authenticated) before sending them mission related information. Interaction Design. It is assumed that somehow the user interface on the PDA allows the SuperObserver to select the appropriate mission kind, select the emergency level of the mission and enter detailed mission information before sending the request to the CCCMS backend. The sequencing of message exchanges between objects that are triggered by this request are shown in a sequence diagram in Fig. 8.
20
J. Kienzle, N. Guelfi, and S. Mustafiz
createMission (su: SuperObserver, kind: MissionKind, level: EmergencyLevel, details: MissionDetails)
: Crisis Manager
: Resource Manager
su: Super Observer
myEmployees: EmplHashTable
foundColl: EmplColl
currentCrisis := getCrisis() create(currentCrisis, level, details) addMission(m)
currentCrisis: Crisis
m: Mission
initiateAssignment(m) exp := getRequiredExpertise() foundEmployees := find(exp)
foundColl := get(exp) foundEmployees := clone() create()
create()
foundEmployees: EmplColl
candidates: EmplPriorityList
setCandidates(candidates) loop [currentEmpl within foundEmployees] currentEmpl := next()
currentEmpl: CMSEmployee
available := isAvailable()
: Map
opt [available] emplLocation := getLocation() missionLocation := getLocation() time := travelTime(emplLocation, missionLocation) maxStartDelay := getMaxStartDelay() opt [time < maxStartDelay] score := adequacyScore(currentEmpl, time) insert(currentEmpl, score)
size := getSize()
: Statistics
numberOfCandidates(size)
empl := removeFirst() contactAbout(m)
empl: CMSEmployee alt [not loggedIn] create(emplSMSNumber) setStatus(contacting,m)
req: Login RequestSMS
: SMSSender send(req)
[else] setStatus(proposing,m)
: PDASender
sendMissionProposal(myPDAConnection, m)
Fig. 8. CCCMS: CreateMission Design Sequence Diagram
The initial request is directed to the CrisisManager. After instantiating a new mission object and linking it to the crisis, the crisis manager hands the responsibility of assigning the mission to a CMSEmployee to the ResourceManager. The resource manager has access to a hash table of employees indexed by expertise, and hence is able to obtain a collection of employees that are qualified to execute the mission. The resource manager then proceeds by looping although this list, and inserting any available
Crisis Management Systems: A Case Study for Aspect-Oriented Modeling
21
employee (i.e. an employee that currently is not affected to other missions or otherwise unavailable) that is close enough to the mission location (i.e. can get to the mission location in a reasonable amount of time) into a priority queue. In the queue, the employees are sorted with respect to their “adequacy” for performing the mission. Once this list is established, the size of the list is remembered for statistical purpose. Finally, the resource manager proceeds by contacting the first employee on the list. If that employee is not currently logged in, then he is requested to do so by sending him an SMS. The interaction design ends here, because the system now has to wait for an answer from the employee (which can either be a login request, or a mission acceptance notification). Structural Design. The chosen design solution presented in the sequence diagram has many implications on the design. It assumes, for instance, the existence of many classes with particular fields and method definitions. In addition, some permanent associations are assumed to exist. For example, a super observer must be associated with a crisis. This is obvious from the first message in the sequence diagram in Fig. 8. Another example is the employee hash table that can find employees based on a particular expertise. The CreateMission design assumes that this hash table already exists. This means that the functionality that deals with the creation of employees must also take care of building this hash table, establishing permanent references between expertise and groups of employees. The classes, attributes, and methods, and the dependencies and associations between classes created, used and assumed by the CreateMission design are shown in Fig. 9.
EmplHashTable
initiateAssignment(Mission)
employees 1
<
> candidates 0..1
EmplColl find(Expertise) EmplColl get(Expertise)
Crisis addMission(Mission)
<<system-wide>>
CrisisManager
CMSEmployee available: boolean loc: Location status: EmplStatus boolean isAvailable() Location getLocation() setStatus(EmplStatus,Mission) contactAbout(Mission)
relatedMission 0..1
SMS destNumber
Request LoginSMS
SMSSender 1 send(SMS) 1 PDASender sendMissionProposal (PDA,Mission)
observedCrisis 0..1
0..*
1
createMission(SuperObserver, MissionKind, EmergencyLevel,MissionDetails)
EmplColl clone() CMSEmployee next()
EmplPriorityList insert(CMSEmployee, float) int getSize() CMSEmployee removeFirst()
1
0..*
Mission level: EmergencyLevel details: MissionDetails loc: Location create(Crisis,EmergencyLevel,MissionDetails) Location getLocation() float adequacyScore(CMSEmployee,Time) Time getMaxStartDelay() Expertise getRequiredExpertise()
EmplColl Expertise
0..*
1
0..*
<<system-wide>>
ResourceManager
SuperObserver
<<system-wide>> <<system-wide>>
Statistics
1
numberOfCandidates(int)
Map Time travelTime (Location, Location)
Fig. 9. CCCMS: Partial Design Class Diagram based on CreateMission Design
22
J. Kienzle, N. Guelfi, and S. Mustafiz
Acknowledgments The authors would like to thank Christian Fischer, Damien Garot, Laurent Vuillermoz, Jacques Klein, and Alfredo Capozucca for sharing requirements documents and models of crisis management systems with us. Their contributions led to the creation of the first draft of this document. Our thanks also extend to Mehmet Aksit, Wisam Al Abed, Jo˜ao Ara´ujo, Florencia Balbastro, Franck Fleurey, Jean-Marc J´ez´equel, Gunter Mussbacher, Awais Rachid, Pablo S´anchez, and Jon Whittle, the participants of the first 1-week aspect-oriented modeling workshop held at the Bellairs Research Institute of McGill University from April 5th to April 12th 2009. Their valuable input and suggestions significantly enhanced the quality of the requirements and use cases descriptions.
References 1. 2. 3. 4.
Optimal Security: Requirements document: Version 0.8 (March 2009) Wikicars.org: http://wikicars.org/en/Car_accidents Optimal Security: Product line document: Version 0.7 (March 2009) Jacobson, I., Christerson, M., Jonsson, P., Overgaard, G.: Object-Oriented Software Engineering: A Use Case Driven Approach. Addison–Wesley, Reading (1992) 5. Cockburn, A.: Writing Effective Use Cases. Addison–Wesley, Reading (2000) 6. Mustafiz, S., Kienzle, J.: DREP: A Requirements Engineering Process for Dependable Reactive Systems. In: Romanovsky, A., Jones, C., Knudsen, J.L., Tripathi, A. (eds.) Methods, Models and Tools for Fault Tolerance, vol. 5454, pp. 220–250. Springer, Heidelberg (2009)
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN): A Case Study Gunter Mussbacher1, Daniel Amyot1, João Araújo2, and Ana Moreira2 1
SITE, University of Ottawa, 800 King Edward, Ottawa, ON, K1N 6N5, Canada {gunterm,damyot}@site.uottawa.ca 2 CITI/FCT, Universidade Nova de Lisboa, 2829-516 Caparica, Portugal {ja,amm}@di.fct.unl.pt
Abstract. The User Requirements Notation (URN) is a recent ITU-T standard that supports requirements engineering activities. The Aspect-oriented URN (AoURN) adds aspect-oriented concepts to URN, creating a unified framework that allows for scenario-based, goal-oriented, and aspect-oriented modeling. AoURN is applied to the car crash crisis management system (CCCMS), modeling its functional and non-functional requirements (NFRs). AoURN generally models all use cases, NFRs, and stakeholders as individual concerns and provides general guidelines for concern identification. AoURN handles interactions between concerns, capturing their dependencies and conflicts as well as the resolutions. We present a qualitative comparison of aspect-oriented techniques for scenario-based and goal-oriented requirements engineering. An evaluation carried out based on the metrics adapted from literature and a task-based evaluation suggest that AoURN models are more scalable than URN models and exhibit better modularity, reusability, and maintainability. Keywords: Aspect-Oriented Requirements Engineering, Aspect-oriented User Requirements Notation, Scenario-based Modeling, Goal-oriented Modeling.
1 Introduction The User Requirements Notation (URN) [1] is a visual language standardized by the International Telecommunications Union that combines goal-oriented modeling with the Goal-oriented Requirement Language (GRL) and scenario-based modeling with Use Case Maps (UCM). GRL is a technique to capture and evaluate alternatives for reaching stakeholder goals. UCM are used to model causal scenarios. URN is the first and only standard that combines goal-oriented and scenario-based modeling. Nevertheless, URN, like any other modeling language, is reexamined and updated from time to time in light of new, promising developments in software engineering. One such examination of developments in Aspect-oriented Modeling [2, 3, 4, 5, 6, 7, 8] led to research into the Aspect-oriented User Requirements Notation (AoURN). AoURN further combines URN concepts with aspect-oriented concepts into a unified framework to improve modeling support for crosscutting concerns during requirements activities. AoURN consists of two sub-notations called Aspect-oriented GRL (AoGRL) and Aspect-oriented UCM (AoUCM). S. Katz et al. (Eds.): Transactions on AOSD VII, LNCS 6210, pp. 23–68, 2010. © Springer-Verlag Berlin Heidelberg 2010
24
G. Mussbacher et al.
The purpose of this paper is to demonstrate the capabilities of AoURN [9] for requirements engineering activities, giving: a) a detailed introduction to the language with the help of the Car Crash Crisis Management System (CCCMS) case study [10], b) a thorough analysis of AoURN’s capabilities compared with traditional URN models, and c) a qualitative comparison of AoURN to other aspect-oriented techniques. The evaluation of AoURN’s capabilities vs. traditional URN is based on the assessment of the structure of the models built with AoURN and URN. This is, therefore, an experiment that must compare equivalent models, i.e., the content of the models must be the same. The evaluation looks at the structure of two equivalent AoURN and URN models and determines characteristics of these models with the help of metrics from literature that have been used before to assess modularity, reusability, and maintainability [11], although in a somewhat different, but still similar enough context. In addition, a task-based evaluation assesses the impact of common update tasks on the AoURN and URN models. Regarding the scope of this study, note that the experiment does not attempt to determine which technique may define a more complete model (note that there is anecdotal evidence that focusing on concerns helps in this regard [12]). The setup of the CCCMS case study does not easily allow such an experiment because the content of the case study is deemed to be complete and must not be substantially altered. Furthermore, this is also not a usability study, which would require groups of users trying to independently model the CCCMS with AoURN and URN. Undeniably, such an experiment will have to contend with several issues in addition to the core URN and AoURN language features. Issues, such as available tool support and sufficient user training, have to be considered and influence the experiment’s result to a certain degree. Although these experiments also answer important questions about URN and AoURN and hence are worthwhile endeavors that should be undertaken in the future, they are out of scope for this paper as we are, for now, more interested in presenting the language features and in assessing the core language features of URN and AoURN. The remainder of the paper first presents the AoURN modeling process in section 2 and then gives a brief overview of AoURN in section 3. Section 4 presents a selection of the models for the CCCMS and discusses the process phases in greater detail. In section 5, URN and AoURN are compared with each other. Section 6 presents the qualitative comparison of AO techniques for scenario-based and goal-oriented requirements engineering. The paper ends with a conclusion and a discussion of future work in section 7.
2 Overview of the AoURN Modeling Process The modeling process described in the paragraphs below resulted in more than 20 nonorthogonal concerns of the CCCMS being modeled with AoURN. The highly iterative process consists of seven process modules and is supported by extensions to the jUCMNav tool [13], the most comprehensive URN tool available. Other URN tools
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN)
25
include UCMNav [14] which focuses only on scenario modeling, OpenOME [15] which focuses only on goal modeling, and the Sandrila SDL stencil set [16] for Microsoft Office Visio which offers a template for GRL models. Although some figures in this paper have been visually enhanced for didactic purposes, all of them can be and have been created with the jUCMNav tool. P1) Identify concerns. Concerns are identified using the guidelines AoURN provides for concern identification, i.e., it is a more symmetric approach as it treats all use cases, NFRs, and stakeholders as concerns. P2) Build scenario model with AoUCM. Behavioral aspects of the available system documentation is assessed against the identified concerns and structured into an AoUCM model. P3) Test scenario model. AoURN’s built-in testing capabilities are used to test the scenario model and gain greater confidence in its validity and consistency. P4) Describe NFRs with AoUCM. Non-functional concerns are layered over the functional concerns, by modeling NFRs described in the available system documentation with AoUCM. P5) Model stakeholder dependencies and impact with AoGRL. The dependencies between stakeholders are modeled in a goal model with AoGRL. Furthermore, the impact of the functional and non-functional concerns on the stakeholder goals is modeled with AoGRL. P6) Evaluate the AoGRL goal model. The goal model is evaluated with AoURN’s built-in analysis capabilities to indicate how well various potential solutions address the high-level goals of the stakeholders. P7) Capture concern dependencies and conflicts. Whenever a new concern is being modeled, the dependencies and conflicts with other concerns are captured in AoURN’s Concern Interaction Graph (CIG), a specialized GRL graph. These seven process modules may be executed in a flexible way as long as the following constraints are not violated as shown in Fig. 1. P1 must occur before the other process modules, P3 and P4 must occur after P2, and P6 must occur after P5.
P7 P1
P2 P5
P4 P3 P6
Fig. 1. Dependencies in the AoURN Modeling Process
Adaptations to the Process for the Case Study. Given the fact that the evaluation of AoURN conducted in this paper also requires a non-aspect-oriented URN model to be sufficiently defined for comparison purposes, the above process is slightly adapted. In P2, the use cases described in the case study document are modeled in a non-aspectoriented way with UCM, URN’s scenario notation. The UCM model is then assessed
26
G. Mussbacher et al.
against the identified concerns and restructured into an AoUCM model. This is equivalent to assessing the use cases against the identified concerns as there is a straightforward, almost one-to-one mapping between the use cases and the UCM model. However, assessing the UCM model directly ensures that the resulting UCM and AoUCM models are consistent. In P4, the UCM model for the NFR concerns is derived from the AoUCM model. Again, this is due to consistency reasons and will be motivated in more detail in section 4.6 and the beginning of section 5. In P5, the stakeholders are also modeled with GRL, URN’s goal notation. This is necessary for a comparison of standard URN and AoURN models in a new process module P8 performed after the completion of all other process modules. P8 bases the comparison on metrics adapted from literature [11] and a task-based evaluation. Therefore, the URN and AoURN models have to be consistent and cover the exact same content to avoid skewed results of the applied metrics. Any chosen modeling process for this comparison has to ensure that the two models are equivalent, either through a separate process step that balances out the two models after both have been built or by taking both models into account right away during their construction. The process presented here chooses the latter. In addition, a qualitative comparison of AO techniques for scenario-based and goal-oriented requirements engineering is undertaken.
3 Overview of Aspect-oriented User Requirements Notation This section presents a brief background on URN and AoURN. The specifics of these notations will be explained in more detail as needed in the following sections with the help of the case study. In November 2008, URN [1, 17] was approved as Recommendation Z.151 by the Standardization Sector of the International Telecommunication Union (ITU-T). URN is the first and currently only standard that supports both goaloriented and scenario-based modeling for requirements engineering activities, i.e., the elicitation, analysis, specification, and validation of requirements. URN’s goal modeling notation, called GRL, is used to describe and reason mainly about non-functional requirements (NFRs), quality attributes, and the intentions of system stakeholders, whereas URN’s scenario notation, called UCM, is used to model operational and functional requirements, and for performance and architectural reasoning. While GRL identifies at a very high level of abstraction possible solutions to be considered for a proposed system, UCM models describe these solutions in more detail. In summary, URN has concepts for the specification of stakeholders, goals, non-functional requirements, rationales, behavior, actors, scenarios, and structuring. For more information about anything related to URN, the reader is referred to the URN Virtual Library [18] which contains more than 250 publications. AoURN [9, 19, 20, 21] is a recent extension of URN that combines goals, scenarios, and aspects in one framework to better encapsulate crosscutting concerns which are hard or impossible to encapsulate with URN models alone. AoURN introduces the concept of a concern as a first class model element to which other URN model elements may be assigned. A concern is, therefore, defined by its constituent model elements, typically use case maps and goal graphs.
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN)
27
The possible inclusion of AoURN into the next version of URN was discussed for the first time by ITU-T in September 2009. However, it was suggested that it is too early to decide on its inclusion because URN itself is still a rather new standard and more experience with AoURN is first required. This paper represents an important step in demonstrating AoURN’s potential in that context.
4 Car Crash Crisis Management System (CCCMS) Because URN targets requirements engineering activities, the sections of the CCCMS case study document [10] that were consulted most frequently are those related to requirements, i.e., section 2 (Crisis Management System: Requirements) and section 4 (Use Cases). All CCCMS models were created by URN experts who have more than a decade of experience with URN both in academic and industrial settings, who have been responsible for editing the URN standard for the International Telecommunication Union, who have researched AoURN over the last years also in both academic and industrial settings, and who have been responsible for the development of the jUCMNav tool since its first release. 4.1 Identification of Concerns (P1) AoURN provides only rough guidelines for identifying concerns as its strengths lie in describing and analyzing concerns. Therefore, AoURN is ideally to be combined with other concern identification methods, such as EAMiner [22], which automatically identifies concerns. As the purpose of this paper is to focus on AoURN alone, AoURN’s guidelines are followed. Therefore, use cases, NFRs, as well as stakeholders are considered as concerns and iteratively refined. The following 14 nonorthogonal concerns are modeled with AoURN. These concerns are further broken down into sub-concerns, resulting in a total of 25 individual sub-concerns [23]. The four major functional concerns that are identified are Recommend Strategies (recommend strategies based on the crisis and resource availabilities), Resource Management (assignment and release of resources, such as first aid workers, ambulances, and fire trucks), Coordination (execution, adaptation, and monitoring of missions), and Communication (flow of crisis/mission information between actors and the system as well as communication infrastructure). Nine of the ten use cases in the case study document are sub-concerns of these four major functional concerns: • Coordination: Resolve Crisis, Execute Mission, Execute Super Observer Mission, Execute Rescue Mission, Execute Helicopter Transport Mission, and Execute Remove Obstacle Mission • Communication: Capture Witness Report • Resource Management: Assign Internal Resource, Request External Resource Note that each use case is only assigned to one concern in the above list, i.e., its main concern. Other concerns may still crosscut a use case (e.g., the Communication concern appears frequently in use cases assigned to the Coordination concern). Of the eleven NFRs listed in the case study document, six were modeled as concerns. These are Persistence, Statistical Logging, Availability, Security (with its three
28
G. Mussbacher et al.
sub-concerns Authentication, Access Control, and Encryption), Mobility (with its three sub-concerns Mobile Infrastructure, Location Status, and Map Information System), and Safety (with its three sub-concerns Weather Information System, Emissions Monitoring System, and Criminal Activity Monitoring System). Note that the tenth use case in the case study document belongs to the Security NFR concern. Finally, a large number of stakeholders is mentioned in the case study document (Coordinator, Super Observer, CMS Employee, External Worker, Phone Company, Surveillance System, System Admin, Witness, Police, Fire Department, Hospital, Doctor, Ambulance, Victim, First Aid Worker, Helicopter Pilot, and Tow Truck Driver) and many more are not mentioned (e.g., Funding Agency, Government, as well as the General Public). Out of these, the following four stakeholder concerns are modeled: the Coordinator, the General Public, the Resource (representing all resources, such as Super Observer, Police, Fire Department, etc.), and the Government (representing the customer of the CCCMS). Owing to the lack of details relevant to URN/AoURN goal modeling in the available documentation about the proposed CCCMS, we limit ourselves to four stakeholders. GRL is a technique to capture and evaluate alternatives for reaching stakeholder goals. The case study document does not describe well such alternatives and their rationale nor does the document describe well stakeholders and their goals. Four stakeholders are (a) a large enough number to demonstrate the capabilities of GRL and AoGRL and (b) small enough to minimize the amount of information required for goal modeling that is not explicitly stated in the case study document, but must be derived implicitly from the case study document with the help of common knowledge. For example, the case study document does not specifically state which NFRs are of interest to which stakeholders, what the dependencies are between stakeholders, and what the priorities of a stakeholder’s goals are. Instead, the general objectives listed at the beginning of section 2 of the case study document, the goals mentioned in the description of the non-functional requirements, as well as the goals of the use cases must be correlated with the stakeholders and further refined based on common knowledge. Similarly, because the case study document does not provide information about the advantages and disadvantages of possible solutions, the existing crisis management system is considered as a sole alternative to the CCCMS. According to the case study document, the existing, non-computerized system manually keeps track of crisis information and does not recommend strategies for dealing with the crisis. Given the concerns identified in this section, crosscutting is expected to manifest itself in general between the following concerns. The Coordination concern is crosscut by the three other main functional concerns and their use case concerns. The Coordination concern, on the other hand, slightly crosscuts the Communication concern. Furthermore, the Coordination concern represents the core functionality of the CCCMS. It is an essential requirement, while the other functional concerns could be reduced or removed from the CCCMS. The Coordination concern is hence identified as the base concern. The NFR concerns crosscut several use case concerns and thus the four major functional concerns. In addition, the NFR concerns may crosscut each other. The use cases and thus the four major functional concerns crosscut the stakeholder models as a single use case may impact the goals of several stakeholders.
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN)
29
Finally, the NFR concerns also crosscut stakeholders and use cases as an NFR may be of interest to many stakeholders in the context of many use cases. Note that AoURN allows for the definition of concerns and the assignment of model elements to concerns. As a concern is also a model element, concerns may be hierarchically structured as described in this section. Because the content of the CCCMS models that are to be built is given by the case study document, the most influential decision made by the modeler is the choice of concerns. A different choice of concern could lead to vastly different and diverse models. However, once the concerns have been defined, the creation of the AoURN and URN models given a static case study document becomes rather mechanical. The biggest challenge is to comply with the description of the problem in the case study document and to consistently assign modeling elements to the correct concerns. Therefore, major design decisions are not expected for the remaining process steps. 4.2 Model Functional Concerns with UCM (P2 – Modified) The textual use cases in the case study document were first translated into a UCM model. Figures 2 and 3 show the Resolve Crisis use case as an example of the UCM model derived from the use cases in the case study document. A UCM model consists of a path that begins at a start point (z, e.g., resolve) and ends with an end point (▌, e.g., resolved). A path may contain responsibilities (±, e.g., recommendMission(s)), identifying the steps in a scenario, and notational symbols for alternative ( ) and concurrent ( ) branches. Path elements may be assigned to a component (, e.g., Coordinator). Stubs are containers for sub-models called plug-in maps. Drilling into a stub leads to a submap that provides more details, thus allowing for hierarchical structuring of UCM models. A binding between the stub and elements on the plug-in map precisely defines how the scenario continues from the parent map to the submap and back to the parent map. A static stub (, e.g., CaptureWitnessReport) may have only one plug-in map, while dynamic stubs ( , e.g., ExecuteMission) may have several different plug-in maps. The UCM model of the Resolve Crisis use case shows that after capturing a witness report, the system recommends missions to be selected by the coordinator. The selected missions are executed, which is shown in more detail on the ExecuteMission plugin map. Once a mission has finished, the mission file is updated and if all missions have been executed, the crisis is resolved. The second out-path of the ExecuteMission stub leading back to recommendMission(s) indicates that if there are problems with the current mission, the use case continues with the system recommending missions based on the current crisis information. In addition, the AND-fork after selectMission(s) shows parallel activity. The waiting place (z, looks like a start point but in the middle of a path) denotes a location in the use case where the system waits for something to happen. If new information is available at the newCrisisAndMissionInfoAvailable start point, the waiting place is triggered and the coordinator assesses the new information. If it is deemed that changes are required to the current missions, then the use case continues with the system recommending missions. If not, the system continues to wait for new information.
30
G. Mussbacher et al.
Fig. 2. UCM Model for the Resolve Crisis Use Case
A replication factor is defined for the plug-in map (see Fig. 3) of the ExecuteMission stub in Fig. 2, indicating that as many missions (i.e., instances of the plug-in map) are started as selected by the coordinator. According to the semantics of a dynamic stub with replicated plug-in maps, these instances run in parallel and do not need to be synchronized. For better readability, the replication factor is also shown in parenthesis in the name of the ExecuteMission stub. A binding formally describes the continuation of the use case from Figs. 2 to 3 in the UCM model (stub’s in-path Ù execute start point; stub’s top out-path Ù resource not available/more missions required/mission failed end point; stub’s bottom out-path Ù executed end point). Therefore, when the path enters the stub in Fig. 2, the use case continues at the execute start point of Fig. 3. It ends either at the executed end point of Fig. 3, exits the stub at its bottom out-path, and hence continues on to updateMissionFile in Fig. 2, or it ends at the resource not available/more missions required/mission failed end point of Fig. 3, exits the stub at its top out-path, and hence loops back to recommendMission(s) in Fig. 2. In Fig. 3, internal and external resources are first requested which may fail (RequestResource(s) stub; again, replication factors define the number of internal and external resources that are requested). If an internal resource request fails, it may be substituted by an external resource request (substituteInternalWithExternalResource responsibility). Upon successful resource allocation, the system assesses whether the resource needs to be transported by helicopter to the crisis location (TransportWithHelicopter stub). If yes, a new mission for
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN)
31
the helicopter pilot is initiated. In any case, the resource confirms arrival at the crisis location (ConfirmArrival stub), then performs its mission (ExecuteResourceMission stub), before confirming departure (ConfirmDeparture stub). In parallel to this, the resource may receive updated mission information (UpdateMissionInfo stub). The ExecuteResourceMission stub is a dynamic stub because each resource’s mission may be very different from other missions and therefore requires its own plug-in map (e.g., the super observer, rescue, helicopter transport, and the remove obstacle missions). Finally, a mission report may or may not be submitted by the resource before the resource is released.
Fig. 3. UCM Model for the Resolve Crisis Use Case – ExecuteMission Plugin Map
In addition, if the mission was initiated by the super observer, then the super observer is notified about the creation, success, and failure of the mission. The UCM (and AoUCM) models are equivalent to the use case descriptions in the case study document, except for a few corrections due to small errors [23]. For example, it was assumed, for efficiency reasons, that internal and external resources can be assigned in parallel instead of first internal resources and then external resources afterwards. Furthermore, there exists a number of subtle differences due to the nature of use cases and UCM models. While use cases are largely described individually and independently, UCM models capture a complete system view in addition to the individual scenario view. It is certainly possible to visualize use cases with UCMs with a simple one-to-one mapping without considering the interactions between use case descriptions. For example, the status updates for missions initiated by the super observer (steps 7, 8, and 8a.1 of the Execute Super Observer Mission use case in the case study document) could be shown on the map for the super observer mission.
32
G. Mussbacher et al.
However, these notifications can logically only happen once the resources of the desired mission have been assigned, the desired mission was completed, or the desired mission failed, respectively. Therefore, these steps should be and are shown on the ExecuteMission map, ensuring a more consistent model. In such a model, URN’s built-in testing capabilities may verify that these notifications are performed at the right time. 4.3 Model Functional Concerns with AoUCM (P2) For consistency reasons, the UCM model is restructured into an AoUCM model based on the assessment of the whole UCM model against the functional and non-functional concerns identified in section 4.1. Table 1 shows which map elements of the two UCMs from Figs. 2 and 3 belong to which concerns. Although the Coordination concern is identified as the main concern for the two UCMs, large portions of the UCMs can be attributed to five other concerns. Table 1. Assessment of Resolve Crisis UCM Model Against Identified Concerns
Concern Recommend Strategies
Use Case (UCM) Resolve Crisis Resolve Crisis (ResolveCrisis map) (ExecuteMission map) recommendMission(s)
Resource Management Coordination Communication
Super Observer Mission Helicopter Transport Mission
9 CaptureWitnessReport, assessNewCrisisAndMissionInfo (including the AND-fork, waiting place, and starting point)
RequestResource(s), substituteInternalWithExternalResource, releaseResource 9 ConfirmArrival, ConfirmDeparture, Update Mission Info, submitFinalMissionReport receiveMissionCreated, receiveMissionSuccessful, receiveMissionFailed TransportWithHelicopter
9 A checkmark indicates that the map belongs to the concern, including all map elements except for those listed in the same column under a different concern.
The Communication concern has been deemed to deal with the flow of crisis/mission information among the actors and, therefore, includes ConfirmArrival and ConfirmDeparture, which indicate that an assigned resource has arrived or departed, respectively. The Resource Management concern, on the other hand, just deals with the assignment and release of resources. For similar reasons, assessNewCrisisAndMissionInfo belongs to the Communication concern instead of the Coordination concern. The Coordination concern only deals with execution, adaptation, and monitoring of missions, but not with the flow of information.
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN)
33
A restructuring of the UCM model for the Resolve Crisis use case according to aspect-oriented principles is expected to better encapsulate the four major functional concerns, as well as the Execute Super Observer Mission and Helicopter Transport Mission sub-concerns. Figs. 4 and 5 show the AoUCM model of the Resolve Crisis use case with all tangled concerns removed, leaving only the Coordination concern. The responsibilities assignEmergencyLevel and setCrisisStatusActive have been moved from the CaptureWitnessReport map to Fig. 4, as these two responsibilities do not belong to the Communication concern to which the CaptureWitnessReport map was assigned. The AoUCM model of the Resolve Crisis use case now focuses on the most fundamental elements of the crisis management system, i.e., the coordinator selecting missions, the missions being executed by resources either successfully or not, the mission file being updated accordingly, and the crisis file being closed when the crisis is resolved.
Fig. 4. AoUCM Model for the Coordination Concern – Resolve Crisis Use Case
Fig. 5. AoUCM Model for the Resolve Crisis Use Case – ExecuteMission Plugin Map
34
G. Mussbacher et al.
The remaining concerns described in this section extend the Resolve Crisis use case to define an AoUCM model that is equivalent to the UCM model from Figs. 2 and 3. 4.3.1 Recommend Strategies Concern The Recommend Strategies concern is a rather straightforward concern that is required in two locations in the AoUCM model (i.e., in the Resolve Crisis use case and in the Execute Super Observer Mission use case). AoUCM represents the properties of a concern in a map called aspect map. In the case of scenario models, the properties are behavior and structure and are shown for the Recommend Strategies concern in the top map of Fig. 6 with the system’s recommendMission(s) responsibility. In the aspect map, a pointcut stub ( P , e.g., SelectIndicateMission(s)) represents the matched locations in the AoUCM model to which the concern is to be applied. The causal relationship of the pointcut stub and the concern properties visually defines the composition rule for the concern, indicating how the concern is inserted in the AoUCM model (e.g., before, after, optionally, in parallel, interleaved, or anything else that can be expressed with UCM). In the case of the Recommend Strategies concern, the concern properties are applied before the matched locations because the concern properties appear before the pointcut stub on the aspect map. This can be understood very quickly by simply looking at the aspect map without needing to know where exactly the concern is applied or having to understand the concern’s pointcut expression. The pointcut expression (i.e., the actual pattern to be matched in the AoUCM model in order for the concern to be applied to the AoUCM model) is described on a separate map called the pointcut map. This allows the same pointcut map to be reused for different concerns. A pattern is assigned to a concern simply by plugging the pointcut map into the pointcut stub of the concern. This approach also makes it easier to specify several very different pointcut expressions for the same aspect. The pointcut expressions are defined on different pointcut maps, making each of them simpler to understand. In the case of the Recommend Strategies concern, the pattern indicates that all responsibilities called selectMission(s) or indicateDesiredMission(s) are matched (see bottom map of Fig. 6). Note that grey start and end points only denote the beginning and end of the pattern, but are not part of the pattern itself.
Fig. 6. AoUCM Model for the Recommend Strategies Concern
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN)
35
Hence, the Recommend Strategies concern adds the system’s recommendMission(s) responsibility before all responsibilities called selectMission(s) or indicateDesiredMission(s). Note that selectMission(s) appears in Fig. 4 while indicateDesiredMission(s) appears on the Execute Super Observer Mission map available in the complete model posted online. When the Recommend Strategies concern is applied to the AoUCM model, aspect markers (¡) are added automatically to the AoUCM model to indicate where the concern is applied. An aspect marker is a type of stub that is linked to a plug-in map called the AoView of a concern. The bindings of the AoView to the aspect marker are also established automatically.
Fig. 7. Aspect Marker and AoView for the Recommend Strategies Concern
The AoView is identical to the aspect map of the concern except that only those elements are highlighted that are relevant for the aspect marker. For example, the AoView of the Recommend Strategies concern shown in Fig. 7 indicates that the part of the map from the recommend start point to the pointcut stub is inserted at the location of the added aspect marker. Because the AoView is based on the aspect map, it is always possible to visualize the properties of a concern that are added at a particular location in the AoUCM model without having to resolve complex layout issues.
36
G. Mussbacher et al.
4.3.2 New Crisis and Mission Info Concern The New Crisis and Mission Info sub-concern of the Communication concern highlights a more complex composition rule involving loops and concurrency. The subconcern matches against the selectMission(s) responsibility of the Resolve Crisis use case. As visualized by the pointcut stub, an AND-fork is added after the selectMission(s) responsibility. This AND-fork spawns the handling of new information described earlier for Fig. 2 while the base behavior continues. If changes are required, the spawned branch loops back to the pointcut stub (i.e., the coordinator selects missions again). Note that the newCrisisAndMissionInfoAvailable start point must be indicated as a start point local to the concern (crossed out start point symbol), since otherwise bindings between the aspect marker and the AoView of this concern cannot be established automatically. If a local start point is not indicated, it becomes ambiguous which of the two start points of the aspect map should be used for the binding with the aspect marker.
Fig. 8. AoUCM Model for the Communication Concern – New Crisis and Mission Info
Although the pointcut expression of the sub-concern in Fig. 8 only identifies one location and thus does not exhibit strong crosscutting, the sub-concern has to be viewed in the context of its parent concern Communication. The Communication concern crosscuts other concerns several times as shown in Table 1 (the complete version of Table 1 that shows all concerns affected by the Communication concern is also posted online with the complete model).
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN)
37
4.3.3 Resource Management Concern The Resource Management concern requires a pointcut stub with more than one outpath. This is because the pattern that needs to be matched is the complete ExecuteMission map shown in Fig. 5. Therefore, the ExecuteMission map is reused as is for the pointcut map of the Resource Management concern which is only possible because AoURN clearly separates aspectual properties (i.e., the aspect maps) from the pointcut expressions (i.e., pointcut maps). The start point of the ExecuteMission map is connected to the in-path of the ExecuteMission pointcut stub, the executed end point is connected to the out-path exiting the pointcut stub on the right, and the more missions required/mission failed end point is connected to the out-path exiting the stub at the bottom.
(Pointcut map not shown here since it is the same as Fig. 5) Fig. 9. AoUCM Model for the Resource Management Concern
When the concern is applied, aspect markers are added before the start point and after the end points of the ExecuteMission map and bindings to the Resource Management concern are established (see Fig. 10 — note that the bindings are only shown for illustrative purposes and are not part of AoURN’s concrete syntax; the jUCMNav tool maintains bindings much more effectively). The aspect markers clearly visualize how much the Resource Management concern crosscuts the ExecuteMission map. The insertion of aspect markers results in the following effect. Before the execute start point is reached, the scenario follows the binding to continue on the concern map with requesting resources, possibly substituting internal resources with external resources. If the resource request is successful, the scenario returns to the ExecuteMission map by following the binding. Upon successful execution of the mission, the aspect marker after the executed end point is reached and the scenario follows the binding to continue on the concern map with releasing the resource. If, however, the resource request is not successful, the scenario ends with the failed end point on the concern map which is
38
G. Mussbacher et al.
linked by a binding with the aspect marker after the more missions required/mission failed end point. The scenario, therefore, continues at this aspect marker, skipping the ExecuteResoureMission stub on the ExecuteMission map as desired.
Fig. 10. Aspect Markers and Bindings for the Resource Management Concern
The model in Fig. 10 highlights an omission in the case study document: the handling of failed missions (e.g., when should resources be released). The case study document was treated as a snapshot of the current understanding of the system, rather than a final, contractually binding requirements document. In that sense, the models were built based on the document, reflecting the document as is with all its omissions with the understanding that the models would be reviewed again by the stakeholders. However, care was taken to ensure that the resulting models are consistent and major omissions were documented. Four major issues that should be addressed are a) the system currently assumes that only one witness report is captured per crisis, b) internal and external resources are treated differently, c) helicopter transport missions are only mentioned for transporting resources to the crisis location, but not from the crisis location, and d) it is not specified in detail what happens when missions fail and the resource is already at the crisis location. Issue (a) possibly requires additional steps in Capture Witness Report to connect additional witness reports to an already existing crisis (and possibly take no action if no new information is received). Issue (b) possibly requires external resources to be treated more like internal resources instead of assuming that external resources will always respond to a request within an appropriate time frame. Issue (c) possibly requires another helicopter transport mission to be
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN)
39
created after a resource finished executing its mission and before confirming departure from the crisis location. Issue (d) possibly requires the behavior of each resource to be defined in more detail for the fail case. 4.3.4 Helicopter Transport Mission Concern The Helicopter Transport Mission sub-concern (Fig. 11) of the Coordination concern showcases a) the anything pointcut element and b) composition rules that can interleave two scenarios with each other. The purpose of this sub-concern is to check whether the resource must be transported to the crisis location by helicopter. The check must occur right after the execute start point of the ExecuteMission map. If the helicopter is not required, the scenario simply continues with the ExecuteMission map. If a helicopter is required, then the current mission is put on hold (see wait for helicopter waiting place in Fig. 11) and a helicopter mission is started. The start of the new helicopter mission, however, must be connected to the more missions required/mission failed end point of the ExecuteMission map to fit into the overall flow of the Resolve Crisis use case. Therefore, the Resolve Crisis use case and the Helicopter Transport Mission use case must be interleaved.
Fig. 11. AoUCM Model for the Coordination Concern – Helicopter Transport Mission
This is achieved by matching against the complete path from the execute start point to the more missions required/mission failed end point with anything in between as indicated by the anything pointcut element (.....). The more missions* end point is then connected to the out-path exiting the pointcut stub at the bottom which connects to the start helicopter mission end point, ensuring that these two end points merge into one path. By placing a pair of grey end and start points on the pointcut map, the modeler indicates that the concern may transform elements within the matched pattern at
40
G. Mussbacher et al.
the location indicated by the pair. In the Helicopter Transport Mission case, the grey end point is connected to the out-path exiting the pointcut stub on the right. Therefore, whatever follows on this out-path will occur right after the execute start point and before anything matching against the anything pointcut element. Interleaved composition rules are useful to maintain an overall understanding of the concern. Without interleaved composition, the only alternative is often to split the concern into several smaller, disjoint concerns that add behavior at the various places as required. This makes it difficult to understand what the concern generally wants to achieve. The anything pointcut element, on the other hand, is useful to safeguard against changes to the base model. For example, other concerns could add behavior after the execute start point making it difficult to maintain correct matches if the pointcut expression has to explicitly state the exact match. The remaining concerns required to describe an AoUCM model that is equivalent to the UCM model from Figs. 2 and 3 are rather straightforward and, therefore, only briefly summarized here. The Capture Witness Report sub-concern of the Communication concern ensures that witness reports are captured before the Resolve Crisis use case starts. The Communicate with Resource at Location sub-concern of the Communication concern ensures that a resource confirms arrival at and departure from the crisis location, receives updates while at the crisis location, and submits a final report. Finally, the Super Observer Status Updates sub-concern of the Execute Super Observer Mission use case ensures that the super observer is informed of the creation, successful completion, or failure of a mission initiated by the super observer. 4.4 The Concern Interaction Graph (P7) Whenever several concerns are applied to a model, the possibility exists that concerns may interact with each other in undesired ways. The CCCMS is not an exception. AoURN models the dependencies and conflicts of concerns as well as their resolutions in a specialized GRL goal graph called Concern Interaction Graph (CIG) [24]. The CIG uses GRL links to model dependencies ( ) and conflicts ( ) of concerns. The direction of the link indicates the resolution in terms of a precedence rule, i.e., the target of the link has a higher precedence than the source of the link. Therefore, link targets are applied earlier than link sources to the AoURN model. For example, the CIG in Fig. 12 shows a contribution link between the Recommend Strategies concern and the New Crisis and Mission Info concern. This indicates that there is a conflict between these two concerns and that the resolution of the conflict is to apply the Recommend Strategies concern second. The root of the conflict is that the pointcut maps of both concerns match against the selectMission(s) responsibility (see Figs. 6 and 8). The Recommend Strategies concern adds the recommendMission(s) responsibility before the selectMission(s) responsibility (see Fig. 6), while the New Crisis and Mission Info concern adds (among other elements) an OR-join before the selectMission(s) responsibility (see Fig. 8). If the Recommend Strategies concern is applied first and the New Crisis and Mission Info concern second, the ORjoin will be closer to the selectMission(s) responsibility than the recommendMission(s) responsibility. In this case, the system will not recommend missions when new information becomes available because the OR-join merges into the path after the
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN)
41
recommendMission(s) responsibility. Therefore, the resolution defines that the New Crisis and Mission Info concern must be applied before the Recommend Strategies concern.
Fig. 12. Concern Interaction Graph for the Concerns Mentioned in Section 4.3
Some conflicts of concerns cannot be resolved with an ordering of the concerns, but require changes to one or more concerns. The CIG can model these situations if the changes to the concerns are defined in a separate concern, i.e., a feature interaction concern. In this case, the CIG would show dependencies between the feature interaction concern and the conflicting concerns. If the required changes are made directly in the conflicting concerns, the CIG would not be able to indicate the conflict. In any case, the CIG does not show the constraint that the feature interaction concern has to be applied if the conflicting concerns are applied, since this is best modeled with established feature modeling techniques. Given the ordering of the concerns specified by the CIG, all concerns may now be applied to the AoUCM model. Fig. 13 shows the complete AoUCM model for the Resolve Crisis use case with the automatically added aspect markers for all concerns mentioned in this section. Label CRL of an aspect marker stands for the Communicate with Resource at Location sub-concern, CWR for the Capture Witness Report subconcern, HTM for the Helicopter Transport Mission sub-concern, NCM for the New Crisis and Mission Info sub-concern, RSM for the Resource Management concern, RST for the Recommend Strategies concern, and finally SOS for the Super Observer Status Updates sub-concern.
42
G. Mussbacher et al.
RST NCM
CWR
HTM RSM
NCM
SOS CRL
HTM SOS RSM RSM SOS CRL
Fig. 13. The Resolve Crisis Use Case with the Aspect Markers of All Mentioned Concerns
4.5 Build a Test Suite for the UCM and AoUCM Models (P3) The capability to establish a test suite for the scenario model is one of the analysis features of URN. The test suite consists of a set of standardized scenario definitions [1] organized into scenario groups. Given a scenario definition, the traversal mechanism of the jUCMNav tool highlights the path of the scenario through the UCM model (i.e., the scenario is traversed or executed). Transformations of executed scenarios to message sequence charts are also supported, hence providing a complementary end-to-end visualization of the execution. A prerequisite for this feature is URN’s global data model. For each choice point in the UCM model (including OR-forks and dynamic stubs), Boolean expressions are defined for all alternatives. Boolean expressions may also be defined for start points, thus defining path preconditions. The expressions may contain global Boolean, Integer, and Enumeration scenario variables. A simple action language allows responsibilities to change the value of variables during the traversal of the scenario. Each scenario definition specifies its pre- and postconditions, its start points and expected end points, as well as initial values for the global variables as required. As an example, consider a scenario for the Resource Management concern defined in Fig. 9. The scenario describes the situation where an internal resource is requested
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN)
43
first, but does not accept the request. An external resource is then requested as a substitute, but this request is also denied. The choice points for this scenario are the selection policies of the plug-in maps of the RequestResource(s) stub. Therefore, two Integer variables, NrInternalResources and NrExternalResources are defined, indicating how many resources are requested. The selection policy of the Assign Internal Resource plug-in map is, therefore, NrInternalResources > 0, while the selection policy of the Request External Resource plug-in map is NrExternalResources > 0. In addition, the substituteInternalWithExternalResource responsibility is further formalized with the following code: NrInternalResources = NrInternalResources - 1; NrExternalResources = NrExternalResources + 1;
Two further Boolean variables are required to capture the decisions of the internal and external resources: InternalResourceAccepts and ExternalResourceAccepts. Table 2. Scenario Definition for Resource Management Concern Scenario Definition 1) Start Point Request Resources: request Precondition n/a End Point Request Resources: failed Postcondition NrInternalResources == 0 && NrExternalResources == 1; Initialization NrInternalResources == 1; NrExternalResources == 0; InternalResourceAccepts == false; ExternalResourceAccepts == false; 1)
Note that this scenario definition is a simplified version of the one created for the CCCMS model.
When the scenario definition in Table 2 is executed, the traversal mechanism will traverse the path from the start point request to the dynamic stub and then execute the Assign Internal Resource plug-in map where the request is not accepted. The scenario exits the stub along the out-path with the substituteInternalWithExternalResource responsibility, loops back to the dynamic stub, and now chooses the Request External Resource plug-in map because the substituteInternalWithExternalResource responsibility changed the values of the NrInternalResources and NrExternalResources variables. On the Request External Resource plug-in map, the request is also not accepted and the stub is exited along the out-path leading to the failed end point. The scenario finishes successfully at this end point as its required end points were reached and its postcondition is fulfilled. Scenario definitions can be executed as regression tests whenever there are changes to the model, ensuring greater confidence in the validity and consistency of the scenario models. Recently, scenario definitions have been extended with aspect-oriented concepts [25], allowing not only the specification model, but also the validation model to be organized according to aspect-oriented principles. Current tool support does not yet allow end-to-end scenarios to be defined that involve several concerns in an AoUCM model. However, it is possible to test concerns individually in an AoUCM model as shown in the above example. As proof of concept, about 20 scenario definitions were created for the CCCMS UCM and AoUCM models.
44
G. Mussbacher et al.
4.6 Model Non-functional Concerns with UCM and AoUCM (P4 – Modified) While the functional concerns discussed so far do crosscut each other to a certain extent, non-functional concerns tend to crosscut other concerns on a much larger scale. This is also true for the CCCMS case study. NFR concerns can be thought of as layers that are added to the functional concerns, similar in fashion to placing transparencies with the layout of electrical wiring or plumbing on top of a floor plan of a house. The impact of NFR concerns is often widespread throughout the AoUCM model and often extremely time-consuming and error-prone to model with standard UCM models due to the large number of affected locations that have to be explicitly defined in the UCM models. To ensure consistency between the AoURN and URN models, the UCM models for the non-functional concerns are, therefore, created with the help of the AoUCM models which already identify the affected locations. In some cases, the description of an NFR concern (e.g., in section 2.3 of the case study document) hints at further functionality that is not covered by the use cases later in the document. For example, managing resource and strategy information is mentioned in the Persistence NFR concern. In such cases, the NFR concern is only applied to the functionality described by the existing use cases as no new requirements are to be added to the case study. Therefore, no new base use cases were added based on the NFR descriptions. However, the requirements for an NFR concern do introduce new functionalities for the concern itself (e.g., statistical data needs to be analyzed in the Statistical Logging NFR concern). AoUCM models these functionalities of NFR concerns. To be more precise, AoUCM models the operationalization of NFR concerns, i.e., a particular behavior that ensures the desired characteristics of the NFR concern. The description may be as detailed or abstract as required, reflecting how much is known about the NFR concern at the time the model is built. As the case study document does not address the behavioral aspect of NFR concerns at all, the AoUCM description of the NFR concerns is kept as abstract as possible to minimize the introduction of new requirements. Furthermore, the goal models discussed in section 4.7 make it even clearer that an operationalization described with AoUCM models is only one option out of many. The Availability NFR concern in Fig. 14 describes, in a very abstract way, redundancy as a means to achieve availability. Each responsibility of the system is shadowed in parallel by the backup system. The Availability NFR concern makes use of a variable (indicated by a $, e.g., $Task). Variables are defined on the pointcut map and can then be reused on the aspect map, thus allowing existing model elements that are matched by the pointcut map to be reused in aspects. As usual, aspect markers are added to the AoUCM model for each match of the pointcut map in the AoUCM model and then linked to the AoView of the Availability NFR concern. In this AoView, the variable $Task is replaced by the actual match. For example, when the responsibility assignEmergencyLevel from Fig. 4 is matched, the AoView of this match shows the assignEmergencyLevel responsibility instead of the $Task responsibility in the Backup System. Note that the pointcut map matches against any system responsibility. Clearly, this is an NFR concern with a very significant impact on the AoUCM model.
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN)
45
Fig. 14. AoUCM Model for the Availability Concern
In addition to the path with the pointcut stub, the aspect map of the Availability NFR concern also defines with a separate path what happens if the primary system fails. This is concern-specific behavior that is described at a very high level of abstraction. It could have also been described on a separate map without changing the meaning of the AoUCM model.
P
Fig. 15. AoUCM Model for the Mobility Concern – Infrastructure
46
G. Mussbacher et al.
The Infrastructure sub-concern of the Mobility NFR concern in Fig. 15 is another example of a concern with wide-reaching impact. In addition, this NFR concern demonstrates the usage of the replacement pointcut stub ( P ), a special kind of pointcut stub indicating that the concern is replacing the matched base elements. Furthermore, two patterns are described for the Infrastructure concern with the help of two pointcut maps that are both plugged into the pointcut stub on the aspect map. The first pattern captures all interactions between the system and a number of mobile actors where the system is the sender. The second pattern captures a similar situation but with the system as the receiver. The NFR concern then replaces the matched pattern (i.e., the sender and receiver components) with the behavior specified on the aspect (i.e., the sender and receiver are added back again but this time with the GSM Antenna functionality in the middle). When the Infrastructure concern is applied, aspect markers are again added to the AoUCM model. However, different symbols are used for aspect markers to immediately indicate the replacement to the modeler. The tunnel entrance aspect marker ( ) denotes the beginning of a replacement and the tunnel exit aspect marker ( ) denotes the end of a replacement (the concern may be thought of as a tunnel through the AoUCM model that circumvents the original behavior). In terms of the bindings to AoViews that are established for these markers, tunnel entrance aspect markers only have bindings to AoViews, while tunnel exit aspect markers only have bindings from AoViews (see Fig. 16). The pointcut expression of the Infrastructure concern is matched three times on the ExecuteMission map shown in Fig. 16 as indicated by the three pairs of tunnel entrance and exit aspect markers. For the top pair, the System and Resource were matched against $Sender and $Receiver, respectively, by the first pointcut map in Fig. 15. The AoView at the bottom of Fig. 16 clearly indicates this by replacing $Sender with System and $Receiver with Resource in the aspect map. For the other two pairs of aspect markers, Resource was matched against $Sender and System was matched against $Receiver.
System
Resource
P Fig. 16. Aspect Markers and Bindings for the Mobility Concern – Infrastructure
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN)
47
The last NFR concern to be discussed for AoUCM in this paper is the Weather Information System sub-concern of the Safety NFR concern in Fig. 17. Its purpose is to monitor the weather and determine if a safety perimeter is required for the crisis location. This is an ongoing activity throughout the crisis. Therefore, the monitoring starts at the time the crisis status is set to active. It ends when the crisis has been resolved. Similar to the Helicopter Transport Mission concern from Fig. 11, a path from the setCrisisStatusActive responsibility to the resolved end point is matched with the help of the anything pointcut element. An AND-fork before the pointcut stub on the aspect map spawns the parallel behavior of the NFR concern (i.e., just before the setCrisisStatusActive responsibility at the beginning of a crisis). A second AND-fork provides new weather information on one branch and on the second branch sets a timer which ensures that the weather is checked periodically. When a timeout occurs, the scenario loops back, thus providing more weather information and setting the timer again. This continues until the timer is deactivated by the out-path of the pointcut stub which is connected to the resolved end point (i.e., it is deactivated after the resolved end point is reached at the end of the crisis).
Fig. 17. AoUCM Model for the Safety Concern – Weather Information System
4.7 Model Stakeholder Concerns with GRL and AoGRL (P5 – Modified) The objectives of the CCCMS and the high-level goals associated with the NFRs in the case study document were first modeled in GRL and AoGRL models that focus on the dependencies between stakeholders. The result of this analysis is shown for GRL in Fig. 18. A GRL model consists of intentional elements (e.g., softgoals ( , e.g., Handle incident efficiently), hard goals ( , e.g., Report incident), and tasks ( , e.g., Resolve Crisis in Fig. 19)) connected together with different types of links (note that not all link types are discussed here since they are not needed for the examples presented in this section). Intentional elements may be assigned to stakeholders called , e.g., Coordinator). Contribution links (→) indicate positive (+) or negaactors ( tive (–) impact of intentional elements on each other. A dot above a + or – indicates that the contribution is sufficient whereas a dot below a + or – indicates that it is not. Dependency links ( ) describe how a source element depends on a target element. Often, a modeler will use two consecutive dependency links to indicate that the initial source element (depender) depends on the second target element (dependee) for the middle element (dependum).
48
G. Mussbacher et al.
In addition to the dependencies, Fig. 18 shows the goal model of the Coordinator stakeholder in more detail. In general, the Government, the Resource, and the General Public depend on the Coordinator for improving customer QoS metrics, for mission requests that allow a resource to handle an incident efficiently, and for receiving appropriate help in a timely fashion, respectively. The General Public also depends on the Resource to do its job, while the Coordinator depends on the Resource to provide updates about its status and location and on the General Public to report the incident in the first place.
Fig. 18. GRL Model for Stakeholder Dependencies
The AoGRL version of the GRL model in Fig. 18 simply separates each stakeholder into its own goal graph, repeating each dependum as required. This is a case where aspect-oriented thinking provides guidance on how to structure the views of the goal model, even though aspect-oriented techniques are not required to achieve this. Standard separation of concerns with basic GRL modeling is sufficient. The GRL goal model in Fig. 19 illustrates the impact of all functional concerns (i.e., use cases) on the stakeholder goal graphs. Typically, tasks model solutions that impact positively or negatively some of the goals specified for one or more stakeholders. The solutions may then be described in more detail with UCM models as is the case here (e.g., the general Resolve Crisis task corresponds to the detailed Resolve Crisis use case map). Similar to before, the AoGRL model splits the single goal graph into individual AoGRL goal graphs — one for each functional concern. However, this is not a oneto-one transformation, because the tangling that exists in the UCM model has been carried over into the GRL model. For example, the Resolve Crisis task has an impact on the Select the right missions based on past experience goal only because the
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN)
49
recommendMission(s) responsibility is part of the Resolve Crisis use case map in the
UCM model. In the AoUCM model, however, this has been factored out into the Recommend Strategies concern. Therefore, the impact on the Select the right missions based on past experience goal is shown on the Recommend Strategies AoGRL goal graph, but not on the Resolve Crisis AoGRL goal graph.
Fig. 19. GRL Model for Impact of Use Cases on Stakeholders
Finally, the NFR concerns are also modeled with GRL and AoGRL. As an example, the Availability NFR concern is shown in Fig. 20 for GRL and in Fig. 21 for AoGRL. The two models are equivalent in terms of content, but are structured very differently. In both cases, the availability requirement 2hrs of downtime every 30 days, failure recovery within 30sec must first be discovered in the case study document. Then, it was decided which goals of which stakeholders are affected by this requirement. Fig. 20 shows that the Government and the General Public have an interest in this requirement and therefore the Availability NFR concern. Because the Government and the General Public depend on the Coordinator and the Resource (see Fig. 18), the availability requirements also depend on the Availability softgoals of the Coordinator and the Resource. This is modeled by the dependencies between the availability requirement and the Availability softgoals. Last but not least, one has to consider not only the stakeholders, but also the functional concerns. Any functional concern that has an impact on the Coordinator or the Resource now also depends on the Availability softgoal. In other words, a functional concern cannot be considered achieved, if availability for the functional concern is not provided for the stakeholder. Therefore, the dependency links are established between the tasks and the Availability softgoals.
50
G. Mussbacher et al.
Fig. 20. GRL Model for Availability NFR Concern
P
P
P P P
P P
P
P
P
Fig. 21. AoGRL Model for Availability NFR Concern
AoGRL uses a different approach than AoUCM in terms of modeling the properties of a concern, the pattern that needs to be matched, and the composition rules. Owing to the highly interconnected nature of goal models, everything is modeled on one goal graph called the pointcut graph. AoGRL makes use of pointcut markers ( P ) and pointcut deletion markers (±) to indicate the pattern to be matched. All elements
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN)
51
without pointcut markers are added to the matched location in the GRL base model, while elements with a pointcut deletion marker are removed. The composition rule is, therefore, defined by the set of links between elements without markers and elements with markers. The AoGRL version of the Availability NFR concern rather describes the reasons behind the dependencies that were established explicitly in Fig. 20 by the standard GRL approach. The pattern in Fig. 21 states that dependencies (the ones without markers) should be added to the model as long as there exists a dependency from a stakeholder interested in the availability requirement (shown on the right of Fig. 21) to another stakeholder (shown on the left in Fig. 21). In this case, the Availability softgoal is added to the stakeholder on the left and dependencies are established to the stakeholder on the right and any tasks that impact the stakeholder on the left. The top part of the pointcut expression in Fig. 21 therefore matches against the Government stakeholder with the Improved customer QoS metrics goal and the General Public stakeholder with the Receive appropriate help in case of an incident in a timely fashion softgoal, because dependencies exist from these two intentional elements to other stakeholders (i.e., to Coordinator and Resource). Hence, the 2hrs of downtime every 30 days, failure recovery within 30sec softgoal is added to the Government and General Public stakeholders, the Availability softgoal is added to Coordinator and Resource stakeholders, and dependencies are added between these two softgoals. Furthermore, all tasks contributing to an intentional element in the Coordinator and Resource stakeholders now also depend on the Availability softgoal (e.g., the Capture Witness Report task and the Super Observer Mission task). Note that the <> keyword indicates that the pattern may match against any type of intentional element and not only the one shown on the goal graph. While the pointcut expression shown in Fig. 21 is very general as it uses several pointcut elements with a *, it may be further restricted as needed by replacing the * with more specific expressions. For example, the pointcut expression could be restricted to specific tasks or to specific intentional elements in the left actor in Fig. 21 or to a specific dependum. If required, the Availability goal of the concern can be further refined on one or more separate goal graphs of the concern. These goal graphs are called aspect graphs and may show alternative, ideally generic solutions for achieving availability. For example, the redundancy solution described in the AoUCM model is shown on such an aspect graph (see complete models posted online). 4.8 Evaluate Stakeholder Concerns (P6) Two strategies were created, one for the existing system and one for the new system, in order to evaluate the GRL and AoGRL models. Because the case study document lacked detailed information regarding the existing system and the alternatives for a new system, this exercise proved to be rather arbitrary and is, consequently, not further reported on. The reader interested in more information about strategies is referred to [1, 17]. It should also be pointed out that there is no tool support available for evaluations of AoGRL models. AoGRL models have to be first composed into a standard GRL model and then evaluated with the standard evaluation mechanism.
52
G. Mussbacher et al.
5 Comparison of URN and AoURN The comparison of URN and AoURN is based on the models described in section 4. For the AoUCM model, the models described in section 4.3 and section 4.6 are used. For the UCM model, the original model for the functional concerns described in section 4.2 is used. In addition, the UCM model for NFR concerns is derived by transforming the AoUCM model of the NFR concerns into a standard UCM model as motivated in section 4.6. Technically, this is achieved by a two-step transformation process. First, stubs are explicitly placed at each location where an aspect marker would be added by the AoUCM approach. The aspect maps are also transformed into standard UCMs by removing all pointcut stubs. New start points have to be added at the beginning of the pointcut stubs’ out-paths and new end points at the end of the pointcut stubs’ in-paths — creating several, possibly disjoint paths on the transformed aspect maps. Bindings are then established between the explicitly added stubs and the start and end points on the transformed aspect maps. If an NFR concern makes use of variables on the aspect map, the aspect map is different for each aspect marker as the variable is replaced by the matched base elements. It is not pragmatic considering the effort required to create different plug-in maps in the UCM model — one for each stub that was added for an aspect marker — because some NFR concerns with variables add more than 50 aspect markers to the model. Instead, parameters are defined for each stub replacing an aspect marker. The parameters are then passed into the stub’s plug-in map and determine the actual values of the variables. This approach is supported by URN’s extensions mechanism based on metadata. Therefore, a single plug-in map can still be used, avoiding an explosion of model elements and maps in the UCM model. Second, to further ensure the correctness and consistency of the AoUCM and UCM models, the UCM model is then carefully inspected for any locations that should not have been affected by NFR concerns and for locations that are affected, but were missed in the UCM models. The transformation explained above ensures minimum impact on the maps in the UCM model that are affected by an NFR concern, while also ensuring maximum modularity/reusability as the maps for the NFR concerns are reused by several stubs. In addition, the size of the model remains minimal. It is thus a very appropriate candidate model to be compared with AoUCM. The resulting UCM model is consistent with the AoUCM model in terms of content, but it is also the most efficient model that could have been created by a modeler even without any aspect-oriented knowledge. The alternative approach is to explicitly add the behavior of an NFR concerns into the maps affected by the NFR concern. Again, this is not feasible given that the NFR concerns Availability, Mobility, Persistence, and Security together are applied more than 250 times in the model. The comparison of GRL and AoGRL is based on the models described in section 4.7. 5.1 Metrics-Based Evaluation The evaluation of the AoURN and URN models is carried out based on metrics for modularity, reusability, and maintainability of aspect-oriented software available in
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN)
53
literature [11]. The metrics are adapted for the use in URN and AoURN models by mapping the notion of component, operation, and line of code in [11] to URN and AoURN model elements as explained in Table 3. As the metrics are merely adapted, the quality model still applies to this evaluation. The quality model links the metrics to the qualities of interest and is established in [11] with the help of Basili’s GoalQuestion-Metric (GQM) methodology [26]. Although the metrics in [11] were established to assess aspect-oriented implementations at the programming level, they do also apply to the modeling level as the difference is mainly a matter of abstraction. The concepts used for the original metrics are components, operations, and lines of code (LOC) and hence rather programmingcentric. However, these programming-centric concepts relate to much larger concepts generally applicable to all modeling levels: containers, behavioral units, and elementary units. The mapping from the original programming-centric concepts to AoURN and URN concepts retains these generally applicable concepts. Goal graphs and use case maps are containers of goals trees and scenario paths, the behavioral units of GRL and UCM models are described by intentional elements and responsibilities/stubs, respectively, and any modeling element may be considered an elementary unit. Therefore, the general structure that is assessed by the metrics from [11] at the programming level also exists in AoURN and URN models, allowing us to apply the metrics at a different abstraction level. Table 3. Mapping for the Adapted Metrics Notion from [11] Component Operation LOC 1)
URN/AoURN Model Elements Model Unit (MU) goal graph, use case map Key Model Element intentional element, responsibility, stub (KME) (including references) any visual URN/AoURN model element Model Element (ME) (including references and concerns) 1)
Direction arrows and empty points are not counted.
The definition of each metric is summarized in Table 4. In general, the lower the result of a metric, the better it is. The metrics in group A measure the identified concerns, the metrics in groups B and C measure the model units (i.e., goal graphs and use case maps), while the metrics in group D measure the whole model. As an example for the metrics calculation and illustration of the advantages of AoUCM over UCM, the Resolve Crisis UCM model is presented in Fig. 22. The corresponding AoUCM model is shown in Fig. 4. The stubs in the Resolve Crisis UCM model address all modeled NFR concerns. Label AV of a stub stands for Availability, PE for Persistence, CAM for Criminal Activity Monitoring System, EM for Emission Monitoring System, WI for Weather Information System, AU for Authentication, EE for Encryption (Encrypt), ED for Encryption (Decrypt), and finally ST for Statistic Logging.
54
G. Mussbacher et al. Table 4. Definition of Metrics
A) Separation of concerns metrics [Measures concerns] CDMU (Concern Diffusion over Model Units) Count the number of MUs whose main purpose is to contribute to a concern plus all other MUs that reference them. CDKME (Concern Diffusion over Key Model Elements) Count the number of KMEs whose main purpose is to contribute to a concern. CDME (Concern Diffusion over Model Elements) Count the number of concern switches from a concern to other concerns in each MU. B) Coupling metrics [Measures model units] CBMU (Coupling between Model Units) Count the number of other MUs on which an MU depends. C) Cohesion metrics [Measures model units] LCOKME (Lack of Cohesion in Key Model Elements) Count the number of KMEs in an MU that do not contribute to the MU’s main concern. D) Size metrics [Measures the model] VS (Vocabulary Size) Count the number of MUs and concerns in the model. NME (Number of Model Elements) Count the number of MEs in the model. AvNME (Average Number of Model Elements) Calculate the average number of MEs per goal graph and UCM in the model.
For the CDMU metric, the UCM model in Fig. 22 counts towards the Resolve Crisis concern and also towards each of the eight NFR concerns represented by stubs, because the stubs reference the main maps of these concerns. The AoUCM model in Fig. 4 only counts towards the Resolve Crisis concern. Therefore, the score is 1 for AoUCM and 9 for UCM. For the CDKME metric, the UCM model must count all 34 stubs that are added because of the NFR concerns. Therefore, the score is 0 for AoUCM and 34 for UCM. For the CDME metric, 75 concern switches exist in the UCM model while no concern switch exists for the AoUCM model. Therefore, the score is 0 for AoUCM and 75 for UCM. For the CBMU metric, all plug-in maps have to be counted. For UCM, there is one in CaptureWitnessReport, two in ExecuteMission, plus the eight NFR concerns. For AoUCM, there are the two in ExecuteMission. Therefore, the score is 2 for AoUCM and 11 for UCM. For the LCOKME metric, all 34 stubs of the NFR concerns, the CaptureWitnessReport stub, the recommendMission(s) responsibility, and the assessNewCrisisAndMissionInfo responsibility must be counted. For AoUCM, the count is zero. Therefore, the score is 0 for AoUCM and 37 for UCM. For the VS metric, all concerns as well as the pointcut maps must be counted for the AoUCM model, but do not have to be counted for the UCM model since they do not exist in the latter model. The use case map must be counted in both cases. Therefore, the score is 2 for AoUCM and 1 for UCM. Note that the Resolve Crisis concern does not have a pointcut map because it is deemed to be the base. The other concerns in the complete AoUCM model, however, have at least one and as many as four pointcut maps.
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN)
55
For the NME metric, the concerns have to be counted for the AoUCM model while the stubs added by the NFR concerns have to be counted for the UCM model. In addition, all other N model elements shown in Figs. 4 and 22 also have to be counted. However, the counts of these model elements even out because all model elements are used on some map in both complete models. Therefore, the score is 1+N for AoUCM and 34+N for UCM. Finally, the AvNME metric divides the NME metric by the number of goal graphs and use case maps in the system. It is, therefore, meaningless to compute this metric for only one use case map.
CaptureWitnessReport
EE
ST AV
PE
ED
PE
ST
AU ED
EE AU
AU EE ED PE
EE
AU
ED ExecuteMission (repFactor=#Missions)
ED
EE AU
AV PE
AV PE AV
PE
EE
ED
ST CAM EM WI
AU
Fig. 22. UCM Model for the Resolve Crisis Use Case with All NFR Concerns Considered
The assessment of the GRL and AoGRL models is done in an analogous way to the above example. The overall results of the metrics assessment are shown in Tables 5 and 6 with the better result shown with a grey background. The coupling and cohesion metrics (CBMU, LCOKME) are significantly better for AoURN than for URN as are the separation of concern metrics (CDMU, CDKME, CDME). In short, AoURN outperforms URN for all metrics except the Vocabulary Size (VS).
56
G. Mussbacher et al.
The AoURN-based approach introduces new modeling elements (i.e., concerns, pointcut maps, and pointcut graphs), into the model, explaining the difference in the results of the VS metric. The concerns, however, are used to group the AoURN model into more manageable sub-models, which each contain a very small number of diagrams. Furthermore, the VS metric result is offset by the better results of AoURN for the Number of Model Elements (NME) metric and the Average Number of Model Elements (AvNME) metric. Essentially, the AoURN model is generally smaller, with less complex diagrams than the URN model. AvNME has been reduced by a factor of three for AoURN models as compared to URN models. Moreover, concerns are encapsulated in AoURN models to a greater extent than in URN models as demonstrated by the separation of concerns, coupling, and cohesion metrics. Therefore, the results of VS do not allow concluding that URN is a better approach than AoURN. Table 5. Results of the Separation of Concerns Metrics
Functional Concerns NFR Concerns Stakeholder Concerns Total
CDMU
UCM CDKME
CDME
CDMU
AoUCM CDKME
CDME
25
123
179
41
125
29
112
316
691
31
58
9
n/a
n/a
n/a
n/a
n/a
n/a
137
439
870
72
183
38
CDMU
GRL CDKME
CDME
CDMU
AoGRL CDKME
CDME
0
28
20
21
20
10
11
46
6
6
40
0
13
4
45
11
Functional Concerns NFR Concerns Stakeholder Concerns Total
3
58
14
132
39
31
105
21
Grand Total
151
571
909
103
288
59
Table 6. Results of the Coupling, Cohesion, and Size Metrics
UCM GRL Total – URN AoUCM AoGRL Total – AoURN
CBMU 110 8 118
LCOKME 378 34 412
VS 29 7 36
NME 749 187 936
AvNME 26 27 27
45 13 58
6 14 20
90 39 129
594 206 800
9 11 9
AoURN clearly outperforms URN for NFR concerns. Interestingly, when focusing on the functional concerns alone (Table 5), the Separation of Concern metrics CDMU and CDKME are slightly better for UCM models than for AoUCM models. The
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN)
57
difference for the CDKME metric is insignificant. The results of the CDMU metrics can be explained by the fact that the CDMU metric for a model with only one model unit (i.e., only one huge goal graph or one huge use case map) has the lowest possible score. It has to be considered in conjunction with the CDME metric which measures tangling. Because the CDME metric is significantly higher for URN models than for AoURN models, it can be concluded that AoURN still performs better than URN. The same reasoning applies to the CDMU metrics that are better for GRL as compared to AoGRL and the slightly lower CBMU value for GRL as compared to AoGRL. AoGRL splits the single GRL graph which describes the impact of the functional concerns on the stakeholder goals into individual graphs — one for each functional concern. This introduces coupling to the stakeholder concerns from many functional concern graphs. However, a single goal graph for capturing this impact is not feasible for larger systems, as demonstrated again by the CDME metric. The slightly lower count for NME can also be explained by the single GRL goal graph being split into many for the AoGRL model. This introduces many duplicated modeling elements. However, the resulting goal graphs are much smaller as evidenced by the AvNME metric. Therefore, the difference in the NME metric is not significant. 5.2 Task-Based Evaluation In addition to the metrics, the most common update tasks were considered for URN and AoURN models. These update tasks cover adding, removing, or changing a use case, NFR, or stakeholder. As examples for such update tasks, consider the omissions stated at the end of section 4.3.3. Each use case, NFR, and stakeholder defined in the URN model and AoURN model is considered individually and a worst-case analysis is performed, i.e., those use case maps and goal graphs in the model are counted that may have to be updated due to changes in the requirements document. Finally, the counts are averaged over the number of use cases, NFRs, and stakeholders to be able to compare all three categories and the models with each other. Note that the set of use cases is slightly different for URN and AoURN models, because the aspect-oriented analysis of the use cases in the case study document resulted in a restructuring of the use cases. Therefore, updates to the original use cases are investigated for the URN model, while updates to the restructured use cases are investigated for the AoURN model. In contrast to the use cases, NFRs and stakeholders remain the same for both models. There is a section for each NFR in the nonaspect-oriented case study document and a concern for each NFR in the AoURN model (the URN model reflects the case study document). Similarly, each stakeholder is described in the non-aspect-oriented case study document and a concern exists for each stakeholder in the AoURN model. Table 7 shows the results of the task-based evaluation with the better result shown with a grey background. In general, the difference for updates to use cases is insignificant. Furthermore, there is a difference for updates to stakeholders which can be explained by the huge goal graphs in the URN model. The URN model contains one huge goal graph for all stakeholders and another one for all use cases, while the AoURN model breaks these two goal graphs into several individual ones for each stakeholder and each use case. Consequently, an update of a stakeholder in the
58
G. Mussbacher et al.
AoURN model may affect more goal graphs than an update in the URN model. This is a trade-off against huge goal graphs which are difficult to maintain and very quickly become unwieldy. Table 7. Results of the Task-Based Evaluation of URN and AoURN Models (Average Number of Diagrams Needing Modifications per Update Task)
URN AoURN
Use Cases 4.11 3.85
NFRs 9.83 3.33
Stakeholders 3.50 6.00
Total 6.76 3.93
Finally, there is a significant difference for the updates of NFRs. The results of the task-based evaluation nicely indicate the amount of crosscutting that occurs for the use cases and NFRs. The results for use cases are not very different because only some crosscutting occurs for use cases. In this situation, the traditional URN model and the AoURN model with its strict encapsulation of anything related to a particular use case (or feature) perform similarly. NFRs, however, crosscut other concerns very broadly and are, therefore, prime candidates for aspect-oriented modeling. The results of the task-based evaluation reflect this. When updating an NFR in the URN model, the goal graphs and use case maps for the NFR require updating. Then, all locations requiring changes in the stakeholder goal graphs, as well as the goal graphs and use case maps of other use cases and NFRs must be found and also changed. For use cases and stakeholders, the updates are more localized than for NFRs, but generally the changes are distributed over many different goal graphs and use case maps. For AoURN models, on the other hand, the update tasks require changes in the aspect graphs, aspect maps, pointcut graphs, and pointcut maps of one single concern (either the one encapsulating the use case, the NFR, or the stakeholder). Even though these updates may affect several use case maps and goal graphs, they are all generally localized to one group of use case maps and goal graphs contained in one concern. There is, however, one notable exception. Changes in the AoURN model may impact the matches of the pointcut expressions defined for concerns in the AoURN model. Hence, the pointcut expressions may also have to be changed. With tool support, the changes in the matches may be monitored and reviewed, ensuring that the desired locations in the AoURN model are stilled matched correctly. It is difficult to quantify the importance of the updates required for pointcut models due to changes in requirements. Good tool support is certainly required. The trade-off here is between changing crosscutting concerns in non-aspect-oriented models and keeping pointcut expressions up-to-date when aspect-oriented models change. We argue that the latter provides greater overall benefits. First, the non-aspect-oriented model does not indicate where the crosscutting occurs, therefore requiring the locations to be found before they can be changed. This is a very error-prone task. Second, the aspect-oriented model allows one to reason about the composition of a crosscutting concern as it is explicitly modeled. This enables, for example, changes in the number and location of pointcut matches to be brought to the attention of the modeler.
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN)
59
5.3 Summary Overall, the results suggest that the case study’s AoURN model exhibits better modularity, reusability, and maintainability than the URN models. In general, the complexity of stakeholder goal graphs in GRL models is traded against the complexity of pointcut graphs in AoGRL. Similarly, the complexity of use case maps for use cases or NFRs is also traded against the complexity of pointcut maps. Although pointcut expressions may be complex, they allow the complexity to be localized and are, therefore, more maintainable without hindering reusability. The larger the impact of a concern, i.e., the more crosscutting a concern is, the more pronounced are the positive results of the metrics assessment for AoURN models as compared to URN models. This can be clearly observed for NFR concerns. The more a concern crosscuts the URN model, the more AoURN can reduce the complexity of model units without necessarily requiring increasingly complex pointcut expressions. For scalability, we argue that the following five points suggest that AoURN models are more scalable than URN models: a) the reduced complexity of goal graphs and use case maps (see NME and AvNME results), b) the ability to group goal graphs and use case maps with concerns, c) the encapsulation provided by concerns, d) the ability to use parameterized pointcut expressions and variables in AoURN, and e) the simpler update tasks for AoURN. The results of the assessment of the CCCMS models confirm an earlier validation effort [12] which, even though much smaller in scope, exhibited the same characteristics and trends as seen in this assessment. In general, it proved to be possible to model all use cases, NFRs, and stakeholders in an aspect-oriented way with AoURN. As long as behavior can be specified for a concern, it can be modeled and encapsulated with AoUCM and applied to the rest of the model with aspect-oriented techniques. Even if behavior cannot be specified for a concern, it is still possible to capture the reasoning about the concern with AoGRL, encapsulate it in a concern, and apply it to the overall goal model. At some later stage when more of the behavior is known for the concern, the AoGRL goal model of the concern may then be refined into an AoUCM scenario model. In terms of threats to the validity of the performed assessment, a threat to internal validity is how the concerns were derived from the case study document. AoURN is not a technique that focuses on the detection of concerns. The decision to follow the general guidelines of considering use cases, NFRs, and stakeholders as concerns may have introduced bias into the assessment. However, the most pronounced results were observed for the various NFR concerns and those highly crosscutting concerns were already identified by distinct sections in the case study document. Furthermore, bias may have been introduced due to the highly experienced URN and AoURN modelers. The experience level combined with the facts that a) URN and AoURN models had to be consistent and b) the content of the case study document and hence the content of the models were not to be altered make it almost certain that the best possible URN and AoURN models were created. However, the resulting
60
G. Mussbacher et al.
models may not reflect what less experienced modelers may have produced. Because AoURN arguably requires more training than URN, there is a greater possibility that less-experienced modelers may produce AoURN models of lesser quality than URN models. This may cause the results to be less pronounced. The risk that highly experienced modelers may inadvertently introduce bias into the assessment is balanced to a certain extent by the exhaustive approach to the taskbased evaluation, since changes in each concern were investigated. In terms of external validity, the CCCMS is a safety-critical application and it could be argued that the obtained results do not apply to other types of systems such as enterprise information systems. This threat is somewhat mitigated by an earlier validation effort [12] which targeted a different system type. Nevertheless, a case study with less detailed and less well-specified information may lead to more divergent URN and AoURN models and possibly to different results. In terms of the actual techniques for AoURN, the case study highlighted the need for tailored, individual techniques for AoGRL and AoUCM. The fundamental differences in the structure of goal models and scenario models do not allow the same technique to be used effectively for both types of models. The highly interconnected nature of goal models makes it more amendable to a graph-transformation-like approach, where aspectual properties and pointcut expressions are specified on the same diagram. On the other hand, AoUCM separates aspectual properties and pointcut expressions into two distinct diagrams for reusability reasons. In the CCCMS case study, pointcut expressions were indeed reused by different concerns. This separation is possible for AoUCM, because scenario models are much more structured than goal models. It remains to be seen whether aspect-oriented techniques in general are applicable to goal models at the very early stages of requirements engineering. During this stage, the needs and dependencies of stakeholders are typically captured in a highly unstructured, inconsistent model. For these cases, a simple tagging mechanism (which is supported by the AoURN metamodel) may be more effective to identify and track concerns. In later stages, however, it is useful to organize goal models in an aspectoriented manner, as the impact of solutions (i.e., scenarios) should be clearly separated from the rationale and decisions captured in the goal graphs of the stakeholders. In these stages, aspect-oriented thinking provides important guidance in how to structure goal models. In some cases, the pointcut expressions required to encapsulate a concern with AoUCM can become quite complex. This is particularly true for concerns that require data-centric pointcut expressions, such as the persistence NFR concern. Because the URN and AoURN frameworks do not contain sophisticated domain modeling capabilities, it is not possible to exploit type information of domain concepts or domain concept hierarchies when specifying pointcut expressions. Instead, concepts often have to be matched explicitly by enumerating all options. This quickly becomes quite cumbersome as experienced by modeling the persistence NFR concern with AoURN in the case study. While it is possible to model data-centric concerns with AoURN, they are better served by techniques that have access to proper domain modeling facilities. On the other hand, many concerns have very generic pointcut expressions that can be reused across application domains and are very resistant against changes to the base model. Many NFR concerns fall into this category (see Figs. 14 and 15).
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN)
61
Finally, a crucial piece of the aspect-oriented modeling puzzle is the ability to deal with interactions between concerns. An aspect-oriented CCCMS model cannot be fully specified with techniques that cannot specify resolutions to concern dependencies and conflicts. AoURN’s Concern Interaction Graph (CIG) deals with such interactions.
6 Comparison of Aspect-Oriented Techniques for Scenario-Based and Goal-Oriented Requirements Engineering The qualitative comparison of aspect-oriented techniques for scenario-based and goaloriented requirements engineering builds on earlier assessments [12, 27]. As qualitative factors are available for the scenario part, they are being used to support the assessment in section 6.1, whereas section 6.2 includes a simpler discussion of work related to the goal part. 6.1 Comparison with Other Scenario-Based Techniques for AORE The assessment of scenario-based modeling techniques for aspect-oriented requirements engineering is based on a set of qualitative factors: • Exhaustive Composition: the ability of the AO-technique to express all required concern compositions, i.e., how limited is the usage of all modeling language constructs for composition purposes? • Scalability: the AO technique should scale to large industrial models. • Familiarity: the AO technique should employ a modeling notation that is familiar to requirements engineers to ease adoption of the technique; extensive switches should be avoided (e.g., between graphical and purely textual representations). • Formality: the AO technique should be as formal as possible without becoming a barrier in practice. • At the right abstraction level: the AO technique should be at the right abstraction level for requirements engineering, i.e., message or data details of interactions are not yet relevant. • Semantics vs. syntax: the AO technique should take semantics of the modeling notation into account when composing concern models. • Handling of interactions: the AO technique should be able to specify dependencies and conflicts between concerns and their resolutions. • Visualization of composition: the AO technique should not require complex layout issues to be resolved to visualize the composed model. • Obliviousness: a composition technique should allow concerns to be defined without changes to other concerns. Obliviousness is one of the original tenants of aspect-orientation, but has since come under scrutiny as annotation-based or interface-based techniques have become popular. However, in general, a concern must not be heavily polluted by non-concern-specific information. Several popular AORE approaches have been proposed for scenarios. In AspectOriented Software Development (AOSD) with Use Cases [28], Jacobson and Ng view
62
G. Mussbacher et al.
a well written use case as a concern. They add the notion of pointcuts to the traditional use case approach. Pointcuts in one use case reference extension points in other use cases in a textual way. In addition to the traditional application use cases, they introduce new kinds of use cases, the infrastructure use case, to describe scenarios required to address non-functional requirements, and the perform transaction use case, to describe all possible types of interactions an actor may have with the system. Infrastructure use cases reference pointcuts in the perform transaction use case which is eventually mapped to application use cases. This composition of concerns, however, is limited to extension use cases during use case modeling and to AspectJ-like constructs (before/after/around) in later phases. In Scenario Modeling with Aspects [29], Whittle and Araújo use UML sequence diagrams to describe non-aspectual scenarios and sequence-diagram-like interaction pattern specifications (IPS) to describe aspectual scenarios. IPS define roles for classifiers, messages, and parameters which can be bound to elements in other sequence diagrams to create a composed system, which is then translated into state machines for validation. Alternatively, the sequence diagrams and IPS are first both translated into state machine representations (finite state machines and state machine pattern specifications (SMPS), respectively) and then composed together at the state machine level [30]. In both cases, the binding is specified textually and identifies explicitly elements to be bound. On one hand, this allows for a very flexible composition that is as expressive as the modeling language itself. On the other hand however, explicit bindings do not scale as well as parameterized bindings since each binding must be specified individually. In the Aspectual Use Case Driven Approach, Moreira et al. [31, 32] propose to add extensions to UML use case and sequence diagrams to visualize how crosscutting nonfunctional requirements (captured with templates) are linked to functional requirements expressed by use case diagrams or sequence diagrams. In [33], they extend the set of use case relationships to include “constrain”, “collaborate”, and “damage” while making use of activity pattern specifications (APS). The new relationships describe how one use case impacts another (restricting it, contributing positively to it, or contributing negatively to it). APS extend UML activity diagrams by allowing the specification of roles similar to IPS [29] and SMPS [30]. Various activity diagrams are composed by composition rules which are similar to the binding in [29, 30]. Barros and Gomes [34] apply aspect orientation to UML activity diagrams. The approach is based on an additional composition operation called activity addition which allows the fusing of stereotyped nodes in one activity diagram with nodes in another. Stereotyping is effectively used as a pointcut expression, identifying explicitly nodes in another activity diagram for behavior merging. Whittle et al. [35] propose a metamodel-based aspect composition technique (MATA) that uses graph transformation formalisms. This approach can be applied to any model for which a metamodel has been defined, including UML state diagrams and sequence diagrams, for which tools and examples have been developed. Other generic weaving techniques that function on any metamodel are GeKo [36] and Kompose [37]. de Bruin and van Vliet [38] describe a UCM-based approach that allows behavior and structure to be refined with additional pre/post-processing in a top-down approach. Stubs are added either before or after the location to be changed to achieve the desired effect.
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN)
63
The above techniques successfully address only some, but not all of the properties listed above and are summarized in Table 8.
9
9
9
9
9
Oblivious
9 9
1) 9
1)
9
Composition Visualization
9
Handling Interactions
1)
Semantics vs. Syntax
Abstraction Level
Familiar
9
Formal
Jacobson and Ng [28] (AOSD with Use Cases) Whittle and Araújo [30, 29] (Scenario Modeling with Aspects) Moreira et al. [31, 33, 32] (Aspectual Use Case Driv. Appr.) Barros and Gomes [34] (UML Activity Diagram) Whittle et al. [35] (Graph Transformation – MATA) de Bruin and van Vliet [38] (Quality-Driven Sw. Arch. Comp.) Aspect-oriented Use Case Maps (AoUCM) [9, 19]
Scalable
Exhaustive
Table 8. Comparing Scenario-Based Approaches to AORE
9
1)
9
9
9
9
9
1)
9
9
1)
9
9 9
9
9 9
9
9
9
9
1) Only qualifies as a semi-formal composition technique compared to graph transformations.
Only Whittle and Araújo, Whittle et al., and AoUCM employ exhaustive composition mechanisms that can handle loops, concurrency, and interleaving. Jacobson and Ng as well as Moreira et al. do not address concurrency, loops, and interleaving, while Barros and Gomes as well as de Bruin and van Vliet only support before and after composition. Jacobson and Ng add the new concept of pointcut to use case modeling and change the meaning of extension points. Moreira et al. require several extensions to UML diagrams to visualize aspects. All other techniques, however, use familiar modeling languages. None of the techniques handle interactions of concerns well except for AoUCM and Whittle et al.’s MATA. AoUCM specifies concern interaction graphs that capture dependencies, conflicts, and resolutions based on precedence rules. MATA also allows the definition of precedence rules. When compared to the rigor and formal foundation of graph transformations, all other techniques qualify at the most as semi-formal notations. Most approaches are problematic in terms of scalability because composition rules identify targets of the composition only explicitly: Moreira et al. represent composition rules in an explicit and textual way without allowing parameterized expressions. Whittle and Araújo use textual and non-parameterized binding rules. Barros and Gomes also use a textual representation of pointcuts and also explicitly link nodes in UML activity diagrams, not allowing parameterized expressions. de Bruin and van
64
G. Mussbacher et al.
Vliet require the explicit addition of “Pre” and “Post” stubs for each location on a UCM that requires a change. Jacobson and Ng, however, address scalability to a certain degree by modeling perform transaction use cases that capture generic interactions between an actor and the system. In terms of abstraction levels, AoUCM are at a higher level of abstraction than the work by Whittle and Araújo which is at the message/state machine level. Moreira et al. make use of some models that are at the same and some models that are at a lower level of abstraction than AoUCM. All other approaches are at the same abstraction level as AoUCM. None of the approaches except for AoUCM takes the semantics of the modeling notation into account when composing concerns. AoUCM defines semantic equivalences classes that contain syntactic constructs that have the same meaning. AoUCM’s composition mechanism [39] then takes these equivalence classes into account. Therefore, refactoring operations can be safely performed on the AoUCM model without the risk of breaking some of the pointcut expressions. Approaches based on use cases (Jacobson and Ng and Moreira et al.) do not face complex layout issues when visualizing the composed model, since use case diagram do not tend to be overly complex. However, techniques based on sequence diagrams (Whittle and Araújo), activity diagrams (Barros and Gomes), or graph-based transformations (Whittle et al.) do have to deal with such issues. The addition of stubs, however, is manageable in de Bruin and van Vliet’s approach. AoUCM’s usage of AoViews circumvents the whole problem altogether using views for the visualization that have already been provided by the modeler. While most techniques are oblivious, Jacobson and Ng and de Bruin and van Vliet add extensions points and stubs, respectively, directly to the base model, causing it to be polluted with concern-specific information. 6.2 Comparison with Other Goal-Oriented Techniques for AORE Yu et al. [40] identify aspects in goal models based on the relationships between functional and non-functional goals, propose goal aspects as a way to address scalability issues in goal models, and point out that the syntax of goal aspects requires further research. An example shows a textual definition of a goal aspect. AoGRL uses a visual syntax for aspect-oriented goal models including pointcut expressions. Alencar et al. [41] identify aspects in i* models and extend the notation to represent aspect-oriented concepts. The extensions, however, do not allow crosscutting elements to be fully separated from other concerns, and pointcut expressions are again defined in a textual way. AoGRL fully encapsulates crosscutting concerns in an aspect. Furthermore, Alencar et al. do not identify scenarios as aspects or concerns in i* models, whereas AoGRL does model scenarios as concerns because AoGRL is part of the larger AoURN context. Kaiya and Saeki [42] propose a pattern-based technique to compose viewpoints. Like AoURN, [42] investigates goal and scenario models at the same time, but limits the composition technique to a simple combinatorial approach instead of more powerful pointcut expressions as in AoURN. Furthermore, it is not clear whether the approach specifies all required information for the composition of goal graphs and use cases.
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN)
65
7 Conclusion We applied the Aspect-oriented User Requirements Notation (AoURN) to the CCCMS case study, following a process defined at the beginning of this paper. We discussed in detail how AoURN is applied to the CCCMS case study, giving an example-based introduction to AoURN’s capabilities. AoURN is a visual framework that adds aspect-oriented extensions to the User Requirements Notation (URN) standard for goal-oriented and scenario-based modeling. With this framework, we modeled stakeholder concerns, functional concerns (use cases), and non-functional concerns of the CCCMS with AoURN. AoURN can effectively deal with most types of concerns as required by the CCCMS case study. Heavily data-centric concerns such as persistence, however, are more cumbersome to model with AoURN. For those concerns, techniques based on domain models may be the better choice. On the other hand, AoURN captures well concern interactions including dependencies and conflicts with their resolutions in the Concern Interaction Graph (CIG). We assessed AoURN models of the CCCMS against standard URN models of the CCCMS based on the metrics adapted from literature and a task-based evaluation. The results suggest that AoURN models are more scalable than URN models and exhibit better modularity, reusability, and maintainability. The results are the most pronounced for NFR concerns. Further empirical studies in the form of usability studies are required to confirm the results obtained through the presented assessment. A qualitative assessment of six other aspect-oriented techniques for scenario-based requirements engineering concludes that AoUCM and the graph-transformation-based approach MATA perform best according to nine predefined criteria. AoGRL was also compared to three other goal-oriented techniques to aspect-oriented modeling, indicating that AoGRL also has advantages over these techniques. In future work, AoURN could benefit from tighter integration with domain model-oriented approaches. Furthermore, better language and tool support is required for URN’s analysis features to be applied in a fully aspect-oriented mode. URN’s analysis features consist of the testing of UCM models based on scenario definitions and the evaluation of GRL goal models. Current tool support through the jUCMNav tool allows modeler to fully define AoURN goal and scenario models. Furthermore, aspect markers may be added manually. Prototypes for the matching and composition algorithms required for the automatic insertion of aspect markers in AoURN models have been developed, but have not yet been made available in the official tool. AoViews are not yet supported by the jUCMNav tool. Finally, better tool support should also help modelers in assessing changes to pattern matches when an AoURN model is updated. Acknowledgments. This research was supported by the Natural Sciences and Engineering Research Council of Canada, through its programs of Discovery Grants and Postgraduate Scholarships, as well as the Ontario Graduate Scholarship Program. We also want to thank FCT MCTES for partially funding this work.
66
G. Mussbacher et al.
References 1. International Telecommunication Union: Recommendation Z.151 (11/08), User Requirements Notation (URN) – Language definition (2008), http://www.itu.int/rec/T-REC-Z.151/en 2. Chitchyan, R., Rashid, A., Sawyer, P., Garcia, A., Pinto Alarcon, M., Bakker, J., Tekinerdogan, B., Clarke, S., Jackson, A.: Survey of Analysis and Design Approaches. AOSDEurope Report ULANC-9 (2005), http://www.aosd-europe.net/deliverables/d11.pdf 3. Clarke, S., Baniassad, E.: Aspect-Oriented Analysis and Design: The Theme Approach. Professional. Addison-Wesley Professional, Reading (2005) 4. Cottenier, T., van den Berg, A., Elrad, T.: Motorola WEAVR: Model Weaving in a Large Industrial Context. In: 6th International Conference on Aspect-Oriented Software Development (AOSD 2007), Vancouver (2007) 5. France, R., Ray, I., Georg, G., Ghosh, S.: Aspect-oriented Approach to Early Design Modeling. IEE Proceedings–Software 151(4), 173–186 (2004) 6. Kienzle, J., Al Abed, W., Klein, J.: Aspect-Oriented Multi-View Modeling. In: 8th International Conference on Aspect-Oriented Software Development (AOSD 2009), Charlottesville, pp. 87–98. ACM Press, New York (2009) 7. Rashid, A., Moreira, A., Araújo, J.: Modularization and composition of aspectual requirements. In: Proceedings of the 2nd International Conference on Aspect-Oriented Software Development, Boston, pp. 11–20. ACM, New York (2003) 8. Tarr, P., Ossher, H., Harrison, W., Sutton, S.M.: N degrees of separation: Multidimensional separation of concerns. In: Proceedings of the 21st International Conference on Software Engineering (ICSE 1999), Los Angeles, pp. 107–119. ACM, New York (1999) 9. Mussbacher, G., Amyot, D.: Extending the User Requirements Notation with Aspectoriented Concepts. In: Reed, R., Bilgic, A., Gotzhein, R. (eds.) SDL 2009: Design for Motes and Mobiles. LNCS, vol. 5719, pp. 115–132. Springer, Heidelberg (2009) 10. Kienzle, J., Guelfi, N., Mustafiz, S.: Crisis Management Systems: A Case Study for AspectOriented Modeling. Transactions on Aspect-Oriented Software Development 7, 1–22 (2010) 11. Sant’Anna, C., Garcia, A., Chavez, C., Lucena, C., von Staa, A.: On the Reuse and Maintenance of Aspect-Oriented Software: An Assessment Framework. In: Brazilian Symposium on Software Engineering (SBES 2003), Manaus, pp. 19–34 (2003) 12. Mussbacher, G., Amyot, D., Araújo, J., Moreira, A., Weiss, M.: Visualizing AspectOriented Goal Models with AoGRL. In: Proceedings of the Second International Workshop on Requirements Engineering Visualization (REV 2007), New Delhi, IEEE Computer Society, Washington (2007) 13. jUCMNav, Version 4.2.1, University of Ottawa (2010), http://softwareengineering.ca/jucmnav 14. UCMNav website, http://jucmnav.softwareengineering.ca/twiki/bin/ view/UCM/UcmNav 15. OpenOME website. University of Toronto, http://www.cs.toronto.edu/km/openome/ 16. Sandrila SDL website. SanDriLa Ltd., http://www.sdl.sandrila.co.uk/ 17. Amyot, D., Mussbacher, G.: Development of Telecommunications Standards and Services with the User Requirements Notation. In: Workshop on ITU System Design Languages, Geneva (2008), http://www.itu.int/dms_pub/itu-t/oth/06/ 18/T06180000010012PDFE.pdf
Requirements Modeling with the Aspect-oriented User Requirements Notation (AoURN)
67
18. URN Virtual Library, http://www.usecasemaps.org/pub 19. Mussbacher, G., Amyot, D., Weiss, M.: Visualizing Early Aspects with Use Case Maps. In: Rashid, A., Aksit, M. (eds.) Transactions on AOSD III. LNCS, vol. 4620, pp. 105–143. Springer, Heidelberg (2007) 20. Mussbacher, G.: Aspect-Oriented User Requirements Notation: Aspects in Goal and Scenario Models. In: Giese, H. (ed.) MODELS 2007. LNCS, vol. 5002, pp. 305–316. Springer, Heidelberg (2008) 21. Pourshahid, A., Mussbacher, G., Amyot, D., Weiss, M.: Toward an Aspect-Oriented Framework for Business Process Improvement. International Journal of Electronic Business (IJEB) 8(3), pp. 233–259 (2010) 22. Sampaio, A., Chitchyan, R., Rashid, A., Rayson, P.: EAMiner: a Tool for Automating Aspect-Oriented Requirements Identification. In: Proceedings of the 20th IEEE/ACM International Conference on Automated Software Engineering (ASE), Long Beach, pp. 352–355. ACM, New York (2005) 23. CCCMS: Complete URN Model and AoURN Model Files (2009), http://www.site.uottawa.ca/~damyot/pub/CCCMS-TAOSD 24. Mussbacher, G., Amyot, D.: On Modeling Interactions of Early Aspects with Goals. In: Proceedings of the 2009 ICSE Workshop on Aspect-Oriented Requirements Engineering and Architecture Design, Vancouver, pp. 14–19. IEEE Computer Society, Washington (2009) 25. Mussbacher, G., Amyot, D., Weigert, T., Cottenier, T.: Feature Interactions in AspectOriented Scenario Models. In: Nakamura, M., Reiff-Marganiec, S. (eds.) Feature Interactions in Software and Communication Systems X, pp. 75–90. IOS Press, Amsterdam (2009) 26. Basili, V., Caldiera, G., Rombach, H.: The Goal Question Metric Approach. Encyclopedia of Software Engineering 2, 528–532 (1994) 27. Mussbacher, G., Amyot, D., Whittle, J., Weiss, M.: Flexible and Expressive Composition Rules with Aspect-oriented Use Case Maps (AoUCM). In: Moreira, A., Grundy, J. (eds.) Early Aspects: Current Challenges and Future Directions. LNCS, vol. 4765, pp. 19–38. Springer, Heidelberg (2007) 28. Jacobson, I., Ng, P.-W.: Aspect-Oriented Software Development with Use Cases. Addison-Wesley Professional, Reading (2005) 29. Whittle, J., Araújo, J.: Scenario Modelling with Aspects. IEE Proceedings – Software 151(4), 157–172 (2004) 30. Araújo, J., Whittle, J., Kim, D.: Modeling and Composing Scenario-Based Requirements with Aspects. In: Proceedings of the 12th IEEE International Requirements Engineering Conference (RE 2004), Kyoto, pp. 58–67. IEEE Computer Society, Washington (2004) 31. Araújo, J., Moreira, A.: An Aspectual Use Case Driven Approach. In: Pimentel, E., Brisaboa, N.R., Gómez, J. (eds.) VIII Jornadas de Ingeniería de Software y Bases de Datos (JISBD 2003), Alicante, pp. 463–468 (2003) 32. Moreira, A., Araújo, J., Brito, I.: Crosscutting Quality Attributes for Requirements Engineering. In: Proceedings of the 14th International Conference on Software Engineering and Knowledge Engineering (SEKE), Ischia, pp. 167–174. ACM Press, New York (2002) 33. Moreira, A., Araújo, J.: Handling Unanticipated Requirements Change with Aspects. In: Proceedings of the 16th International Conference on Software Engineering and Knowledge Engineering (SEKE), Banff, pp. 411–415 (2004) 34. Barros, J.-P., Gomes, L.: Toward the Support for Crosscutting Concerns in Activity Diagrams: a Graphical Approach. In: Fourth Workshop on Aspect-Oriented Modelling (held with UML 2003), San Francisco (2003)
68
G. Mussbacher et al.
35. Whittle, J., Jayaraman, P.: MATA: A Tool for Aspect-Oriented Modeling Based on Graph Transformation. In: Giese, H. (ed.) MODELS 2007. LNCS, vol. 5002, pp. 16–27. Springer, Heidelberg (2008) 36. Morin, B., Klein, J., Barais, O., Jézéquel, J.-M.: A Generic Weaver for Supporting Product Lines. In: Proceedings of the 13th International Workshop on Early Aspects, Leipzig, pp. 11–18. ACM, New York (2008) 37. France, R., Fleurey, F., Reddy, R., Baudry, B., Ghosh, S.: Providing Support for Model Composition in Metamodels. In: 11th IEEE International Enterprise Computing Conference (EDOC 2007), Annapolis, pp. 253–266. IEEE Computer Society, Washington (2007) 38. de Bruin, H., van Vliet, H.: Quality-Driven Software Architecture Composition. J. Syst. Softw. 66(3), 269–284 (2003) 39. Mussbacher, G., Amyot, D., Whittle, J.: Refactoring-Safe Modeling of Aspect-Oriented Scenarios. In: Schürr, A., Selic, B. (eds.) MODELS 2009. LNCS, vol. 5795, pp. 286–300. Springer, Heidelberg (2009) 40. Yu, Y., Leite, J.C.S.d.P., Mylopoulos, J.: From Goals to Aspects: Discovering Aspects from Requirements Goal Models. In: Proceedings of the 12th IEEE International Requirements Engineering Conference (RE 2004), Kyoto, pp. 38–47. IEEE Computer Society, Washington (2004) 41. Alencar, F., Castro, J., Moreira, A., Araújo, J., Silva, C., Monteiro, C., Ramos, R., Mylopoulos, J.: Simplifying i* Models. In: 17th International Workshop on AgentOriented Information Systems (AOIS 2007), Trondheim, pp. 635–649. Tapir Academic Press, London (2007) 42. Kaiya, H., Saeki, M.: Weaving Multiple Viewpoint Specifications in Goal-Oriented Requirements Analysis. In: 11th Asia-Pacific Software Engineering Conference (APSEC 2004), Busan, pp. 418–427. IEEE Computer Society, Washington (2004)
Relating Feature Models to Other Models of a Software Product Line A Comparative Study of FeatureMapper and VML* Florian Heidenreich1, Pablo S´anchez2 , Jo˜ao Santos3 , Steffen Zschaler4 , Mauricio Alf´erez3 , Jo˜ao Ara´ujo3 , Lidia Fuentes5 , Uir´a Kulesza3 , Ana Moreira3, and Awais Rashid4 1 Technische Universit¨at Dresden, Germany [email protected] 2 Universidad de Cantabria, Santander, Spain [email protected] 3 Universidade Nova de Lisboa, Portugal {mauricio.alferez,ja,amm}@di.fct.unl.pt, {jpgpsantos,uirakulesza}@gmail.com 4 Lancaster University, UK {zschaler,awais}@comp.lancs.ac.uk 5 University of Malaga, Spain [email protected]
Abstract. Software product lines using feature models often require the relation between feature models in problem space and the models used to describe the details of the product line to be expressed explicitly. This is particularly important, where automatic product derivation is required. Different approaches for modelling this mapping have been proposed in the literature. However, a discussion of their relative benefits and drawbacks is currently missing. As a first step towards a better understanding of this field, this paper applies two of these approaches— FeatureMapper as a representative of declarative approaches and VML* as a representative of operational approaches—to the case study. We show in detail how the case study can be expressed using these approaches and discuss strengths and weaknesses of the two approaches with regard to the case study.
1 Introduction A software product line (SPL)—such as the case study under discussion [1]—is a set of software-intensive systems sharing a common, managed set of features that satisfy the specific needs of a particular market segment or mission and that are developed from a common set of core assets in a prescribed way [2, 3]. Apart from sharing a common set of features, every system also has features that are specific to this system and not shared with other systems in the SPL. For the purposes of this paper, we are using the following definition of feature: “A prominent or distinctive user-visible aspect, quality, or characteristic of a software system or systems.” [4] as cited in [5] S. Katz et al. (Eds.): Transactions on AOSD VII, LNCS 6210, pp. 69–114, 2010. c Springer-Verlag Berlin Heidelberg 2010
70
F. Heidenreich et al.
An important part of managing the features of a product line and the individual systems (often called products) is to model the available features and their dependencies (e.g., if feature A is selected, feature B also must be selected) in an abstract form. In particular, it is essential to produce models for the variable features. Often, this is done using socalled feature models (e.g., [5]). The case study under discussion is an example of such a product line. In this paper, we focus solely on the product lines modelled using feature models. Although these models express what features there are and what products can be formed from them, they do not express how a specific feature is realized, and, thus, how any specific product is realized. Typically, there also need to be models that describe how the SPL is realized; that is, models of the solution space for the SPL. This is particularly relevant in a modeldriven setting, where product code is generated from product models. For instance, let us consider a simple SPL for a chess game for mobile phones, where the product can be delivered with three levels of expertise: beginner, medium and master. A feature model would only specify that there are three levels, and that the user must select one, but it does not specify how these alternatives are supported at the software level. This might be by means of different techniques, such as using a strategy pattern or conditional compilation, among others. Thus, we also need software models that specify which particular kind of technique we have selected for realising the variations at the softwaredesign level. In SPL terminology, feature models are said to be problem-space models, and software models, such as architectural design models, are said to be solution-space models. To automate product derivation, we also need to know what actions or manipulations should be applied to the software models as a certain feature is included or excluded in/from a specific product. For instance, if we have opted for using the strategy pattern for designing a set of alternative features, we need to know which strategies correspond to each feature. Because it is not always possible to establish a clear one-to-one mapping between features and model elements, this is not a trivial task. This leads to a mapping problem: For each feature in a feature model, we need to identify and specify the solution-space models and model elements associated with it to be able to systematically construct products given a selection of features. In this paper, we will use the term variability mapping to refer to the activity of expressing explicitly the relationship between features and model elements. Note that this does not imply that the relation between features and their realization must be ’discovered after the fact’. Variability will be designed into solution-space models because there is a corresponding variation point in the feature model. However, to enable automation of product derivation, this relationship (or mapping) must be made explicit in some form. Depending on how we choose to model the SPLs architecture, this mapping may be very simple or very complex. For example, where aspect-oriented or feature-oriented techniques are used for the SPL models, we can attempt to align every feature with one module of these models. Using more standard object-oriented modelling techniques, some features will have to be mapped to a number of model elements across the entire SPL; that is, they will be cross-cutting features.
Relating Feature Models to Other Models of a Software Product Line
71
Aspect-oriented modelling (AOM) is about the separation of different concerns in different (partial) models that can then be composed into a representation of the complete system. Variability modelling fits well into this description: A key principle is to separate the model elements related to different features (’concerns’). This is done by either physically separating them in separate models or virtually separating them using different tags to associate model elements to features. A first step in product derivation is then the composition of these separate concerns into models of a complete product. Variability models address the mapping problem mentioned above to provide both separation of concerns and composition of the separated models into product models. A number of different approaches to variability mapping have been proposed [6–11]. These proposals take different approaches to the mapping problem. Some approaches use a declarative model of the mapping between features and model elements (e.g., [6, 7, 9]), while others use a more operational approach based on model transformations (e.g., [8, 10, 11]). This paper applies two of these approaches—FeatureMapper [9] and VML* [11]—to the case study and discusses their respective advantages and drawbacks. FeatureMapper is a generic tool that can be used directly with any EMFbased model [12] and GMF, Ecore, or EMFText-based [13] editor. It directly relates features and model elements and derives product models by removing all model elements associated with features not selected for that product. In contrast, VML* uses languages customized for each target model. For instance, for target models of components and connectors, VML* can be customized to provide constructs in terms of components and connectors. It is still generic, because it is based on a customisable infrastructure that can be easily adapted for any new target model using a generativeprogramming approach. Each language consists of a set of actions corresponding to simple model transformations that are executed depending on the features selected for a product. The two approaches have been selected because they are good representatives of declarative and operational approaches, respectively. Therefore, we believe the results from a comparison of these two approaches can also provide some insights into the relative benefits and drawbacks of declarative and operational approaches to the mapping problem.1 Furthermore, each of the approaches has been developed by some of the co-authors of this paper. This gives us full access to the approaches and their accompanying tooling, which is key to an evaluation against the common case study. A more detailed discussion of the spectrum of different approaches and our selection can be found in Sect. 2.2. We have defined a set of comparison criteria to support a systematic comparison of the two approaches. These criteria have been defined to cover a broad spectrum of characteristics relevant when using a variability-modelling approach. In particular, they can be grouped into criteria on the expressiveness of the approach (i.e., what types of variability and what artefacts does the approach support), criteria on the useability and analysis support (i.e., what kinds of evaluations and analyses does the approach support), and criteria on the approaches’ applicability to real-word product lines (i.e., 1
As also pointed out by the anonymous reviewers, this does not imply that the comparison results can be directly generalised to other tools. However, as we will see, a number of the comparison results really reflect the fact that one of the approaches is declarative and the other one is operational, so there are some tentative grounds for careful generalisation.
72
F. Heidenreich et al.
does it scale, does it support evolution of artefacts). Although it is always possible to add additional criteria, we believe that this selection enables systematic and broad comparison of the two approaches. The remainder of this paper is structured as follows: Section 2 briefly discusses different variability mechanisms before giving an overview of approaches to the mapping problem that can be found in the literature and attempting a classification of these approaches on the basis for motivating our specific selection from this space. Section 3 presents some more detail on the case study and, in particular, refines it to provide detail of a second specific crisis management system—a flood crisis management system. The detailed models from Sect. 3 are then used in Sects. 4 and 5 to show how the two approaches are applied to the case study. Based on this, Sect. 6 compares the two approaches and discusses their benefits and drawbacks along a number of dimensions. Finally, Sect. 7 concludes the paper.
2 Background The mapping problem, i.e. how to specify the links between features and variation points plus variants in software models, was already identified by Pohl et al. [3], who originally proposed the Orthogonal Variability Model (OVM). The idea of the OVM is that variability specification, e.g. a feature model, and variability realization, e.g. a flexible reference architecture comprises component and connectors, should be separated, contrarily to other approaches, such as Ziadi et al. [14], where software models are augmented with information regarding which model elements are optional, which are alternatives and so forth. This should contribute to a better scalability [15]. The OVM concepts have been implemented in the VarMod tool 2 , which allows us: (1) to create variability models in problem space according to Pohl et al’s notation [3]; (2) check the well formedness of these models; and (2) specify trace links between these variability models and solution-space artifacts. The OVM largely inspired the family of VML languages, which extend the OVM approach with information about what specific actions must be carried out in a software model when a certain feature is selected or unselected. In this section, we first discuss different mechanisms for achieving variability between models for different products of an SPL, i.e. how variability can be realized. Next, we discuss a range of approaches for variability mapping (that is, different solutions to the mapping problem described above) available in the literature and motivate our selection of approaches for the purposes of the comparison reported on in this paper. 2.1 Variability Mechanisms The first step in modelling variability in the solution space is to create a reference model for the family of products that the software product line covers. This reference model must incorporate certain variability mechanisms for supporting the variations specified in the feature model. In general, we can choose from the following types of variability mechanisms:3 2 3
http://sse.uni-due.de/wms/en/?go=256 See, for example, [16] for a deeper discussion of positive and negative variability.
Relating Feature Models to Other Models of a Software Product Line
73
1. Negative Variability. Here, selecting a feature for a product implies removing all model elements associated with the other, unselected, features from the SPL model. We create a reference model that contains all the elements used for all variants of the software product line. During the product derivation, those elements that are not required according to a selection of features are removed. 2. Positive Variability. In contrast to negative variability, here, selecting a feature for a product implies adding all model elements associated with this product to the SPL model. We create a minimal reference model which contains the common elements, or core elements, for any product in the software product line. Then, we specify which new elements must be added as a consequence of selecting a certain set of features. A special case of positive variability is positive variability with aspect models. Here, we encapsulate variants into aspects, using an AOM technique [17] (such as Reuseware [18], MATA [19], or TENTE [20]). Then, the mapping model is used to indicate which aspects must be woven according to a certain selection of features. 3. Parameterization of Model Elements. Here, variability is achieved by modifying existing model elements in the reference model depending on the feature selection. An example of this variability mechanism is component parametrization, where variability of a software architecture is enabled through parameterized components. The mapping model is used for generating the values for the parameters of these components corresponding to a certain selection of features. Each one of these mechanisms has advantages and disadvantages. For instance, when the selection of one feature implies the addition of a considerable number of new components, interfaces and so forth scattered throughout the reference model, it makes sense to encapsulate these elements into one aspect, separately from the core of the application. This kind of decomposition improves modularization, easing maintenance and evolution [21]. Nevertheless, the selection of a variant might only require to remove an operation from an interface; or change the value of a certain attribute. If we try to encapsulate this kind of fine-grained variation into aspects, the result will be a software architecture decomposed into a large number of small aspects with complex dependencies among them. This quickly leads to scalability problems. 2.2 Variability Mapping Approaches Figure 1 gives an overview of the space of variability mapping for SPLs as we see it. It should be noted that for this paper, we are interested only in static SPLs. Dynamic SPLs, where variability is resolved at runtime and is used to adapt the system to changing contexts, are out of the scope of our paper. Consequently, Fig. 1 only includes approaches to variability mapping that support static variability resolution. All of the approaches covered by this figure aim to support product derivation based on a selection of features from a feature model. To this end, they each provide some way to model the modifications of the target required if a particular feature has been selected or unselected. Based on how this is done, we distinguish a number of types of variability-mapping approaches:
74
F. Heidenreich et al. Variability Mapping Declarave Posive Variability
Negave Variability
AHEAD [6]
Operaonal
Generic Model Transformaons
Aspect-Oriented Modelling
Customised Model Transformaons
Ziadi et al. [24] Boerweck et al. [25]
CVL [8]
VML* [11, 26] Gears [27]
Direct Annotaon
Separate Annotaon Model
Model Templates [7] Morin et al. [10]
FeatureMapper [9] pure:variants [23]
Fig. 1. Overview of approaches to variability mapping
1. Declarative variability mapping. In this category, we group approaches that model what changes are needed, but do not provide means of modelling how these changes should be achieved. Instead, the precise mechanism of change is encoded in the semantics of the models, to different degrees of formality, but typically encapsulated in a tool. The approaches discussed in the literature typically support either positive or negative variability: (a) Support for positive variability. Batory et al. [6] present A HEAD, an approach that views features as incremental modifications of base systems. Effectively, this leads to positive variability, where the addition of features leads to additions to the base system.4 (b) Support for negative variability. Negative variability uses models of the complete product line, removing elements associated with unselected features during product derivation. To specify which model elements are associated with which features, model elements are often tagged with feature names or feature expressions. These tags can either be embedded directly into the target model or they can be represented in a separate annotation model: i. Using direct annotations of the target model. Czarnecki and Antkiewicz [7] propose the use of a template model, which models all products in the product line. Elements of this model are annotated with so-called presence conditions. Given a specific configuration, each presence condition evaluates to true or false. If a presence condition evaluates to false, its associated model elements are removed from the model. Thus, such a templatebased approach is specific to negative variability, which might be critical when a large number of variations affect a single model. Moreover, presence conditions imply introducing annotations into the SPL model. Therefore, the actions associated with a feature selection are scattered across the model, which could also lead to scalability problems. An implication of using annotations is that the modelling languages used for modelling an 4
[6] in principle also allows features to represent non-monotonic modifications, which would lead to negative variability.
Relating Feature Models to Other Models of a Software Product Line
75
SPL need to provide means for annotating model elements (such as UML stereotypes). Other modelling languages cannot easily be supported. Morin et al. [10] provide an alternative approach to represent variability in models of a product line. Their approach is effectively based on the tagging target model elements with variability information, similarly to [7] and FeatureMapper. However, instead of tagging with features or feature expressions, [10] tags model elements with whether they are optional, alternatives, mandatory, etc., as well as with inclusion constraints between different model elements. These concepts are expressed in a separate metamodel, which is woven into the target metamodel using their SmartAdapters approach to AOM [22]. Although Morin et al. use feature models to simplify the configuration of the variability expressed in their models, these feature models are derived directly from the target model assuming a simple 1-to-1 relation between features and model elements. Thus, their feature models are much closer to the solution space of a product line than the feature models we are discussing for the common case study. ii. Using a separate annotation model. FeatureMapper [9] is an approach very similar to the template-model approach of [7]. However, it uses an annotation model that is separate from the target model to store feature expressions and their associations with target-model elements. Because the annotations are not embedded directly into the target model, the target modelling language does not need to be changed and existing tools can be used directly. In addition, by separating the target model and the variability specification, the target model can more easily be reused in another context. pure::variants [23] is an industrial-strength variant management tool that uses a separate model, a so-called family model, to store mappings between feature expressions and symbolic names to solution-space artefacts (such as file names, preprocessor definitions or URI to model elements). By default, the tool has no direct understanding of models and model elements. However, FeatureMapper was integrated into pure::variants recently, so that pure::variants feature models, variant models, and mapping models can be used in combination with FeatureMapper. pure::variants supports the configuration and derivation of variants of an SPL. 2. Operational variability mapping. In contrast to declarative approaches, operational approaches provide language constructs for specifying how target models must be modified when specific features are selected or deselected. We distinguish the following three categories of approaches from the literature: (a) Using generic model transformation languages. Ziadi et al. [24] and Botterweck et al. [25] both propose the implementation of product derivation processes as model transformations. Their proposals rely on the realization of product derivations via a model transformation language. This strategy requires SPL engineers to deal with low-level details of model transformation languages. (b) Using aspect-oriented modelling techniques. Haugen et al. [8] define the common variability language (CVL), which is a generic extension to DSLs
76
F. Heidenreich et al.
for expressing variability. It provides three generic operators, such as value substitution, reference substitution, and fragment substitution, all of which are based on aspect-oriented notions of model weaving, but using these to express variability can lead to comparatively complex models. CVL is also based on model transformation, but proposes to extend the target modelling language with generic concepts for variability modelling. CVL distinguishes between socalled variation models and resolution models. A variation model is based on a modelling language extended with CVL concepts and describes all possible variations using the three standard CVL variability mechanisms. The resolution model is then used to select the variations to be included in a product model. (c) Using customized model transformation languages. VML* [11, 26] is a family of languages for variability mapping. A particular VML* language is effectively a model transformation language. However, different from the approaches in the first category, this model-transformation language has been customized both to the domain of SPLs and to the target modelling language. Thereby, SPL developers do not need additional knowledge about model-transformation languages or target-model metamodels. Instead, they can express required modifications using the same concepts and terminology and they would use for producing the models in the first place. Gears [27] is an SPL framework that also supports product derivation. It started at the code level, and it has recently adapted for working at the requirements and/or model level with some specific tools [28], such as DOORS or Rhapsody. This tool has its own feature model, where each feature is seen as a variable with its own basic type (e.g. boolean or string). It also contains a mechanism to define variation points in software assets and a language for specifying how these variation points must be bound to produce a concrete product. For instance, we can declare a file containing a license agreement for a software product as a variation point, and associated different files containing different license agreements to that variation point. Then, using the language for variability binding provided with Gears, we can specify what specific license agreement must be included in a specific product depending on the feature configuration. Gears, allows to specify what actions should be carried out when a certain variants is selected or unselected, similarly to VML*, through a specific Gears capability called actuator. However, these actuators are based on the manipulations of textual files, with no specific support for models, which implies that models need to me manipulated directly in their serialised form (such as in XMI format). This can make the implementation of actions very costly and time-consuming. There are other aspect-oriented modelling approaches, such as MATA [19], XWeave [29], Reuseware [18], or RAM (Reusable Aspect Models) [30], which can also be used for software product line engineering and are not included in this classification. All these techniques provide mechanisms to encapsulate features in individual modules. In these cases, features are considered as enhancements to an already existing core. MATA, for instance, provides mechanisms for encapsulating enhancements to an existing core as
Relating Feature Models to Other Models of a Software Product Line
77
aspects, which are later composed, in case the corresponding feature is selected, with the core based on the graph-transformation techniques. Nevertheless, these languages and tools focus on separating and encapsulating features as enhancements to an existing core, but they do not provide support to automate the product derivation process (i.e., aspects corresponding to selected features must be composed manually). Moreover, it is difficult to encapsulate fine-grained variations, such as changing attribute values. From the spectrum of approaches presented in this section, we have chosen two, namely FeatureMapper and VML*, which we apply to the common case study and compare with respect to a number of comparison criteria. To provide a full understanding of the spectrum, it would, of course, have been preferable to compare all approaches by applying them to the common case study. However, unfortunately this is not feasible. A key criterion for our selection was the fact that we know these two approaches and have full access to the tools and the original developers. Thus, we can ensure that we do not accidentally misuse or misrepresent the approaches, which could easily have happened with some of the other approaches. However, apart from this, we also selected the two approaches because they represent quite different categories from our classification in Fig. 1: FeatureMapper is a declarative approach for negative variability, while VML* is an approach for operational variability mapping. Thus, the results of our comparison should allow at least some initial conclusions about the relative benefits and drawbacks of these two broad categories.
3 Zooming in on the Case Study: Car Crises vs Flood Crises To be able to demonstrate the approaches, we needed to refine the case study [1] for at least one additional product. The main motivation to model the additional product was to create models that contain significant differences between both instances of the product line and to evaluate the chosen approaches based on how they perform at modelling the variability that needed to be expressed in the different models. Therefore, we aimed to add two types of models and model elements: 1) such that would only occur in one of the two alternate products, and 2) such that would require some modifications (e.g., a different structure or different values) in each product. This section presents these refinements as a preparation for the rest of the paper.5 3.1 Flood Crisis Management System In addition to the car crisis management system (CCMS) from the case study, we have chosen to model a Flood Crisis Management System (FCMS). Figure 2 shows the configuration model (i.e., the selected features) for the FCMS. It can be seen that FCMSs have a feature set that is substantially different from CCMSs, but that they also share a number of features. Features unique to the FCMS are underlined in the figure. Thus, features related with the use of the Navy, the pumping and repair missions, and the fact that the crisis may cover a large area are some examples of this uniqueness. We can 5
Since not all models created for the case study can be presented in this paper, we provide the models on-line at http://featuremapper.org/files/TAOSD-AOM-2009/
Fig. 2. Configuration model for a Flood Crisis Management System
78 F. Heidenreich et al.
Relating Feature Models to Other Models of a Software Product Line
79
also observe that there were features present in the CCMS which are not included in this configuration. Features related to investigation, nursing the wounded, sorting the wounded, police intervention, and the type of crisis (which is a major accident of type car crash) differ from the FCMS configuration. Figure 3 shows the use case model for an FCMS. A number of use cases have been added in comparison to the CCMS. For example, there are now the use cases ‘Execute Pumping Mission’ and ‘Execute Repair Mission’. These use cases only make sense for FCMSs, but not for CCMSs. As each use case is associated with at least one activity diagram detailing the concrete usage scenario, the FCMS model also contains additional activity diagrams. Note that even though some use cases are present for both products, they may still differ in the concrete underlying scenarios. This will be discussed in more detail for the ‘Execute Rescue Mission’ use case in the next subsection. Of course, the different products also require different designs and architectures. For example, the basic data structures required for both products are quite different, Figure 4 shows the data structures defined for FCMSs. In comparison, Fig. 5 shows the data structures defined for CCMSs. Furthermore, the FCMS makes use of a number of components that are not used by the CCMS and vice versa. For example, the FCMS uses the following components: ElectricityCompany, Navy, Army, ArmyVehicle, TelecommunicationCompany, and NavyBoat. The next subsection discusses the Rescue Mission as an especially interesting case, because although both products support this mission, they differ very much in their implementations of it.
Fig. 3. Use-Case Model for a Flood Crisis Management System
80
F. Heidenreich et al.
Fig. 4. Data structures for Flood Crisis Management Systems
Fig. 5. Data structures for Car Crisis Management Systems
3.2 Detailed Models of the Rescue Mission The purpose of the rescue mission is to locate victims and remove them from the site of the crisis. This requires a quite different set of steps in the case of a car crash and a flood crisis. Figures 6 and 7 show two activity diagrams with the different scenarios. Notice that there is a common core, but that each product has some steps specific to it. In both cases, the rescue mission begins by transmitting injury information and attempting, where possible, to identify the victim(s). Next, additional conditions are checked. These are contingent on the type of crisis: In the car-crash scenario, it makes sense to check whether the victim is locked in the car so that special actions need to be taken to remove him/her from the car. In the flood-crisis scenario, rescue is mostly about taking people out of the flood area. However, some victims, for example, elderly or handicapped people, may require special assistance for this. In both cases, if the additional condition is true, the rescue mission is terminated after requesting another mission to be undertaken in response to the additional condition. If the additional condition is false, the rescue mission proceeds as normal, by administering first aid and deciding if the victim needs to be taken to a hospital. If no hospital is needed, no further action is required in the case of the car-crash scenario. For the flood-crisis system, however, all victims need to be taken to a safe place. We consider these are reasonable assumptions, based on the real-life scenarios, on the original case study.
Relating Feature Models to Other Models of a Software Product Line
81
Fig. 6. Scenario for the rescue mission for the CCMS
The two products also require a different set of realization classes and data structures to appropriately represent the respective crisis, although they also share some common classes, which are depicted in Fig. 8. Although for a car crisis the location of a victim is the same as the location of the crisis (apart, possibly from the exact vehicle in which the victim may be located), a flood crisis occupies a much larger area, so that victim location becomes a much more relevant information. Consequently, the Victim class provides a location attribute for storing the victim’s location. Furthermore, different types of victims may require different treatment (cf. also Fig. 6 and Fig. 7). Which types of victims need to be distinguished depends on the type of crisis. Finally, while some types of resources will be useful for both types of crises (e.g., Blankets), others are only relevant for one or the other (e.g., LifeJackets are only useful in a flood crisis). Consequently, different design models are required for the two different products. Figure 9 shows the models we will be using.
82
F. Heidenreich et al.
Fig. 7. Scenario for the rescue mission for the FCMS
Fig. 8. Design models for accomplishing abstract missions
Relating Feature Models to Other Models of a Software Product Line
83
Fig. 9. Design models for the rescue mission for the CCMS (top) and the FCMS (bottom)
In addition, we consider these are reasonable assumptions, based on real-life scenarios, on the original case study. 3.3 Units of Measurement To show a specific type of variability mechanisms, we add a set of features dealing with units of measurement. The reason for this addition was that the case study can be completely modelled using positive and negative variability (cf. Sec. 2.1), and this change allows us in illustrating better how FeatureMapper and VML* can deal with model modifications. In particular, we add the MeasurementUnit feature group, which allows in choosing between the alternatives ImperialSystem and MetricSystem. This feature allows our product line to be used in different countries using different units of distance measurements. Both the FCMS and the CCMS need to deal with geographical locations for identifying the places where the crisis take place and personal data of the victims. Fig. 10 shows the design classes for managing geographical locations. This design is shared by both the FCMS and the CCMS. These data structures include the class RoadwayLocation, which need to specify a length measurement. Depending on the country where this system is deployed, this length would be measured in kilometers or miles. An attribute called distanceUnit is added to the RoadwayLocation for configuring in which system units this class must work. Therefore, depending on which country the system is deployed, this attribute must be changed.
84
F. Heidenreich et al.
Fig. 10. Data structures for dealing with geographical locations
The following two sections show how two different approaches to variability mapping can be applied to this case study, followed by a discussion of the two approaches in Sect. 6.
4 Application of FeatureMapper to the Case Study FeatureMapper [9, 31, 32] is an Eclipse-based tool that allows for mapping features to arbitrary modelling artefacts that are expressed by means of an Ecore-based language [12]. These languages include UML2, domain-specific modelling languages defined using the Eclipse Modelling Framework (EMF), and textual languages that are described using EMFText [13]. The mappings can be used to steer the product-instantiation process by allowing the automatic removal of modelling artefacts that are not part of a selected variant. To associate features or logical combinations of features (feature expressions) with modelling artefacts, the developer first selects the feature expression in FeatureMapper and the modelling artefacts in her favourite modelling editor (e.g., TOPCASED [33]). Next, she applies the feature expression to the modelling artefacts via the FeatureMapper user interface. This mapping is later interpreted by a FeatureMapper derivation component. Depending on the result of evaluating the feature expression against the set of features selected in the variant, the modelling elements are preserved or removed from the model. Model elements that are not mapped to a specific feature expression are considered to be part of the core of the product line and are always preserved. This implies that the solution-space models contain all model elements that are used in any product of the product line. In Fig. 11, we show that we can model variants or product-specific variations in one model. The separation of concerns is realized by the actual mapping and various visualization techniques that help the product-line developer in understanding the mapping between features and model artefacts. One such visualization is depicted in Fig. 11 where the colouring of model elements according to their associated feature expression is shown.6 Another visualization is shown in Fig. 12 where only modelling artefacts mapped to the current feature expression are drawn normally, whereas all model elements that are not realized by this feature expression are shaded in grey. Because FeatureMapper implements these visualizations on a 6
Since the colours used in this figure and others are likely not to be visible in a printout copy of the paper, we also provide the figures on-line at http://featuremapper.org/files/TAOSD-AOM-2009/
Relating Feature Models to Other Models of a Software Product Line
85
!
Fig. 11. Use-Case Model of the CMS displayed in FeatureMapper with enabled colouring of model elements and the legend depicting the corresponding feature expressions
sufficiently generic layer to become independent of the concrete editor7 , using them does not require changing the editors and works on all GMF-based, tree-based EMF, and textual EMFText editors. This enabled us to map features of the CMS to requirements, architectural, and design models without changing or adapting FeatureMapper itself or any of the used modelling editors. 4.1 Modelling the Mapping for Requirements Models As shown in Fig. 11, the use case model contains all actors and use cases of both the CCMS and the FCMS. We used the mapping facility of FeatureMapper to map specific feature expressions to the elements of the use case model. The feature expression have been identified by analyzing the textual description of the different use cases and taking the different actors participating in a use case into account. In addition to the use cases included in the case study description, we extended the models as described in Sect. 3. 7
FeatureMapper uses the Graphical Editing Framework (GEF) for graphical editors, the SWT TreeViewer for tree-based EMF editors, and the EMFText Editor, respectively.
86
F. Heidenreich et al.
Fig. 12. Use-Case Model of the CMS displayed in FeatureMapper with enabled Realization Visualization that highlights the model elements associated with the current feature expression
For example, the feature expression Repair AND Electric Line was assigned to the actor Electrician, the use case Execute Electric Line Repair Mission, and the association between those two artefacts. The use case Execute Repair Mission was in turn only mapped to the feature Repair because it is also used when we include repairing of telecommunication lines in our product. Another possibility to create the mapping for the use case Execute Repair Mission is to include it only if Repair AND (Execute Electric Line Repair Mission OR Execute Telecomm Line Repair Mission) evaluates to true. We decided against this because it limits the extensibility of our mapping. In case we would decide to include another specialised repair mission in our product line, we would also need to update this mapping. The mapping of the various identified feature expressions to the use-case model artefacts exposed no problems. However, modelling all variants in one model can result in large models which might become hard to understand for some modellers. To address this, using other modularisation techniques (e.g., the decomposition of all use cases specialising Execute Mission into a separate package) is possible. Likewise to the mapping shown in Fig. 11, one would then map the appropriate feature expressions to the model artefacts in the decomposed models which are later on composed using a compositional approach, i.e., UML package merge or model weaving. Similarly to the use case model we also mapped the features to activity models that contain inter-model variability. One example is the RescueMission (cf. Sect. 3.2). As can be seen in Fig. 13, inter-model variability is addressed in the FeatureMapper by modelling the variations in the model and mapping the corresponding feature
Relating Feature Models to Other Models of a Software Product Line
87
Fig. 13. Activity Model of the RescueMission where elements are coloured according to their feature mapping (Flood is blue whereas CarCrash is red)
expressions to the appropriate model artefacts. In the example, the feature expression Rescue AND CarCrash is mapped to the parts drawn in red colour and Rescue AND Flood is mapped to the blue parts. Since Flood and CarCrash are mutually exclusive, it is ensured that the model tailored to a specific variant forms a syntactically and semantically correct model. In case a specific combination of features requires the inclusion of a complete model, e.g., the activity model for the Execute Pumping Mission use case which is only included if the feature expression Pumping AND Firemen (cf. Fig. 11) evaluates to true, FeatureMapper can be used to assign the respective feature expression to the complete model. 4.2 Modelling the Mapping for Architecture and Design Models Similarly to the RescueMission activity model, the design model for the parts of the system relevant for the RescueMission contains modelling artefacts that are relevant
88
F. Heidenreich et al.
0
,*-
0
&''(
4 * 0
&''(
! " # ! $%&''() &''( &''( ", ! $%&''() &''( (''0 * ! $%&''() " ./ ! $%&''() + ! $%&''() + "*#
5 " **$ ! $%0) * " ! " %&''() , *, ! $%&''()
&''( &''(
.
1+ ". ! 2+ ".3 +%(''0)
* #"-
* "-+ !
*
0
( +$ ! $
( ! 1 "*
2
2
Fig. 14. Class Model of the RescueMission where elements are coloured according to their feature mapping (Flood is blue whereas CarCrash is red)
for the CCMS and the FCMS (where some modelling artefacts only apply to one of the respective products). As can be seen in Fig. 14, variability also occurs at the granularity of attributes of classes, namely the attributes location and mobileNumber of the Victim class. Besides addressing inter-model variability by modelling all variants of a specific subsystem in one model, FeatureMapper also allows to use compositional approaches for addressing variability. An example where cross-cutting changes to models are realized by model weaving based on graph rewriting has been presented in [34]. Another possibility is mapping feature expressions to compositional operators that are directly available in UML, i.e., the UML PackageMerge relationship [35]. Using FeatureMapper, one can directly associate feature expressions to both the merged package (i.e., the package that contains variant-specific refinements to the receiving core package) and the merge relationship. In this case study, we used this way of addressing variability for the realization of the various ExternalServices. Instead of modelling all external services in one model (which might get too large and difficult to manage), we modelled the ExternalServices in dedicated UML Packages that are combined with the core of the CMS using UML PackageMerge relationships. Figure 15 depicts the realization of the various ExternalServices in separate packages that are only merged to the core depending on the evaluation of the assigned feature expression. In this figure, we also show FeatureMapper’s Variant Visualization that gives an overview about the inclusion and exclusion status of different modelling artefacts depending on the selected set of features from the feature model. In this example, we included all external services except for Army and ExternalCompany which is why those packages are coloured different from the other ones. As described in Sect. 3.3, we have extended the product line with a MeasurementUnit feature which consists of the two alternatives MetricSystem and ImperialSystem. Depending on the feature selection, the respective measurement kind should
Relating Feature Models to Other Models of a Software Product Line
89
Fig. 15. Package Model of the ExternalServices using merge relationships between packages to increase modularisation
!"#$$% "$
!"#$$%
Fig. 16. Class Model for different types of Location including property-level variability at the distanceUnit attribute of RoadwayLocation depicted in FeatureMapper’s Property Changes View that highlights parts of models with property-level variability
be used in the design models of the CMS product line. Figure 16 shows the part of the design models which is concerned with describing different kinds of Location. Depending on the selected feature expression, the attribute distanceUnit of the RoadwayLocation class should have a default value according to the feature selection. In Fig. 16 we show the variant for MeasurementUnit AND MetricSystem. To actually assign such changes of model properties to feature expressions, FeatureMapper has a recording mode, where the developer first selects the appropriate feature expression and then performs the actual change to the property (e.g., changing element names, cardinalities, or default values) in the model. This change is recorded internally and assigned to the feature expression in FeatureMapper’s mapping model. For these changes, only one version can be shown directly in the diagrams at any one time. FeatureMapper’s Property Changes View highlights the model elements where property changes occur in the model (cf. Fig. 16) in red. The different alternatives can then be inspected in a dedicated dialog as shown in Fig. 17.
90
F. Heidenreich et al.
Fig. 17. Dedicated dialog in FeatureMapper to inspect property-level variability
5 Application of VML* to the Case Study This section shows how the Variability Modelling Languages from the VML* language family [11] can be applied to the case study. VML* is a family of languages for modelling the mapping between feature models and other models of an SPL (called target models). Each language is customized for the specific target modelling language for which it is to be used. For instance, if in a SPL we are using UML activity diagrams, using VML* we can create a language specifically designed for managing variability in UML activity diagrams. VML* provides a generative infrastructure for efficiently developing such customized languages. To apply VML* to the case study, we must first develop the specific customized VML languages we need. Notice that this step must only be taken once; the languages created can be reused for other SPLs as long as the feature and target modelling languages remain the same. In Sect. 5.1, we will briefly discuss how to create the languages required for this case study. We then discuss the application of each individual language. 5.1 Creating VML Languages VML languages are defined using a so-called language-instance descriptor [11]. A complete support infrastructure can then be generated from the language-instance descriptor. The language-instance descriptor is a domain-specific metamodelling language [36] that allows language developers to model only those parts of a new VML language that need to be customized. All other parts of the language and its support infrastructure are generated and, thus, reused for each language. Figure 18 shows an excerpt from a language instance descriptor for one of the customized languages we will need for this case study: VML4RE, a language for mapping from feature models to requirements models, specifically UML Use Case and Activity diagrams [37]. The full language will be used in Sect. 5.2. The language-instance descriptor makes use of an openArchitectureWare Xtend [38] extension file defining a number of model-transformation operations. For example, in the first section called ‘features’ (Lines 4–8), the language–instance descriptor defines the metamodel for feature models that can be used with VML4RE and also provides the name of an Xtend operation that can extract all defined features from such a feature model. The next section (Lines 11–16) similarly defines the metamodel for target models and a function for finding a set of model elements based on some textual description called a designator.
Relating Feature Models to Other Models of a Software Product Line
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
91
// Define a new language called vml4req vml instance vml4req { // This section defines the type of variability model and how to access it features { metamodel "/bin/fmp.ecore" // Extracts all variability units from a variability model function "getAllFeatures" } // This section defines the type of target model and how to access it target model { metamodel "UML2" type "uml::Package" // Metamodel type of a model // Function to interpret pointcut designators function "dereferenceElement" } // Importing plugins and external specifications ... // Syntactical definition of available actions actions: createInclude { params "List[uml::UseCase]" "List[uml::UseCase]" } insertUseCase { params "String" "uml::Package" } ... // Definition of available evaluation aspects aspects: transformation { // Evaluation for product derivation // Defines adapter for product-configuration access features { type "String" function "getAllSelectedFeatures" } // Definition of the semantics of actions as model transformations createInclude { function "createIncludes" } insertUseCase { function "createUseCase" } ... } tracing { createOps “create* (*)” removeOps “remove* (*)” } }
Fig. 18. Excerpt from a VML* language-instance descriptor for a VML language for mapping feature models to requirements models
VML languages use a notion of pointcuts for referencing points in target models that need to be manipulated when a certain feature has been selected. Thus, the designators to be interpreted by this function may contain wildcards. The ‘actions’ section (Lines 22–29) syntactically defines what actions are available in VML4RE. It can be seen that these actions are specific to the manipulation of use cases and activities. Their semantics is further specified in the final ‘aspects’ section,
92
F. Heidenreich et al.
that allows to define a number of different semantics for different evaluation aspects, such as product derivation (specified in the ‘transformation’ aspect) or tracing. For the product-derivation semantics, we need to specify another adapter (Lines 35–38) that is able to interpret product configurations and extract the selected features. Next, we provide an Xtend implementation function for each action. For the tracing semantics (Lines 48–51), we define pointcuts into our transformation implementation identifying places where new model elements are created or existing ones deleted. On the basis the above approach, we have defined two languages: VML4RE for mapping features to requirements models and VML4Arch for mapping features to architectural and design models. Once we have thus defined the necessary languages, we can apply them to our case study, as will be demonstrated in the following subsections. 5.2 Modelling the Mapping for Requirements Models In this section, we show the mapping for requirements models; that is, the set of core requirements models and how VML4RE can be used to derive product requirement models. Before using VML4RE to manage variability, it is necessary to decide which models are going to be considered as core; i.e., the models which will be manipulated according to the different variants and combinations between them to obtain the product models. Figure 19 shows the considered core use case model for the CMS. Here, we followed a positive variability approach, so this use case model contains use case model elements related with mandatory functionalities only. For example, the model contains the use case Execute Mission. However, at this stage, it does not contain any details about which type of missions are supported by the system, since specific missions are all optional in the feature model of CMS. Since requesting external resources and assigning internal resources are mandatory functionalities across the SPL, they are also present in this figure. We have also specified the variability for more fine grained models, such as scenarios associated with each use case, represented through activity diagrams. For activity diagrams, we have considered as core models several scenarios represented with activity diagrams, such as Assign Internal Resource, Execute Pumping Mission, and Execute Super Observer Mission. For Execute Pumping Mission
Fig. 19. Core use case model for the Crisis management System
Relating Feature Models to Other Models of a Software Product Line
93
and Execute Super Observer Mission we adopted a negative variability approach, so if any of the related features are not selected in a configuration, these model elements are removed from the model. We adopted this strategy since we believe that in some situations, it is preferable to model visually than constructing the same model using a set of textual descriptions. Another observation is that the behaviour included in this scenario is not shared between the two considered configurations, so we haven’t identified too fine grained variability for this scenario. For the rescue mission, we identified some variation points for each of the different configurations (car and flood crisis) but also some common parts. Figure 20 shows the considered core activity model for the rescue mission. This core model contains all behavioural elements which are shared by both car and flood crisis configurations. Figure 21 shows an excerpt of the VML4RE specification for the crisis management system SPL. Lines 6–10 show the variability management when the Rescue feature is selected in a configuration. Given a configuration, if the feature expression in Line 6 evaluates to true, a use case with name Execute Rescue Mission is created (Line 7) and an inherits relationship from this use case to the use case ExecuteMission (which was considered as core) is created (Line 8–9). VML4RE can generate trace links from features to requirements model elements based on actions, since there is implicit trace information in VML4RE specifications. However, VML4RE also offers a specialized operator which allows to explicitly trace features to requirements model elements. In this VML4RE specification, we can see that Lines 11-15 define explicitly a set of trace links from the feature Rescue and activity model elements. In this piece of VML4RE code, we are defining trace links from the feature Rescue to the core actions of Rescue activity model depicted in Fig. 20. Line 18–23 show the variability management for the Public Hospital feature. If this feature is selected, actors, such as Hospital
Fig. 20. Core Activity Diagram for the Rescue Mission Scenario
94 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
F. Heidenreich et al. import features <" CrisisSystemFlood.fmp">; import core <"/CarCrisisSystem.uml">; concern CrisisSystem { variant rescue for Rescue { insertUseCase ("ExecuteRescueMission", "CrisisManagementSystem"); createInherits ("CrisisManagementSystem::ExecuteRescueMission", "CrisisManagementSystem::ExecuteMission"); trace trace trace trace trace }
("ExecuteRescueMission::TransmitInjuryInformation"); ("ExecuteRescueMission::IdentifyVictim"); ("ExecuteRescueMission::RetriveMedicalRecord"); ("ExecuteRescueMission::AdministerFirstAid"); ("ExecuteRescueMission::BringToHospital");
variant public_hospital for PublicHospital { insertActor ("HospitalResourceSystem", ""); insertActor ("FirstAidWorker", ""); createAssociation (or( "HospitalResourceSystem", "FirstAidWorker"), "CrisisManagementSystem::ExecuteRescueMission"); } variant for and ( CarCrash,Rescue) { createAction ("RemoveVictimFromCar", "ExecuteRescueMission"); connectActivityElements("ExecuteRescueMission::dn2", "ExecuteRescueMission::RemoveVictimFromCar", "[isVictimLockedInCar]"); connectActivityElements("ExecuteRescueMission::RemoveVictimFromCar", "ExecuteRescueMission::FinalNode", ""); connectActivityElements("ExecuteRescueMission::dn3", "ExecuteRescueMission::FinalNode", "[false]"); } variant for not Rescue { removeElement("ExecuteRescueMission");//removes the core activity model } variant for and (Rescue ,Flood) { createAction ("RequestSpecialAssistance", "ExecuteRescueMission"); connectActivityElements("ExecuteRescueMission::dn2", "ExecuteRescueMission::RequestSpecialAssistance", "[isVictimHandicapped]"); connectActivityElements("ExecuteRescueMission::RequestSpecialAssistance", "ExecuteRescueMission::FinalNode", ""); createAction ("RecoverVictim", "ExecuteRescueMission"); connectActivityElements("ExecuteRescueMission::dn3", "ExecuteRescueMission::RecoverVictim", "[false]"); connectActivityElements("ExecuteRescueMission::RecoverVictim", "ExecuteRescueMission::FinalNode", ""); } variant for Observe { insertUseCase ("ExecuteSuperObserverMission", "CrisisManagementSystem"); createInherits ("CrisisManagementSystem::ExecuteSuperObserverMission", "CrisisManagementSystem::ExecuteMission"); insertActor ("SuperObserver", ""); createAssociation ("SuperObserver", "CrisisManagementSystem::ExecuteSuperObserverMission"); } variant for not (Observe){ removeElement("ExecuteSuperObserverMission"); } } order (rescue, public_hospital );
Fig. 21. Excerpt from the VML4RE specification for crisis management systems
Resource System and First Aid Worker and respective relationships are also created. Notice that VML4RE’s pointcut expressions allow us to connect all of these actors to their appropriate use cases in one action invocation (Lines 21–22). For this variation point, we use a positive variability approach. The creation of the use case model elements for the feature Public Hospital depends on the previous execution of the
Relating Feature Models to Other Models of a Software Product Line
95
actions related with the variant Rescue (the action depicted in Lines 6–16), so an order of execution must be specified here. VML supports the definition of order of execution between feature expressions. To define an order for this situation, we have named each of the features expressions (rescue and public hospital). The specification of the order of execution can be found in Line 66. Lines 25–33 show the set of actions to be executed if both Rescue and CarCrash features are selected. These actions construct the scenario for the rescue mission in the context of a car crisis (one of the products available for this SPL). The resulting scenario from executing this set of actions is the activity diagram shown in Fig. 6. Variability has also been defined for the rescue scenario in the context of a flood crisis system. Lines 39–50 show the set of actions to execute in the core rescue mission activity model, if both features Rescue and Flood are selected. One important note is that to use connect actions, the elements to connect should be named so that they can be referenced. One example of this is in Line 41, where dn2 indicates one specific decision node of the activity diagram. Because Rescue is an optional feature, it is also possible to have configurations in which the feature is not selected. For these configurations, the core activity mode for Rescue Mission should be removed. Lines 35–37 show the application of the action removeElement (modelElement) for these cases. Figure 21 also contains the variability management specification for the Observe Mission. When the feature Observe is selected, use case model elements related with this feature are constructed for the product model. As we said previously, for the Execute Super Observer Mission scenario (Activity Diagram) we adopted a negative approach. This means that the corresponding activity diagram was included in the core model, and in the case of unselection of this feature (Line 61) in a configuration, we remove this activity diagram (Line 62). The trace links generated by VML* (and thus by VML4RE) can be used to visualize the mapping between features and model elements. Figure 22 depicts part of the generated trace links for the Rescue feature, considering the flood crisis product. The AMPLE Traceability Framework (ATF) [39] offers several visualizations to show trace links. The left part of Fig. 22 shows a tree-based view and the right part shows a graphbased view. In the tree-based view, we can see the trace link between Rescue and Identify Victim. This trace link was created because of the explicit use of the action trace in the VML4RE specification (Line 12 of Fig. 21). On the other hand, a trace link has been generated from Rescue to the use case Execute Rescue Mission, because of the action present in Line 7. The graph-based figure on the right, shows several links created for the flood crisis product. In this view, the elements such as use cases, packages, actors, activity diagrams, actions and features are represented as nodes. Edges are used to represent a link between two elements. For each visual element (a node or an edge), we can also see the properties (type and name) of that element. For example, in Fig. 22 (graph-based view) we can see the properties for the feature Rescue at the top of the window. In this figure, we have also emphasized the set of trace links for this feature using a red rectangle. This view is useful to see how elements are linked—for example to see which requirements elements are shared between different features. We can see that there are two requirements elements (RecoverVictim and RequestSpecialAssistance actions) which are shared between the Flood
96
F. Heidenreich et al.
Fig. 22. Visualization of generated trace links from the feature Rescue to requirements model elements for the flood product using a tree-based view (left) and a graph-based view (right)
and Rescue features. These requirements elements were inserted when generating the product model, because the feature expression in Line 39 of Fig. 21 was true according to the flood crisis feature model configuration. 5.3 Modelling the Mapping for Architecture and Design Models This section describes the results of applying VML4Arch [26, 40] to the Crisis Management System. VML4Arch is a language for specifying the connection between feature models and UML 2.0 architectural models. Figures 23 and 24 show the aspect-oriented decomposition of the software architecture. The Core package contains the elements that are common to all the products. The elements for interacting with a specific external service, such as the Police, are encapsulated into a separate UML package (cf. Fig. 23). The same applies to the elements for managing each particular kind of crisis (cf. Fig. 24).
Fig. 23. Aspect-oriented decomposition of the Crisis Management System (I)
Relating Feature Models to Other Models of a Software Product Line
97
Fig. 24. Aspect-oriented decomposition of the Crisis Management System (II)
Thus, the elements that are common to the data structures for accomplishing any kind of mission (cf. Fig. 8) would be placed in the Core, specifying these data structures must be included in any kind of product derived from this reference architecture. This design is then refined in the CarCrisis and FloodCrisis packages. Each particular kind of crisis adds its own kind of missions and the specific data structures that are required for each kind of mission. For instance, the CarCrisis aspect adds the classes and relationships that are specific for accomplishing CarRescueMissions, i.e. the data structures shown in Fig. 5. Similarly, the data structures depicted in Fig. 5 would be added to the FloodCrisis package. Thus, depending on which features are selected, we need to combine a different set of packages. What packages need to be combined with the core to create a concrete product is specified using VML4Arch (cf. Fig. 25). The product derivation process determined by this VML4Arch specification is as follows: First of all, a new UML package representing the final product being derived is created. This package is called MyCrisisManagementSystem and it is initially empty. This empty package will merge those packages that correspond to selected features, e.g. CarCrisis or Police. The piece of code for creating this package (Fig. 25, line 06) is associated to the root feature of the feature model. Moreover, the MyCrisisManagementSystem package merges the Core package (Fig. 25, line 07), which represents the minimum and core functionality that any Crisis Management System must have. Since the root feature is always selected, this piece of code is always executed and the MyCrisisManagementSystem package is always created and a merge relationship is initially created between this package and the Core package. Merging packages are expressed in VML4Arch using the merge action. UML merge dependencies in the UML model are used to express dependencies between coarsegrained variants. These dependencies represent architectural information about the product line as a whole and are provided by the SPL architect. They must be maintained under any circumstances. The UML merge dependencies introduced through merge actions express which coarse-grained variants should be included in the architecture for a specific product. The merge action will only add its corresponding dependency if this is not already given by transitivity. Hence, given the following merge dependencies in the model: A --merge--> B, B --merge--> C, calling merge (A, C) will not have any effect since that dependency is already in the model by transitivity. In addition, if any other direct dependency becomes redundant, it is removed, for example, given additionally D --merge--> B, calling merge (A, D) will lead to
98
F. Heidenreich et al.
00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
import features <"/cms.fmp">; import core <"/CrisisManagementSystem.uml">; concern CrisisManagementSystem { variant for CrisisManagementSystem { createPackage ("MyCrisisManagementSystem", ""); merge ("MyCrisisManagementSystem", "Core"); } variant for CarCrash { merge ("MyCrisisManagementSystem", "CarCrash"); } variant for Flood { merge ("MyCrisisManagementSystem", "FloodCrisis"); } variant for SurveillanceSystem { merge ("MyCrisisManagementSystem", "SurveillanceSystem"); } variant for not SurveillanceSystem { remove ("SurveillanceSystem"); } variant for MetricSystem { setDefaultAttribute ( "Core::Datatypes::BasicDatatypes::RoadwayLocation.distanceUnit", "Core::Datatypes::BasicDatatypes::RoadwayLocation::KILOMETRES"); } variant for ImperialSystem { setDefaultAttribute ( "Core::Datatypes::BasicDatatypes::RoadwayLocation.distanceUnit", "Core::Datatypes::BasicDatatypes::RoadwayLocation::MILES"); } } // CrisisManagementSystem
Fig. 25. VML4Arch specification for the Crisis Management System
the final situation of A --merge--> D, D --merge-->B, B --merge--> C. Thus, the merge dependencies introduced in the VML4Arch specification are effectively those shown in Fig. 15, where CrisisManagementSystem corresponds to MyCrisisManagementSystem. Figure 23 may give the impression that all types from the Core package are duplicated throughout the product-line model. However, because a product is eventually represented by a single package merging all coarsegrained variants, these redundant copies of Core concepts will be merged into one again, removing all duplication and redundancy.8 8
Note that this implementation of merge is specific to VML4Arch. Other VML* languages may also need a similar action. They are free to use any implementation needed, so they could, for example, be based on [41].
Relating Feature Models to Other Models of a Software Product Line
01 02 03 04
99
variant for and (CarCrash, not (FirstAidMaterial)) { remove ("CarCrash::Datatypes::WaterBottles"); remove ("CarCrash::Datatypes::Blankets"); }
Fig. 26. VML4Arch specification for removing FirstAidMaterial
Fine-grained variations are managed through different VML4Arch operators, which allows, basically, to modified elements from an architectural design model, or remove them. We illustrate two different cases for this. In the first case, the Core package contains a set of data structures for identifying geographical locations (cf. Fig. 10), which must measure distances in different units depending on the country, where the system is deployed. It is decided that, by default, the system is configured for working with the metric system units, so KILOMETERS is specified as default value for the distanceUnit attribute (cf. Fig. 10). In case the Imperial system was selected, this value should be changed. This is made through the VML4Arch code contained in lines 32–36 of Fig 25, which basically says the default value for this attribute must be set to MILES. In the second case, let us suppose the first-aid material is an optional feature, instead of mandatory, inside this product line. WaterBottles and Blankets are considered first-aid material. We can think on separating WaterBottles and Blankets in a separate UML package and merging this package with the CarCrisis package. Nevertheless, as previously commented, this technique would quickly lead to the creation of a large number of small and practically meaningless aspects, with, in most of cases, a complex set of dependencies among them, which would make the design unmanageable. Instead of following this positive strategy, we follow a negative strategy. Thus, we simply leave the WaterBottle and Blanket resource in the design model, and in case the first-aid material feature were not selected, these classes are simply removed from this design model. It should be noticed that this removal should only happen if the CarCrisis option has been selected. Otherwise, if the CarCrisis option is not selected, the package containing this design would be not selected and the removal of these classes would not have any effect, as we can consider they were already removed as the package is not included in the final product. This is specified using the feature expression shown in Fig. 26, line 01. It establishes that, if CarCrisis has been selected, but FirstAidMaterial has not been selected, the classes representing WaterBottles and Blankets would also be removed.
6 Discussion and Comparative Analysis of the Two Approaches In the previous sections, we have shown how two approaches to variability mapping can be successfully applied to the case study. Both approaches were able to produce product models for the two products described in Sect. 3. In this section, we provide a comparative analysis of the two approaches. Table 1 gives an overview of the comparison criteria we have used and how they are met by the two approaches. In the following,
100
F. Heidenreich et al. Table 1. Overview of the comparison between FeatureMapper and VML*
Criterion Expressiveness Modelling Languages Supported
FeatureMapper Fully Generic
VML* Generic through customization Modification All
Variability Mechanisms Supported Negative and Only Support for Feature Expressions Supported Support for Feature Cardinality and No Support Cloned Features Useability and Analysis Support for Automatic product Supported derivation Analysis Support Feature Model, Mapping Model, Multiple Visualizations Accessibility of the Mapping Separate model maintained by Model tool Real-World Models Scalability Direct Annotation Support for Model Evolution Detection of Broken Mappings
Supported No Support
Supported Trace Links Separate model maintained by SPL engineer Pointcut Expressions No Dedicated Support
we first give a more detailed description and motivation of each criterion, followed by a detailed discussion of how two approaches meet each criterion. 6.1 Comparison Criteria Our comparison of VML* and FeatureMapper is mainly based on the application of the two approaches to the common case study, as discussed earlier in this paper, but also on our previous experience with these approaches in other case studies and application scenarios. We have selected nine comparison criteria. These criteria were chosen because they represent general concerns for variability mapping. In particular, the nine criteria can be grouped into three groups based on the general variability-modelling concern they are related to: 1. Expressiveness. This group assembles criteria that describe the variability space that can be covered by a particular approach. These criteria are (a) Modelling Languages supported; (b) Variability Mechanisms supported; (c) Support for Feature Expressions; and (d) Support for Feature Cardinality and Cloned Features. 2. Useability and Analysis. This group assembles criteria that describe the kinds of analyses and evaluations that can be performed and the useability benefits and drawbacks of a particular approach. These criteria are: (a) Support for Automatic Product Derivation; (b) Analysis Support; and (c) Accessibility of the Mapping Model.
Relating Feature Models to Other Models of a Software Product Line
101
3. Real-World Models This group assembles criteria that describe how the approaches deal with properties of real-world models. In particular, these criteria are: (a) Scalability; and (b) Support for Model Evolution. In the following, we briefly discuss each criterion in more detail before Sect. 6.2 applies them to a comparison of VML* and FeatureMapper. Modelling languages supported. With the advent of domain-specific modelling languages, a variability-modelling approach that only supports one modelling language is almost not usable. Some level of genericity in such an approach is, therefore, highly important. This is, especially true with regard to the target modelling language; that is, the language in which the SPL reference model is expressed. However, because to date there is no commonly agreed standard for feature modelling and a range of different types of feature models and tool realizations is available, a variability mapping approach should also have some genericity with regards to the feature-modelling approach used. Consequently, for this criterion, we compare if and how FeatureMapper and VML* can support different modelling languages both for feature modelling and for the target models. Variability mechanisms supported. As discussed in Sect. 2.1, we can distinguish three major variability mechanisms: 1. Negative Variability. 2. Positive Variability. 3. Modification of Model Elements. Both, negative and positive variability, have benefits and drawbacks: Negative variability uses one model of the complete product line, this model can become very complex, as it has to contain model elements for any product in the product line. Some parts of such a model may even contradict each other, making the model potentially very difficult to analyze and understand. Positive variability avoids this problem by separating model elements for each different product into different models. At the same time, this means that there can potentially be a large number of model fragments describing the SPL as a whole, making it difficult to get an easy overview of the SPL. This can potentially make it more difficult to spot feature interactions in the models. In contrast, with a negative variability approach many feature interactions can be identified directly, as all model elements are added to the same model. Therefore, it would be beneficial for a variability-modelling approach to support all forms of variability modelling, possibly even within the same specification, leaving the choice to the SPL designer based on what is best for each situation. Consequently, for this criterion we compare which variability mechanisms FeatureMapper and VML* support. Support for Feature Expressions. The relationship between features and model elements is typically not one-to-one. Instead, a particular combination of features may be realized by a single model element or a single model element may be required for a set of different features (regardless of combination), but not by other features in the SPL. A
102
F. Heidenreich et al.
typical technique enable expression of such more complex mappings is the use of feature expressions; that is, boolean expressions over feature names. Feature expressions are evaluated over product configurations; that is, concrete selections of features from a feature model. A simple feature expression consisting of a feature name only evaluates to true if the named feature is selected in the product configuration. Based on this, more complex feature expressions follow the standard rules for logical combinators. Consequently, for this criterion we compare if and how FeatureMapper and VML* support feature expressions in their variability models. Support for Feature Cardinality and Cloned Features. Feature models in their original form [5] are very good at representing configurative variability, but less good at more structural forms of variability. This issue has been addressed, at least partially, by more advanced forms of feature models, such as, for example, cardinality-based feature models [42]. Even though there are still many situations were it is better to use a domain-specific language for expressing structural variability (for example, where variations in workflows need to be expressed), cardinality-based feature models take an interesting step towards structural variability by allowing features to be selected more than once and with different configurations of their sub-trees. Mapping such so-called cloned features to target model elements poses a number of interesting challenges to variability mapping, which go beyond what is required for the criteria above. Therefore, we introduce a separate criterion for this capability. Consequently, for this criterion, we compare if and how FeatureMapper and VML* provide support for mapping cloned features onto target-model elements. Support for Automatic Product Derivation. Product derivation refers to the creation of models and implementations for a particular product in an SPL based on a selection of a subset of the features from the SPLs feature model. A central goal of all variability mapping is to automate product derivation as much as possible based on an explicit description of features, variant models and implementations, and the mapping between these. Consequently, for this criterion we compare if and how FeatureMapper and VML* automate product derivation. Analysis Support. Another good reason for making the relation between features and target model elements explicit is that it enables analysis. Variability models can be analysed in many different forms ranging from visualizations of different products or feature expressions or the generation of tracing information for example for changeimpact analysis all the way to formal consistency analysis (e.g., [43, 44]). Consequently, for this criterion we compare the types of analyses enabled by FeatureMapper and VML*, respectively. Accessibility of the Mapping Model. Variability modelling means to make the relationships between features and target models explicitly. However, this can be done in a variety of ways and these have an effect on the useability of a variability-modelling approach in particular scenarios. Here, we focus on two dimensions: 1) How is the mapping expressed, and 2) How is the mapping model managed.
Relating Feature Models to Other Models of a Software Product Line
103
Consequently, for this criterion we compare how FeatureMapper and VML* express the mapping as well as how they each manage the variability model and allow SPL developers access to it. Scalability. Real-life SPLs can have large feature sets and very large models. Thus, scalability of any approach to modelling variability becomes an important issue. Although the case study discussed in this paper is not elaborate and detailed enough to obtain precise data on scalability, and some qualitative arguments can be extracted. Our experience with this and a number of other case studies indicates that while some properties of the variability modelling approach can have an impact on scalability, the structure of the SPL model has by far the greater impact. This is so because effectively with SPLs, it is inevitable to make explicit every connection between any feature and its corresponding model variations; that is, the amount of information to be represented is determined mainly by the size of the feature and SPL models and the inherent complexity of their relationship. The simpler the relationship between the two, the more easily can be represented and the larger the SPLs that can still be handled. At one extreme, feature-oriented software development [45] proposes a direct one-to-one mapping between features and implementation modules, making explicit mapping representations virtually unnecessary. However, in practice, this cannot always be achieved perfectly and may lead to unnecessarily many unnecessarily small implementation modules, so an explicit mapping representation is still needed. In our discussion above, we have seen how the choice between variability mechanisms can influence the scalability of our variability models. For example, in the VML4Arch example, we saw how using UML packages and UML merge dependencies could significantly reduce the amount of VML4Arch code to be written for a variability specification. If we were to describe the necessary elements of the CarRescueMission design model as part of the variability model, we would need to create 9 elements (7 classes plus 2 enumerations). Moreover, we would also need to create 11 relationships among these elements. Therefore, we would need approx. 20 lines of VML4Arch code for creating the design model depicted in Fig. 9. Using UML packages and merge relationships, we can reduce the number of VML4Arch lines of code to just one. Moreover, we need only one line of code independently of the size of the model placed in a UML package, as the only thing we need to express is that this package needs to be included in the final product. Each new type of crisis management system only requires adding another package and one line of VML4Arch code. However, at the same time, it is not sensible to represent every variation in its own package. If we were to do so even for, for example, such small variations as the difference between using the imperial and the metric measurement system, we could easily end up with a large number of packages with not much meaningful contents, fragmenting the SPL model to the point of incomprehensibility. Although this discussion applies equally to both approaches discussed, there are some differences between the approaches that may affect scalability. Consequently, for this criterion, we provide a qualitative discussion of different capabilities FeatureMapper and VML* provide for dealing with large models and feature sets. Support for Model Evolution. SPLs are not static and, consequently, variability models cannot be static artefacts. Therefore, it is interesting to discuss what, if any, support
104
F. Heidenreich et al.
for evolution a variability-modelling approach provides. There is a number of dimensions to this criterion. It includes evolution of the metamodels for features or target modelling language. It also includes, however, evolution of the actual feature and target models and the need to co-evolve the variability models along with them. The common case study does not provide any evolution scenarios. Therefore, we cannot directly use the experience from our application of FeatureMapper and VML* to the common case study to provide insights in how the two approaches cope with evolution. However, because we feel this criterion is essential in any variability mapping approach, we decided to include at least some analytical discussion of how FeatureMapper and VML* could deal with model evolution. 6.2 Comparative Analysis of VML* and FeatureMapper In this subsection, we use the criteria from the previous subsection to compare FeatureMapper and VML*. Modelling Languages Supported. While both FeatureMapper and VML* are generic and work for arbitrary modelling languages, there are some differences that are worth discussing in more detail. FeatureMapper is a tool that can work with arbitrary EMF models and supports a range of different editors for these models, including arbitrary GMF-based editors, the standard EMF tree editors, and EMFText-based text editors. In contrast, VML* produces mapping languages for specific modelling languages. Thus, it is, also generically applicable for any EMF model, but only if an appropriate VML language has previously been defined. Consequently, there is an added initial cost to using VML* in a project, in particular if a large number of project-specific or domain-specific languages are used. On the other hand, because VML languages are customized for each modelling language used, they can take into consideration the semantics of these modelling languages, providing much more powerful actions than generic direct mappings between features (or feature expressions) and model elements. As an example, consider VML4Arch’s connect (C1, C2, I) action, that connects components C1 and C2 via interface I. To express the same in FeatureMapper, we would have to produce mappings to the appropriate ports in C1 and C2 as well as to the dependencies between these ports and the interface I. Although connect does not currently support this, it could even easily be extended to create interface I if it does not exist yet. The cost of customising VML* to a particular target language can be decomposed into two parts: (i) the effort needed to implement adapters for dealing with different meta-models and (ii) the effort needed to implement the actions required. With respect to the former, both VML* languages we have discussed (VML4RE and VML4Arch) use feature models based on the FMP plugin for Eclipse and UML Models using the UML plugin for Eclipse, so we were easily able to reuse this code between the two languages. It should be noted, though, that even so the code needed is relatively compact and easily understood (at about 20 lines of recursive navigation code for accessing the UML models; accessing FMP models is more complex due to some special particularities of the FMP metamodel, which hinders its navigation when Xtend is used as model transformation language.)
Relating Feature Models to Other Models of a Software Product Line
105
Table 2. Qualitative and Quantitative Estimated Effort for the VML4RE and VML4Arch languages Criterion Average number of code lines per action Difficult action implementations Action implementations medium difficulty Easy action implementations
VML4RE 5
VML4Arch 14.54
None None
2 2
All
9
In terms of the effort needed to implement the actions in a VML* language, Table 2 provides an overview of some data on the VML4Arch and VML4RE implementations. In particular, it shows the number of lines of transformation code required, on average, per action implementation as well as a subjective judgment of how many of these action implementations were difficult or easy to understand, code and test. More substantive empirical studies are required to provide more robust knowledge about the cost involved in customising VML* to a particular target language, overall because the effort involved in the development of a new VML* language starts to be cost-effective when this language is applied to the development of several SPLs or a same SPL evolves and the VML* language helps to reduce the maintenance cost. This task goes beyond the scope of this paper. However, already from Table 2, it can be inferred that all actions for VML4RE could be implemented with reasonable effort. In the case of VML4Arch, there are some actions, such as merge, which required a bigger effort. It should be taken into account this action must carry out several checks to avoid redundancies, which increases its complexity. However, at the same time, it encapsulates more work than more simple actions, such as, for instance, createPackage. Although more complex, actions such as merge it is expected helps in saving more work each time it is used, because it makes the VML* language more powerful. Other actions, such as connectPorts, becomes complex due to the complexity of the UML metamodel [46]. In this case, the effort required for implementing this action would be similar to the effort required, if we implemented the product-derivation process using a low-level model transformation language, because the complexity is on the target metamodel itself, not in the approach used to manipulate this target metamodel. Therefore, it can be only avoided changing the target metamodel. It should also be noted that the effort required depends heavily on the transformation language used (in the case of VML* this is Xtend). Therefore, these data would not easily generalize other tools using a similar approach, but different transformation language. An important drawback of VML* is that it currently does not support textual modelling languages (where they are not backed by an Ecore-based abstract syntax) and produces no diagram files for visual modelling languages. While FeatureMapper supports any Ecore-based target language, it must be customized with regard to the used feature metamodel. Besides its own feature metamodel, those of pure::variants and FMP are supported and further metamodels can be added via a dedicated extension point. VML* languages can be easily customized for both target and feature modelling language, as
106
F. Heidenreich et al.
long as the feature modelling language provides some notion of selected features in a configuration. Variability Mechanisms Supported. FeatureMapper associates model elements with features (or feature expressions) directly. This makes it difficult to support positive variability, as the model elements to map to must effectively already exist in the core model. When using negative variability only, all different variants must be expressed in the models. This also implies that in some cases, models are created that are not well-formed w.r.t. the corresponding metamodel simply because two alternatives are expressed in one model using a language that was initially not designed for dealing with variability. However, many current modelling editors do not prohibit the violation of certain constraints (especially semantic constraints), which should then be checked and enforced by the respective SPL tool [47]. Having multiple variants in one model can also introduce difficulties in understanding the model and the variability. However, FeatureMapper offers multiple visualizations which can in turn increase understandability by explicitly highlighting parts where variability occurs (e.g., the Colouring View cf. Fig. 11). Using colour coding to distinguish between different feature expressions scales only up to a limited number of colours. Hence, FeatureMapper does not assign colours automatically, but gives the SPL developer the choice on which feature expressions and related modelling elements are of particular interest. In our experience, using up to twelve different colours is still feasible. Although FeatureMapper allows negative variability only, positive variability can be supported indirectly. If the SPL architecture is expressed using some compositional approach (e.g., model weaving or UML package merge) and the composition is available as a model in its own right, FeatureMapper can be used to map feature expressions to parts of the composition model. This negative variability on the composition model effectively implies positive variability using aspects (cf. Sect. 2.1) for the actual SPL model. In contrast to FeatureMapper, in VML* every action is effectively a small transformation of the core model. This means that an action is free to inspect, modify, and add model elements of the core model. VML* can, thus, easily support positive variability and negative variability, as well as any combination thereof. However, there are, a number of remarks to be made: 1. A concrete VML language may restrict the set of variability mapping approaches supported because it only defines actions for some approaches and not for others. We have seen a concrete example in the comparison of VML4RE and VML4Arch above. 2. Mixing negative and positive variability mapping in the same specification may cause problems in product derivation, as the order in which the model transformations are executed becomes important. For example, when negative variability is used to remove a model element from a larger model fragment that is added to the core model using positive variability, it is important that the model fragment is added before the negative-variability remove actions are executed. VML* allows developers to specify the order in which variants are evaluated, but this still places
Relating Feature Models to Other Models of a Software Product Line
107
an additional burden on SPL developers. Using only positive or negative variability throughout simplifies this issue substantially. 3. The richer semantics of VML* actions means that a much richer combination of variability mapping techniques can be used with VML*. At the same time, however, such complex operators (e.g., createAction or createDecisionNode) move the definition and creation of modelling artefacts from the modelling language into the VML* script. Part of the SPL model is, thus, not immediately available in the appropriate modelling notation, but can only be properly inspected after product derivation. This may increase the cognitive load of the SPL designer. Using positive variability with aspects (cf. Sect. 2.1) can help here, as it allows to move most of the model elements back into the original modelling language. Both approaches can cater for modification of model elements. Support for Feature Expressions. Both FeatureMapper and VML* support the use of feature expressions in mapping models. FeatureMapper associates model elements in the SPL models with feature expressions indicating when a particular model element should be present. Users can then also inspect the SPL models using feature expressions to provide an indication of a product configuration to be highlighted in the SPL models. VML* specifications associate feature expressions with descriptions of the modifications of the target model necessary for a configuration satisfying the feature expression. Support for Feature Cardinality and Cloned Features. Neither of the two approaches provide special support for cloned features. This is also true for all other approaches known to us. Support for cloned features is, thus, an important area of future research. Support for Automatic Product Derivation. Both VML* and FeatureMapper support automatic product derivation. VML* provides this support as one possible evaluation semantics of a VML* specification, parameterised with a product configuration. FeatureMapper takes a mapping model and a product configuration as input and transforms the referenced solution-space models accordingly. In case transformation semantics need to be adjusted or refined for a specific modelling language, FeatureMapper offers an extension point where SPL developers can provide their own implementation of the product derivation semantics. Analysis Support. In [47], we have described the necessity to ensure well formedness on all input models, i.e., feature models, mapping models, and solution-space models. FeatureMapper ensures this on feature models by enforcing several constraints (including cross-tree relationships like requiresFeature and conflictsWithFeature). While VML* currently does not support any analysis on feature models, it is certainly possible to implement. For mapping models, FeatureMapper checks whether all referenced features and modelling elements actually exist and informs the SPL developer in case the mapping model is broken. This kind of analysis can also be implemented in VML* (and has been implemented for the feature-model side), where the dedicated editors could inform the SPL developer via problem markers of such problems. Checking all possible variants of solution-space models is not a feasible way to
108
F. Heidenreich et al.
ensure well formedness [43, 44]. In [47], we outline our current and future plans for analysis of solution-space models with FeatureMapper that are based on the ideas of Czarnecki and Pietroszek [48]. Generally speaking, we would expect the formal consistency analysis to be achievable more easily with a declarative approach like FeatureMapper than an operational approach like VML*, because the semantics of the mapping are simpler in the declarative case. Recently, visualization techniques have come into the research focus as an interesting helper in understanding how the selection or unselection of features may affect the diverse models used in the design of the product line [49]. In the case of VML*, the only support provided is in the structure of a VML specification, where all actions are grouped by the feature expression to which they apply. Furthermore, trace links can be extracted from a product-derivation run based on a VML specification. These trace links relate features and created or removed model elements directly and can subsequently be used for visualization purposes. However, because the VML actions are small model transformations instead of direct mappings between features and model elements, a VML specification cannot directly be used for creating a visualization. Furthermore, a VML specification transforms models at the level of their abstract syntax, it does not produce a concrete-syntax representation (e.g., a diagram file or a textual representation of the model). This can make inspecting the result of product derivation difficult. In contrast, one of the key features of FeatureMapper is the rich set of visualizations available. An SPL designer can choose to view only model elements associated with an arbitrary feature expression, or with a product configuration. She can also view all model elements, but have them coloured according to the feature expression to which they have been allocated. All of these visualizations are made possible because FeatureMapper uses a much more generic semantics of the relation between features and model elements. In effect, there seems to be a trade-off between richness of the modelling concepts for variability mapping and ease of visualization creation. Accessibility of the Mapping Model. As mentioned previously, there are two dimensions to this criterion: 1) How is the mapping expressed, and 2) How is the mapping model managed. How is the mapping expressed? VML* is an operational approach (see Fig. 1). It expresses the mapping between features and model elements indirectly by specifying modifications of the target model in response to the selection or deselection of particular features (or feature expressions). The mapping model is expressed in textual form using terminology that has been customized to be close to the terminology SPL designers use when constructing the original target model. FeatureMapper, on the other hand, is a declarative approach using a separate annotation model (see Fig. 1). This has the benefit of making the mapping model much easier to comprehend as well as more amenable to analysis and visualization. At the same time, however, it limits the range of variability mechanisms that can be easily modelled in FeatureMapper (cf. the discussion on variability mechanisms earlier in this section). How is the mapping model managed? VML* leaves the creation and maintenance of the mapping model completely to the SPL developer. The tool only reads the model when it is asked to perform a specific action, such as product derivation. In contrast, with FeatureMapper the tool manages the mapping model and creates it from particular
Relating Feature Models to Other Models of a Software Product Line
109
gestures SPL developers make using the tool’s graphical user interface. The model is stored and maintained as an Ecore-based model that can be easily processed by FeatureMapper or any other tool that supports EMF. It is more difficult to read and maintain for SPL developers, who instead use FeatureMapper’s Associated Elements View to inspect the mapping model. Creation and update is intended (but not limited) to involve the FeatureMapper tooling. Scalability. As we have already mentioned in the introduction of the scalability criterion above, the biggest impact on scalability is in the structure of the SPL models. However, the variability-modelling approach can have some impact on scalability as well. FeatureMapper requires a single mapping relation to be constructed for every model element to be associated with a feature expression. In contrast, VML* allows pointcuts to be used to construct a set of mapping relations between model elements in one go (see Lines 15–16 in Fig. 21 for a simple example; in addition, VML* pointcuts also support the use of wildcards). This may reduce the number of lines of VML specification required for expressing the same variability and may, thus, contribute to overall scalability of the approach. Of course, because pointcuts come with their own wellknown issues such as pointcut fragility and potential increased complexity, the question of how much this really contributes to scalability cannot be answered easily. More detailed and quantitative studies of more complex systems are required to obtain a better answer to this question. Although FeatureMapper does not provide a dedicated pointcut language, it can utilise arbitrary Ecore-based AOM approaches, e.g., Reuseware [50] or XWeave [16], by mapping feature expressions to the respective composition programs. Eventually, this removes or keeps the composition program depending on the evaluation result of the assigned feature expression. Support for Model Evolution. As mentioned above, model evolution can be discussed both at the model and the metamodel level. Furthermore, we can discuss evolution of feature models (and metamodels), target models (and metamodels), and the mapping metamodel itself. Evolution of the mapping model corresponds to normal editing of this model, so no separate discussion is required for this case. FeatureMapper has a stable mapping metamodel which did not change since its initial design. It is very unlikely that it will be extended or changed in the near future, but if so, existing mapping models would need to be updated. This can be done automatically using model transformations. However, updating existing mapping models is only needed when existing metamodel elements are renamed, deleted or otherwise restructured in an evolution step. EMF handles additions to metamodels quite gracefully [12]. In contrast, VML* supports mapping-language evolution in the sense that it allows defining new or deleting existing operators when needed. Evolving the VML language by adding new operators is expected during an SPL’s life cycle, since its variations and the way the models must be manipulated changes over time according to new requirements, needs and products. In case the feature model changes in the sense that features referenced in a mapping model are renamed or removed, all mappings that reference this feature need to be updated accordingly, potentially all related target model elements must be removed
110
F. Heidenreich et al.
as well. Of course, this is not an automated task, but FeatureMapper helps the developer to identify the relevant mappings by highlighting them in the Associated Elements View where a warning symbol and an explanatory message are displayed next to the broken mapping. Similarly, VML* checks whether features referenced in a feature expression actually exist in the feature model and marks places in the specification that reference non-existent features. When a new feature is added to the feature model no problems will arise when generating products, however, modelling the corresponding model elements and managing its variability is necessary. No particular support for this is required or offered by FeatureMapper or VML*. Of course adding and removing features or model elements can cause impact on other model elements, and some restructuring of the model and VML script can be necessary. However, this is part of the SPL process, which is creative with small iterative improvements that can impact the overall SPL structure. Where the feature metamodel changes, a new adapter is required for both VML* and FeatureMapper. Because both tools can be configured with such adapters for feature models, changes in the feature metamodel should not cause major problems. Of course, any feature models will need to be adjusted to the new feature metamodel, but this task is independent of the use of FeatureMapper, VML*, or any other variability-modelling approach. When a target model changes, if only elements are added, no problems will arise in the VML* script during product derivation, because all model elements referenced by the script are already there. However, the VML* script may need to be updated to manage the variability of the newly added elements to get the expected product when deriving products. If a negative variability approach is being used to manage variability of these new functionalities, the VML* operators should be used to remove these elements when the correspondent features are not selected. If elements of the domain model are deleted or renamed and those elements are referenced by the VML* script, the script must be updated accordingly, otherwise problems will arise when deriving products. The removal of elements in the domain model can occur because functionalities represented by the removed elements are not needed anymore in the SPL context, or when migrating from a negative approach to a positive approach. In the latter case, the elements deleted from the domain model must be created through VML* operators. Currently, VML* does not support SPL developers in identifying broken links to target model elements. However, this is due to the prototype nature of the tooling rather than to any unsolved technical or conceptual issues. In contrast, FeatureMapper again uses the Associated Elements View to provide error messages where referenced model elements have been deleted or renamed. When the target metamodel changes, FeatureMapper mapping models do not require additional adaptations (apart from adaptations required by changes to the target model as a result of the changes to the target metamodel). In the VML* case, it may become necessary to define new operators or modify the definitions of the existing operators. This in turn may require adaptations to the mapping model itself. An interesting research area worth investigating is the synchronized refactoring of feature models, mapping models, and solution-space models. Initial work in this direction has been presented in [51].
Relating Feature Models to Other Models of a Software Product Line
111
Table 3. Overall comparison of FeatureMapper and VML* FeatureMapper + + + +
Multiple visualizations Fully generic Automatic product generation Support for feature expressions
– Positive variability not directly supported – No support for cloned features
VML* + + + +
Support for all variability mechanisms Generic Automatic product generation Support for feature expressions
– Very limited visualization support – Cost of language customization – No support for cloned features
7 Conclusions We have compared two approaches to modelling the relationship between features and SPL models—FeatureMapper (cf. Sect. 4) and VML* (cf. Sect. 5). Table 3 summarizes the comparison giving an alternative view in Table 1. On balance, both approaches were very well suited for the variability in the case study, but with slightly different objectives. FeatureMapper is especially good for visualizing the variability in a product line and is based on a generic approach, meaning their is no initial overhead in applying it to any EMF-based modelling language. VML* is based on customising a language for each target modelling language, potentially incurring some setup cost at the beginning of a project, but this also allows for much richer semantics in the mapping specification. In terms of scalability, the key factor appears to be not the specific approach to variability mapping, but the way in which the solution-space models are structured. Thus, we argue that both approaches can be expected to scale approximately equally well. While a number of these points are specific to the two approaches compared and cannot be easily generalized, some points appear to be of a more general nature. In particular, it seems that the simpler semantics of declarative approaches makes it easier to provide analysis and visualization capabilities, while at the same time limiting the variability mechanisms that can be supported.
Acknowledgements The work presented has been supported by the European Commission through the FP6 STREP AMPLE (Aspect-Oriented and Model-Driven Product-Line Engineering), by the German BMBF through the FeasiPLE project and by the Spanish Ministry of Science and Innovation Project TIN2008-01942/TIN.
References 1. Kienzle, J., Guelfi, N., Mustafiz, S.: Crisis management systems: A case study for aspectoriented modeling. Transactions on Aspect-Oriented Software Development 7, 1–22 (2010) 2. Clements, P., Northrop, L.: Software Product Lines: Practices and Patterns. Addison-Wesley, Reading (2002)
112
F. Heidenreich et al.
3. Pohl, K., B¨ockle, G., van der Linden, F.J.: Software Product Line Engineering: Foundations, Principles and Techniques. Springer, Heidelberg (September 2005) 4. American Heritage: The American Heritage Dictionary. Houghton Mifflin, Boston, MA (1985) 5. Kang, K., Cohen, S., Hess, J., Novak, W., Peterson, S.: Feature-oriented domain analysis (FODA) feasibility study. Technical Report CMU/SEI-90-TR-0211990, Software Engineering Institute (1990) 6. Batory, D., Sarvela, J.N., Rauschmayer, A.: Scaling step-wise refinement. IEEE Transactions on Software Engineering 30(6), 355–371 (2004) 7. Czarnecki, K., Antkiewicz, M.: Mapping features to models: A template approach based on superimposed variants. In: Gl¨uck, R., Lowry, M. (eds.) GPCE 2005. LNCS, vol. 3676, pp. 422–437. Springer, Heidelberg (2005) 8. Haugen, Ø., Møller-Pedersen, B., Oldevik, J., Olsen, G., Svendsen, A.: Adding standardized variability to domain specific languages. In: Proceedings of the 12th International Software Product Line Conference (SPLC 2008), pp. 139–148. IEEE, Los Alamitos (2008) 9. Heidenreich, F., Kopcsek, J., Wende, C.: FeatureMapper: Mapping Features to Models. In: Companion Proceedings of the 30th International Conference on Software Engineering (ICSE 2008), pp. 943–944. ACM, New York (May 2008) 10. Morin, B., Perrouin, G., Lahire, P., Barais, O., Vanwormhoudt, G., J´ez´equel, J.M.: Weaving variability into domain metamodels. In: Sch¨urr, A., Selic, B. (eds.) MODELS 2009. LNCS, vol. 5795, pp. 690–705. Springer, Heidelberg (2009) 11. Zschaler, S., S´anchez, P., Santos, J., Alf´erez, M., Rashid, A., Fuentes, L., Moreira, A., Ara´ujo, J., Kulesza, U.: VML* – a family of languages for variability management in software product lines [52] 12. Steinberg, D., Budinsky, F., Paternostro, M., Merks, E.: Eclipse Modeling Framework, 2nd edn. Pearson Education (2008) 13. Heidenreich, F., Johannes, J., Karol, S., Seifert, M., Wende, C.: Derivation and Refinement of Textual Syntax for Models. In: Paige, R.F., Hartman, A., Rensink, A. (eds.) ECMDA-FA 2009. LNCS, vol. 5562, pp. 114–129. Springer, Heidelberg (2009) 14. Ziadi, T., H´elou¨et, L., J´ez´equel, J.M.: Towards a UML Profile for Software Product Lines. In: van der Linden, F.J. (ed.) PFE 2003. LNCS, vol. 3014, pp. 129–139. Springer, Heidelberg (2004) 15. Loughran, N., S´anchez, P., G´amez, N., Garcia, A., Fuentes, L., Schwanninger, C., Kovacevic, J.: Survey on State-of-the-Art in Product Line Architecture Design. Technical Report Deliverable D2.1 (March 2007), AMPLE project http://www.ample-project.net 16. Groher, I., Voelter, M.: XWeave: Models and aspects in concert. In: Proceedings of the 10th International Workshop on Aspect-Oriented Modeling (AOM 2007), pp. 35–40. ACM, New York (2007) 17. Schauerhuber, A., Schwinger, W., Kapsammer, E., Retschitzegger, W., Wimmer, M., Kappel, G.: A survey on aspect-oriented modeling approaches. Technical report, Vienna University of Technology (2007) 18. Heidenreich, F., Henriksson, J., Johannes, J., Zschaler, S.: On language-independent model modularisation [53] pp. 39–82 19. Whittle, J., Jayaraman, P., Elkhodary, A., Moreira, A., Ara´ujo, J. (eds.): MATA: A Unified Approach for Composing UML Aspect Models Based on Graph Transformation [53], pp. 191–237 20. Fuentes, L., Nebrera, C., S´anchez, P.: Feature-oriented model-driven software product lines: The TENTE approach. In: Yu, E., Eder, J., Rolland, C. (eds.) CAiSE 2009, pp. 67–72 (2009)
Relating Feature Models to Other Models of a Software Product Line
113
21. Greenwood, P., Bartolomei, T.T., Figueiredo, E., D´osea, M., Garcia, A.F., Cacho, N., Sant’Anna, C., Soares, S., Borba, P., Kulesza, U., Rashid, A.: On the impact of aspectual decompositions on design stability: An empirical study. In: Ernst, E. (ed.) ECOOP 2007. LNCS, vol. 4609, pp. 176–200. Springer, Heidelberg (2007) 22. Lahire, P., Morin, B., Vanwormhoudt, G., Gaignard, A., Barais, O., J´ez´equel, J.M.: Introducing variability into aspect-oriented modeling approaches. In: Engels, G., Opdyke, B., Schmidt, D.C., Weil, F. (eds.) MODELS 2007. LNCS, vol. 4735, pp. 498–513. Springer, Heidelberg (2007) 23. Beuche, D., Papajewski, H., Schr¨oder-Preikschat, W.: Variability Management with Feature Models. Science of Computer Programming 53(3), 333–352 (2004) 24. Ziadi, T., J´ez´equel, J.M.: Software product line engineering with the UML: Deriving products. In: Proceedings of the 10th International Software Product Line Conference (SPLC 2006), pp. 557–588 (2006) 25. Botterweck, G., O’Brien, L., Thiel, S.: Model-driven derivation of product architectures. In: Proceedings of the 22nd International Conference on Automated Software Engineering (ASE 2007), pp. 469–472 (2007) 26. S´anchez, P., Loughran, N., Fuentes, L., Garcia, A.: Engineering languages for specifying product-derivation processes in software product lines. In: Gaˇsevi´c, D., L¨ammel, R., Van Wyk, E. (eds.) SLE 2008. LNCS, vol. 5452, pp. 188–207. Springer, Heidelberg (2009) 27. Krueger, C.W.: Gears white papers (2006), http://www.biglever.com/learn/whitepapers.html 28. Bakal, M., Krueger, C.W.: The rhapsody/gears bridge - spl for mdd. In: Proc. of the 11th Int. Conference on Software Product Lines (SPLC) - Workshops, Kyoto, Japan, pp. 139–140 (September 2007) 29. Groher, I., Voelter, M.: Aspect-Oriented Model-Driven Software Product Line Engineering [53], pp. 111–152 30. Kienzle, J., Abed, W.A., Klein, J.: Aspect-Oriented Multi-View Modelling. In: Proc. of the 8th Int. Conference on Aspect-Oriented Software Development (AOSD), Charlottesville, Virginia, USA, March 2009, pp. 87–98 (2009) 31. Heidenreich, F., S¸avga, I., Wende, C.: On Controlled Visualisations in Software Product Line Engineering. In: Proceedings of the 2nd International Workshop on Visualisation in Software Product Line Engineering (ViSPLE 2008), collocated with the 12th International Software Product Line Conference (SPLC 2008) (September 2008) 32. The FeatureMapper Project Team: FeatureMapper (July 2009), http://www.featuremapper.org 33. The Topcased Project Team: TOPCASED (July 2009), http://www.topcased.org 34. Heidenreich, F., Wende, C.: Bridging the gap between features and models. In: 2nd Workshop on Aspect-Oriented Product Line Engineering (AOPLE 2007) co-located with the 6th International Conference on Generative Programming and Component Engineering, GPCE 2007 (2007), http://www.softeng.ox.ac.uk/aople/ 35. Object Management Group: UML 2.2 infrastructure specification. OMG Document (February 2009), http://www.omg.org/spec/UML/2.2/ 36. Zschaler, S., Kolovos, D.S., Drivalos, N., Paige, R.F., Rashid, A.: Domain-specific metamodelling languages for software language engineering. [52] 37. Alf´erez, M., Kulesza, U., Weston, N., Araujo, J., Amaral, V., Moreira, A., Rashid, A., Jaeger, M.C.: A metamodel for aspectual requirements modelling and composition. AMPLE Deliverable D1.3 (2007), http://ample.holos.pt/gest_cnt_upload/editor/File/public/ AMPLE_WP1_D13.pdf
114
F. Heidenreich et al.
38. Efftinge, S.: openArchitectureWare 4.1 Xtend language reference (August 2006), http://www.openarchitectureware.org/pub/documentation/4.1/ r25_extendReference.pdf 39. Anquetil, N., Kulesza, U., Mitschke, R., Moreira, A., Royer, J.C., Rummler, A., Sousa, A.: A model-driven traceability framework for software product lines. Journal Software and Systems Modeling (2009) (Published on-line first, June 29, 2009) 40. Loughran, N., S´anchez, P., Garcia, A., Fuentes, L.: Language support for managing variabil´ (eds.) SC 2008. LNCS, vol. 4954, pp. ity in architectural models. In: Pautasso, C., Tanter, E. 36–51. Springer, Heidelberg (2008) 41. Fleurey, F., Baudry, B., Ghosh, S., France, R.: A generic approach for automatic model composition. In: Aspect Oriented Modeling (AOM) Workshop colocated with MoDELS 2007 (2007) 42. Czarnecki, K., Helsen, S., Eisenecker, U.: Staged configuration using feature models. In: Nord, R.L. (ed.) SPLC 2004. LNCS, vol. 3154, pp. 266–283. Springer, Heidelberg (2004) 43. Janota, M., Botterweck, G.: Formal approach to integrating feature and architecture models. In: Fiadeiro, J.L., Inverardi, P. (eds.) FASE 2008. LNCS, vol. 4961, pp. 31–45. Springer, Heidelberg (2008) 44. Thaker, S., Batory, D., Kitchin, D., Cook, W.: Safe composition of product lines. In: Proc. 6th Int’l Conf. Generative Programming and Component Engineering (GPCE 2007), pp. 95–104 (2007) 45. Apel, S., K¨astner, C.: An overview of feature-oriented software development. Journal of Object Technology (JOT) 8(5), 49–84 (2009) 46. France, R.B., Ghosh, S., Dinh-Trong, T.T., Solberg, A.: Model-Driven Development Using UML 2.0: Promises and Pitfalls. IEEE Computer 39(2), 59–66 (2006) 47. Heidenreich, F.: Towards systematic ensuring well-formedness of software product lines. In: Proc. 1st Workshop on Feature-Oriented Software Development. ACM Press, New York (October 2009) 48. Czarnecki, K., Pietroszek, K.: Verifying Feature-Based Model Templates Against WellFormedness OCL Constraints. In: Jarzabek, S., Schmidt, D.C., Veldhuizen, T.L. (eds.) Proc. 5th Int’l Conf. Generative Programming and Component Engineering (GPCE 2006), pp. 211–220. ACM, New York (2006) 49. ViSPLE organisers: International Workshop Series on Visualisation in Software Product Line Engineering (ViSPLE) (2008–2009) 50. Heidenreich, F., Johannes, J., Zschaler, S.: Aspect orientation for your language of choice. In: Proceedings of the 11th International Workshop on Aspect-Oriented Modeling (AOM at MoDELS 2007) co-located with the 10th International Conference on Model Driven Engineering Languages and Systems (MoDELS 2007) (October 2007) 51. S¸avga, I., Heidenreich, F.: Refactoring in feature-oriented programming: Open issues. In: Proc. Workshop on Modularization, Composition, and Generative Techniques for Product Line Engineering, Department of Informatics and Mathematics, University of Passau, pp. 41–46 Technical Report MIP-0802 (October 2008) 52. Gray, J., van den Brand, M. (eds.): Proc. 2nd Int’l Conf. on Software Language Engineering (SLE 2009). Springer, Heidelberg (2009) 53. Katz, S., Ossher, H. (eds.): Transactions on Aspect-Oriented Software Development VI. LNCS, vol. 5560. Springer, Heidelberg (2009)
Aspect-Oriented Development Using Protocol Modeling Ashley McNeile1 and Ella Roubtsova2 1
Metamaxim Ltd, 48 Brunswick Gardens, London W8 4AN, UK [email protected] 2 Open University of the Netherlands, Postbus 2960, 6401DL Heerlen, The Netherlands [email protected]
Abstract. The aim of this paper is to explore the modeling of crosscutting behavioral abstractions. We argue that behavioral aspects can be seen as a particular kind of more general behavioral abstraction called a “mixin”. Mixins support a compositional style of modeling, whereby a complete class definition is constructed by composing one or more mixins each of which represents a partial definition of the class. If used as the replacement for inheritance, mixins can provide an expressive power equivalent to multiple inheritance. In this paper we use a modeling semantics called Protocol Modeling to illustrate how mixins can be used to represent behavioral aspects. We use the Crisis Management System case to illustrate the Protocol Modeling approach, and describe how the model can be executed to give early validation of its behavior. We discuss the extent to which the Protocol Modeling approach is scalable to large problems, is suitable for evolutionary development and supports correctness analysis and testing.
1
Introduction
Behavioral modeling languages can be seen as the next generation of abstract programming languages. This suggests that they are executable and capable of representing all the abstractions that have to be implemented in a final system. Objects, Services, Aspects, Components and Agents have to find their place and be distinguished in models. But a unified framework that supports all of these different types of abstraction using a common semantic base has yet to be found, perhaps because the behavioral semantic constructs currently used in modeling are not appropriate to this challenge. The Protocol Modeling approach [7] experiments with new semantic constructs for describing system behavior in terms of event protocols. The approach supports a highly compositional style of modeling, whereby a complete class definition is constructed by composing one or more partial definitions called mixins. If used as the replacement for inheritance, mixins can provide an expressive power equivalent to multiple inheritance [15]. But while mixins have S. Katz et al. (Eds.): Transactions on AOSD VII, LNCS 6210, pp. 115–150, 2010. c Springer-Verlag Berlin Heidelberg 2010
116
A. McNeile and E. Roubtsova
been supported as constructs in programming languages1 they have not generally been seen as a construct in modeling languages, which have tended to employ hierarchical inheritance structures. However, as we demonstrate, mixinbased modeling is a viable alternative with the potential for wider expressive power. In Protocol Modeling, behavioral mixins are used as the building blocks of a model. They are used both to construct inheritance-like relationships (A is a “kind of” B) and also to separate out common behavior that is shared by a number of different entity classes. The modeling constructs of Protocol Modeling allow one mixin to abstract over the events, states and data of others, so that a single element of one mixin matches, or joins to, a number of different elements in other mixins. This gives the compositional calculus a flavor of “weaving” that is a feature of aspectual styles of software design. We suggest, therefore, that mixins composed in this way can be seen as a technique of aspectual modeling. In this paper we illustrate and justify this claim using a protocol model of a Crisis Management System [20], a case study developed by J¨ org Kienzle, Nicolas Guelfi and Sadaf Mustafiz for the comparative study of aspect-oriented modeling techniques. This paper is organized as follows: Section 2 provides an overview of the semantics of Protocol Modeling. Section 3 describes how Protocol Modeling is used to describe the classes of a system, their behavior and associated business process. Section 4 describes how a protocol model is built in stages using the information provided in a typical requirements specification. Section 5 describes our protocol model of the Crisis Managements System case and shows how Protocol Modeling embodies an aspectual style of modeling. Section 6 describes briefly how, in general, a complete protocol model is converted into a final, deployable, system. Section 7 classifies Protocol Modeling among other aspect-oriented approaches and emphasizes the features of Protocol Modeling that make it aspect-oriented. Section 8 discusses some practical considerations in Protocol Modeling, including some barriers to its use and the support it gives for model execution and testability, evolutionary development, scalability and determination of correctness. Section 9 contains related work and conclusions.
2
Protocol Modeling
In this section we provide an overview of the semantics of Protocol Modeling, sufficient to enable understanding of our solution to the Crisis Management System (CMS) case. A complete account of Protocol Modeling can be found in McNeile and Simons [7]. 1
For example: Lisp, Simula, Python and Smalltalk.
Aspect-Oriented Development Using Protocol Modeling
2.1
117
Events
In Protocol Modeling, the basis of behavior specification is identification of occurrences of interest in the environment (or domain). These occurrences are taken to be atomic and instantaneous. An “event” (more properly “event instance”) is the data representation of an occurrence in the environment as a set of data attributes. Every event is an instance of an event type. The type of an event determines its metadata (or attribute schema), this being the set of data attributes that completely define an instance of the event type. This approach to modeling occurrences in the domain as events is identical to that used in other event-based modeling approaches, such as those described by Jackson and Cook et al. [21,30]. 2.2
Protocol Machine
A Protocol Machine (hereafter referred to as just “machine”) is a reusable behavioral component of the model. A machine has a defined alphabet of event types that it understands. When a machine is presented with an event it will either ignore it, accept it or refuse it as follows: – If the event is not in its alphabet, the machine ignores it. – If the event that is in its alphabet, it will either accept it or refuse it. – Acceptance or refusal of an event by the machine is determined by protocol rules that are owned by the machine and that the machine evaluates both before and after the event. The protocol rules of a machine are normally depicted using a state transition diagram, where the transitions exiting a state show the event types that the machine accepts in that state. It is important to understand that “refusal” means that the machine is unable to handle the event at all in its current state, and this normally means that some kind of error message is generated back to the environment. How or where such an error message is generated is not of concern for modeling purposes. Between handling events, a machine has a well-defined quiescent state, meaning that it can undergo no further change of state unless and until presented with a new event. 2.3
Local Storage
A machine has local storage which only it can alter, and only when moving to a new state in response to an event. The local storage of a machine is represented as a set of attributes associated with the machine. A machine may read, but not alter, the local storage of other machines with which it is composed. A machine may use its accessible storage (its own local storage and the local storage of other machines composed with it) to compute
118
A. McNeile and E. Roubtsova
updated values of its own attributes when processing an event, and to compute the value of derived attributes. In addition, a machine may use its accessible storage to compute its own state, as we describe next. 2.4
Derived States
A protocol machine may have its state derived on-the-fly rather than being stored as part of the machine’s local storage. This is exactly analogous to the concept of a derived attribute, as defined in modeling approaches such as UML [24]. The states of a derived state machine determine what events it accepts and what events it refuses and in this sense the fact that states are derived makes no difference to their use as determinants of the machine’s behavior. For clarity of semantics, we do not mix derived and stored states in the definition of the same machine (although it is possible to compose derived and stored state machines using CSP parallel composition as described later in Section 2.6). Note that machines with derived state are not “topologically connected” as the new state that results from a transition firing is not determined as the end point of a transition. Further discussion can be found in the literature on Protocol Modeling [7]. 2.5
Modal Semantics
We shall see later when discussing Use Cases in Section 4 that derived states enable the definition of machines that have modal semantics, describing what is desired rather than simply what is possible. These machines are used to model the fact that the system may decide that a particular event is required and may solicit or prompt the event from the actor responsible for performing it. This gives protocols the expressive power to express workflow. The idea of using modal machines to describe workflow rules has been described by McNeile and Simons [8]. 2.6
Composition
A protocol model of a system is a non-empty finite set of protocol machines. Each machine presents a partial behavior and these partial behaviors work together to create the behavior of the system. The machines of a model are composed using a parallel composition operator (PQ)2 essentially the same as that defined by Hoare in his process algebra, Communicating Sequential Processes [10]: – The alphabet of the composed machine is the union of the alphabets of the constituent machines; and the local storage of the composed machine is the union of the local storages of the constituent machines. 2
Protocol Modeling approach also supports other composition forms [5,14] for composition of distributed abstractions. However, these composition forms are beyond the scope of this paper and we do not discuss them.
Aspect-Oriented Development Using Protocol Modeling
119
– When presented with an event the composed machine behaves as follows: 1. If both machines ignore the event, the composed machine ignores it; 2. If either machine refuses the event, the composed machine refuses it; 3. Otherwise the composed machine accepts the event. It is clear from this definition that the concept of event refusal 3 is critical to composition. 2.7
Concurrency and Determinism
Protocol machines are deterministic in the sense that executions of a protocol model are repeatable. If a given sequence of events is presented to a model twice starting from the same initial state, the final state of the model will be the same, as will be the set of events that it could accept next. The reason for requiring determinism is the ability that gives to argue about behavior based on traces4 . There is, however, no assumption that non-determinism may not be introduced at physical design time if it is decided to distribute the model across multiple (real or virtual) processors; but this must be done in such a way that the behavior of the model is not broken by such a distribution. Worker
Person
Want Log In created
Create Worker
log in not wanted
Delete Worker
Victim
log in wanted
Log In
deleted added
Employee Log In
Add Victim
CMS Employee Coordinator Create Crisis
Create Worker created
Create Worker
Set Login Create Worker Create Worker
See also Figure 3. Log In
logged out
logged in Log Out
created
Fig. 1. Graphical Representation (Fragment of CMS)
3
Representation of a Protocol Model
In this section we illustrate how models are described in ModelScope, the tool that we have used for developing and testing our model of the CMS case study. Using examples from the CMS case study, we illustrate how the various features of Protocol Modeling are used to address the requirements of the CMS system. Later, in Section 8.2, we discuss how ModelScope is used to explore and validate models. 3 4
Note that event refusal is not supported by the conventional semantics of UML statecharts [12]. Note that determinism is not guaranteed by the conventional semantics of UML statecharts [12].
120
3.1
A. McNeile and E. Roubtsova
Events and Machines
The event Create Worker is described as follows: EVENT Create Worker # Brings a new worker into existence ATTRIBUTES Worker: Worker, Person Name: String, Address: String, Date of Birth: Date, Expertise: Mission Type
This lists the ATTRIBUTES for this event type and describes each using attribute name: attribute type. The protocol machine Worker is described as follows: BEHAVIOUR Worker # A worker, either Internal or External INCLUDES Person STATES created, deleted TRANSITIONS @new*Create Worker=created, created*Delete Worker=deleted
This description gives the possible states, {created, deleted}, for a Worker and describes the behavior rules as a set of TRANSITIONS. Each transition is represented as starting state*event type=resulting state. The state @new represents the initial state of the machine, the “black dot”. It can be seen that this textual representation describes the state transition diagram shown in the central box at the top of Figure 1 (this diagram is a part of the overall protocol model of CMS that we describe later in the paper). Note that the graphical representation is partial, in that it does not show the attributes. The INCLUDES entry specifies that whenever the Worker machine is instantiated, an instance of the Person machine must be created too and composed with it. The Person machine is: BEHAVIOUR Person # Attributes shared by all types of Person ATTRIBUTES Person Name: String, Address: String, Date of Birth: Date
In this case, the included machine defines local storage attributes but does not define any behavior (transitions). The result of the composition is that a Worker will include the attributes defined in Person. The INCLUDES is the Protocol Modeling analogue of inheritance, but is a composition operator and to emphasize this difference we use a semi-hatched arrow (as opposed to the open arrow used for inheritance in UML Class Diagrams). The Person machine can be seen as more abstract than Worker as it is used by other machines: for instance, it is also used by Victim: OBJECT Victim # A Victim of a Crisis NAME Person Name INCLUDES Person
Aspect-Oriented Development Using Protocol Modeling
121
ATTRIBUTES Crisis: Crisis, Medical Condition: String STATES added TRANSITIONS @new*Add Victim=added
As can been seen here, a machine can be defined with both ATTRIBUTES and TRANSITIONS. When a Victim is instantiated, its local storage is the union of the set of attributes in the Victim and Person machines, following the semantics of composition in Section 2.6. The Victim machine is concrete (instantiable) and this is indicated by the use of the keyword OBJECT instead of BEHAVIOUR, and the inclusion of the NAME entry which specifies which attribute to use to identify instances of Victim in the ModelScope user interface. In the graphical view, as in Figure 1, we use the double outline for the enclosing box to indicate that a machine is concrete. 3.2
Structure of a Model
The INCLUDES structure of the mixins forms a partially ordered set5 (or “poset”). This is normal structure for model elements that represents multiple inheritance, as a given element may include more than one child and may be included in more than one parent. Note that this structuring is not apparent from the diagrams (Figures 1, 5 and 6) which have been drawn to fit in the limited space of a page. Given more space, these diagrams could be refactored to show the semi-hierarchical form of a partially ordered set, with all of the INCLUDE arrows pointing upwards. As an example, consider Coordinator. This is instantiatable (it uses the keyword OBJECT) and creation of its instance entails instantiation of one of each of machines{Coordinator, CMS Employee, Worker, Person, Employee Log In, Want Log In}: this being the transitive closure of its INCLUDES relationships shown in Figure 1. With the exception of Person, all of these machines have behavior and so, in accordance with Section 2.6, the total behavior for Coordinator is the CSP composition of the behaviors of these machines. 3.3
Attribute Handling
The convention in Protocol Modeling is that when an object (an assembly of machines) accepts an event the values of the event attributes transfer to matching attributes of the object. So, when a Create Worker event is accepted by the model, the values of {Person Name, Address, Date of Birth} will be given to the new Worker instance created. It is possible to define more complex updates with explicit update logic where required. We shall show examples of this later in the paper. 3.4
Derived States
As described in Section 2.4, some of the machines in a model can have derived rather than stored states. The Want Log In machine at the top right of Figure 1 5
A poset consists of a set together with a transitive binary relation that indicates that, for certain pairs of elements in the set, one of the elements precedes the other.
122
A. McNeile and E. Roubtsova
is an example, as is the machine Employee Log In in Figure 3. The ! prefixing the name of the machine tells ModelScope that it has to execute a function to determine the state of the machine. The code that calculates the state for the Want Log In machine is shown in Figure 2 and that for Employee Log In in Figure 3 (below the diagram). In the graphical form we use the double outline to the states to indicate that the state is derived. As mentioned in Section 2.4, machines with derived states are not “topologically connected” as the state value is not driven by transitions. The state value @any means “any state”. package AOMCase; import com.metamaxim.modelscope.callbacks.*; public class WantLogIn extends Behaviour {
Ties this java class with the machine “Want Log In”
public String getState() { //Login is wanted if there is at least one outstanding Assignment Request for this Employee Instance[] myAssignmentRequests = this.selectByRef("Assignment Request", "Internal Resource"); boolean logInWanted = false; for (int i = 0; i < myAssignmentRequests.length; i++ ) { if (myAssignmentRequests[i].getState("Assignment Request").equals("outstanding")) { logInWanted = true; } Gets all the “Assignment Request” } machines associated with this return logInWanted ? "log in wanted" : "log in not wanted"; “Internal Resource” (= Employee) } Returns the state of the machine.
}
Checks if this “Assignment Request” is still outstanding
Fig. 2. State Derivation of the “Want Log In” Machine
3.5
Modal Machines
As described in Section 2.5, some machines may have modal semantics for describing workflow. An example is the machine Want Log In which determines that an employee has outstanding requests for mission assignments and should therefore log into the system to attend to them. The ModelScope definition of the machine is below. The entry TYPE DESIRED defines this as a modal machine. BEHAVIOUR !Want Log In # Makes a login desired if there is an # outstanding Assignment Request for the Employee TYPE DESIRED STATES log in wanted, log in not wanted TRANSITIONS log in wanted*Log In=@any
As already noted, this machine has a derived state as indicated by the ! prefixing its name. 3.6
Actors
The machines of a model represent the objects of the domain and capture how events change the states of these objects. We also have to consider who is responsible for an event and this is modeled using the concept of Actors 6 . Different 6
Essentially the same as the concept of Actor in UML Use Cases.
Aspect-Oriented Development Using Protocol Modeling
123
events in the same machine may be the responsibility of different actors. As an example, consider the events in the Employee Log In machine in Figure 1. Responsibility for the Create Employee event, which sets up a new Employee in the system, falls to the System Admin Department 7 . However, the Log In event, which is also in the alphabet of this machine, is done by the employee him\herself in order to access the system. Actors are modeled completely separately from the machines and their behavior, and serve to configure the user interface so that each Actor gets an interface containing only the behaviors and events from the model that are appropriate to his\her responsibility. An example of an ACTOR definition is given below. ACTOR System Admin BEHAVIOURS CMS Employee, Crisis Type, Mission Type, Needed Mission EVENTS Create Worker, Set PDA Number, Set Login, Reset, Create Crisis Type, Create Mission Type, Make Needed
Actors form a separate layer that configures the user interface for the different users of the system. The Actor layer does not change the behavior of the underlying protocol model.
4
Building a Protocol Model
The starting point for building a protocol model can vary depending on the nature and stage of the project. Sometimes a general understanding of the area and the purpose of modeling is all that is available; and sometimes a detailed requirements document has been prepared. We will describe the process that is followed when starting from a written document such as that provided for the Crisis Management System [20] (hereafter referred to as “the CMS Spec.”), as this is quite typical. Before describing the process, one aspect of Protocol Modeling needs to be emphasized as it differs significantly from traditional approaches: the intention and best practice in building a protocol model is that it is executable and testable throughout the process of building an evolving model. This is useful and desirable even if the final code of the system is being hand-crafted rather than generated. We discuss the reasons for doing this later, in Section 8.2, and it is also well explored in the authors’ paper [4]. The process of building a protocol model is described below as a number of steps, but this is somewhat artificial. While the ordering of the steps does give the flavor of the normal strategy for building a model, in practice the process is very iterative and decisions can be revisited and changed at any time. 4.1
Step 1: Model the Domain
The starting point for building a protocol model is typically a Domain Model, such as that shown in Figures 4 and 5 of the CMS Spec. Using this, we proceed as follows to get to a first version of the model: 7
See Section 2.4.2 of the CMS Spec.
124
A. McNeile and E. Roubtsova
– Create an instantiable machine (using keyword OBJECT) for every concrete object in the model. – Specify the ATTRIBUTES for each machine. These are normally given as part of the Domain Model. – Define the lifecycle of each object, in terms of its STATES and the EVENTS that bring an instance into existence and change its state. The lifecycle will not be part of a standard Domain Model, which is normally just a static model. To find out the lifecycle, other artifacts such as Use Cases or Business Processes (Activity Diagrams) are used, or discussions held with domain experts. This will result in a first cut protocol model, which can be executed. At this stage the executable model allows domain objects to be instantiated and taken through their lifecycles. 4.2
Step 2: Model Associations
As well as describing the dynamics of the creation and state changes of objects, a protocol model also describes the dynamics of associations between objects: how associations between objects are created and dissolved. Associations are created by events that appear in the lifecycle of more than one object. For example, the Domain Model in Figure 4 of the CMS Spec. shows associations between Crisis and Crisis Type, and between Crisis and Coordinator. These associations are created by the event Create Crisis that appears in the lifecycles of Crisis, Crisis Type and Coordinator. The second step of building a model is to add events to the basic model formed in Step 1 to create and dissolve the associations in the model. Often, many of these will be already be there as a result of Step 1 but this is not always the case. In addition, the attributes of the objects in the model are checked to ensure that they contain appropriate foreign keys for the associations, thus the Crisis object should have attributes to hold the identifier of the associated Crisis Type and Coordinator. The result is a model in which the associations between objects can be created and dissolved. 4.3
Step 3. Model Inheritance
The third step is to model the inheritance. This involves refactoring the model by using abstract, non-instantiable, machines (using keyword BEHAVIOUR) to factor out attributes and/or behaviour that is common to multiple objects. Very often, the Domain Model identified the candidate inheritance relationships and these can be copied in the protocol model. Thus, the inheritance structure for various kinds of people and workers shown on the left hand side of Figure 5 in the CMS Spec. has been used to create an identical mixin structure in the protocol model shown in Figure 6. Note the following: – It is not necessarily a good idea to copy all inheritance relationships in the Domain Model. For instance, the Domain Model shows (Figure 4 in the CMS
Aspect-Oriented Development Using Protocol Modeling
125
Spec.) Car Crash as a specialization of Crisis Type. However, copying this would “hard wire” the different types of crisis that the system can handle into the model. Instead, we have made the Crisis Types “soft”, so that new types can be introduced into the system at run-time (using the Create Crisis Type event). – Protocol Modeling has natural support for multiple inheritance, whereas Domain Models are commonly built using only single inheritance and are correspondingly constrained in the specialization/generalizarion relationships that can be shown. For instance, Mobile Employee and Vehicle should (in our view) both be specializations of Resource, but this would require Mobile Employee to specialize from two parents. This constraint does not exist in Protocol Modeling, and in our model Mobile Employee INCLUDES (=specializes) both CMS Employee and Internal Resource.
Employee Log In (Refined version) 2
Security Password := Set Login.Password;
1
Entered Password := Log In.Password; Tries:= Tries + 1;
uninitialized
Set Login
Log In
logged out
Entered Password := “”; Tries:= 0;
trying
3
Log In Set Login 1
Security Password := Set Login.Password;
logged in
violation Log Out
Reset
package AOMCase; import com.metamaxim.modelscope.callbacks.*; public class EmployeeLogIn extends Behaviour {
State calculation. Returns exactly one of the values highlighted in red, indicating which state the machine is in.
public String getState() { // Derived State calculation if (this.getString("Security Password").equals("")) return "uninitialized"; if (this.getInteger("Tries") == 0) return "logged out"; if (this.getInteger("Tries") <= 3 && this.getString("Entered Password").equals(this.getString("Security Password"))) return "logged in"; if (this.getInteger("Tries") >= 3) return "violation"; return "trying"; } public void processSetLogin (Event event, String subscript) { this.setString(“Security Password", event.getString("Password")); }
1
public void processLogIn (Event event, String subscript) { this.setString("Entered Password", event.getString("Password")); this.setInteger("Tries", this.getInteger("Tries") + 1); }
2
public void processLogOut (Event event, String subscript) { this.setString("Entered Password",""); this.setInteger("Tries",0); }
Store the entered password as the security it password d against i t which hi h to t compare when someone tries to log in.
Store the entered password to compare against the security password and add one to the number of tries.
3
public void processReset (Event event, String subscript) { this.setString("Entered Password",""); this.setInteger("Tries",0); } }
Fig. 3. Refined Employee Log In Machine
Reset values.
126
4.4
A. McNeile and E. Roubtsova
Step 4. Refine Machine Behavior
Normally the behavior built into a model in the early versions is a simplification of the actual requirement, and is refined and improved in later steps. This refinement can involve refining the definition of a machine already defined in the model, or adding new machines. For instance, in Figure 5, the machine Employee Log In (near the top right of the diagram) is a na¨ıve description of logging on, as it assumes that the Log In event will always work. This may be a reasonable assumption at early stages, so that basic testing of the model can take place, but does not take into account the fact that the password must be checked, or that there is a limit on the number of attempts that may be made, or the possibility that no password has yet been setup. To model these, the simple machine shown in Figure 5 is replaced by the one shown in Figure 3. This has the same two states as the original (logged in and logged out) but adds new states unitialized (for the case where no password has been set up), trying (for the case where the user is trying to enter a correct password) and violation (for the case where the user has exceeded his\her attempt limit). The new machine has a derived state rather than a stored one, but whether a state is derived or stored is private to a machine so does not complicate the substitution. Finally, note that the new machine requires a new event Reset to reset the machine if it is in the violation state.
package AOMCase; import com.metamaxim.modelscope.callbacks.*; public class AccomplishInternalMission extends Event {
Ties this java class with the event “Accomplish Internal Mission”
public void handleEvent() { //Send the Accomplish Internal Mission event to the model to change its state to accomplished this.submitToModel(); //Unassign all Resources for this Mission Instance[] myAssignedResources = this.getInstance("Mission").selectByRef("Internal Resource", "Mission"); for (int i = 0; i < myAssignedResources.length; i++) { Event releaseResource = this.createEvent("Release Internal Resource"); releaseResource.setInstance("Internal Resource", myAssignedResources[i]); releaseResource.submitToModel(); } Sends a “Release” event to release the Gets all the “Internal Resource” } “Internal Resource” from the “Missiom”. machines associated with this “Mission”. }
Fig. 4. Automated Events to Release Resources on Mission Accomplishment
4.5
Step 5. Model Event Automation
The steps so far have assumed that all events are initiated from outside the system. However, systems commonly initiate some events internally. For example, when a Mission is reported as accomplished, the System could automatically release all resources assigned to the mission. This kind of event automation requirement is addressed by associating a piece of logic with an event, executed when an event is accepted by the model that generates further automated events. This is indicated by prefixing the EVENT entry with !. Thus, !Accomplish Internal Mission has logic associated with it as shown in Figure 4.
Aspect-Oriented Development Using Protocol Modeling
127
Other examples of use of this technique in the CMS model are: – Adding a Witness if the initial report of the Crisis contains a witness report (attached to !Create Crisis). – Determining what kinds of Internal and External Mission are needed for a Crisis and creating recommendations to the Coordinator for such Missions (attached to !Make Recommendations). – Finding a suitable Internal Resource for a newly confirmed Mission and creating a Request Allocation (attached to !Confirm Mission). – Finding another suitable Internal Resource if a request for assignment is declined (attached to !Decline Request). 4.6
Step 6. Define the Actors
As pointed out Section 3.6, the actor responsibility for events is modeled separately from the underlying protocol machine model, using ACTORS. This is normally done once the model is substantially complete but before validating against Use Cases. 4.7
Step 7. Validate against Use Cases
The final stage is to validate the model against Use Cases. Generally, we take the view that Use Cases should be viewed as test cases whose satisfaction is necessary (but not sufficient) for acceptability of the model. Sometimes validation of the protocol model behavior against Use Case description can reveal the need to nuance the behavior of the system by adding modal machines, as described in Section 2.5. For example, Use Case 3 Step 1a.1 in the CMS Spec. says that “System requests the CMS Employee to login” and this is represented as a modal machine, Want Log In, which determines that the employee needs to log into the system in order to either accept or reject requests to be assigned to a mission. In ModelScope, an event that has been determined to be needed by a modal machine is highlighted in green in the user interface.
5
Protocol Model of the CMS Case Study
Our protocol model of the CMS case study is illustrated graphically in Figures 5 and 6. This graphical representation is intended as an overview and shows all the machines of the protocol model, their states and their protocol (what events are allowed in each state). It does not, however, show how data are handled: it omits attribute definitions, calculations for derived states and attributes, and the algorithms for generation of automated events. The full source of the model, including the full definition of data handling, can be downloaded from the Metamaxim website [6]8 . The ModelScope execution tool is also available from this site. 8
The model is available at: www.metamaxim.com/download/models/CMS.zip
128
A. McNeile and E. Roubtsova
Worker
Person
Want Log In created
Create Worker
log in not wanted
Delete Worker
log in wanted
Log In
deleted
Employee Log In
Victim
Set Login
added Add Victim
CMS Employee
Create Worker Create Worker
Create Worker created
External Worker
See also Figure 3. Log In
logged out
logged in Log Out
Coordinator Create Crisis Create Worker
Mobile Employee
Worker Location Create Worker
created Set PDA Number
Create Worker
Report Location
First Aid Worker
created created
Status Update
Super Observer
Car
created Create Worker
Vehicle
Truck
created
Ambulance
Internal Resource
Create Vehicle
Request Assignment Create Internal Resource
Add Witness Details
Witness created
available
complete
Add Witness
Assign Internal Resource assigned
Release Internal Resource
Report Verification Request Report Verification unchecked
Video Verification
report correct
Request Video Verification
Report Correct verification requested
Add Witness
report fake
External Resource System
Video Correct verification requested
unchecked
Report Fake
video correct
Create External Resource
Request Report Verification
Create Phone Company created
Video Fake
Add Witness video fake
Make Needed External, Recommend External Mission
Phone Company
Surveillance
Request Video Verification
Create Surveillance
Fire Station
created
Police Station created
Fig. 5. Protocol Model of the Crisis Management System (1 of 2)
Aspect-Oriented Development Using Protocol Modeling
Mission Type
Crisis Closable
Mission Set Recommendation
Make Needed, Recommend Internal Mission Create Mission Type
missions recommended Make Recommendations
created created
Make Needed, Make Needed External, Create Crisis
Crisis Type
Crisis
outstanding missions
Add Witness, Add Victim, Recommend Internal Mission, Recommend External Mission
Create Crisis
Create Crisis Type
Close Crisis
no outstanding missions
Create Crisis
notified
created
Close Crisis
closed
Mission Recommendation
External Mission Recommend External Mission
Accomplish External Mission
Confirm Mission created
accomplished
confirmed
Recommend not Mission resourced Confirm Mission confirmed Make Needed, created Recommend Internal Mission, Create Worker Accomplish Reject Mission Mission
Internal Mission Request Assignment, Assign Internal Resource
Recommend Internal Mission
Confirm Mission confirmed
created
rejected
Accomplish Internal Mission
accomplished
Mission Resourcing Status
accomplished resourced
Request Assignment
Accomplish Internal Mission
not resourced
Assignment Request Decline Request
declined
outstanding
A or D not wanted
Accept Request
Accept Request
Want Accept A or D wanted
accepted
Decline Request
Needed External Mission
not logged in
Needed Mission
Make Needed External
Logged In Check logged in Restricted Event
Make Needed needed
needed
Fig. 6. Protocol Model of the Crisis Management System (2 of 2)
129
130
5.1
A. McNeile and E. Roubtsova
CMS Domain Model
Most of the machines in our model correspond exactly to the classes in the Domain Model given in [20]. These are the shaded machines shown in Figures 5 and 6 of this paper, and their INCLUDE structure, shown using semi-hatched arrows, corresponds to the inheritance hierarchy of the Domain Model. The other, non-shaded, machines Figures 5 and 6 of this paper fall into two categories. Some are further domain objects that we have identified as needed to support functionality required in the CMS application. Others represent behavior that is sensibly modeled separately from the main behavior of an object and then included as a separate machine. In some cases this separated behavior is shared by more than one domain object, in which case it is included in all those to which it is relevant. Two examples from Figure 5 in the CMS model are: – The machine Internal Resource that is included in Mobile Employee and Vehicle. This machine models the ability of an object to be requested for, and then possibly assigned to, a mission. – The machine Worker Location that is included in Mobile Employee and External Worker. This machine models the ability of a mobile worker to report his\her current location. In both cases, the included machine handles an aspect of behavior that is separate and essentially orthogonal to that of the host machine. Because a protocol machine recognizes events from its own alphabet and ignores other events, it is both possible and natural to identify such behavioral aspects, concerned with different subsets of the overall alphabet of the object, and model them as separate machines. The resulting structure of behavioural aspects supports multiple inheritance of both data and behavior. In this sense, behavioral aspects in Protocol Modeling are not a “bolt on” added to model cross-cutting concerns, but the prime tool of modeling. 5.2
CMS Use Cases
As we described in Section 4.7, we use Use Cases to validate that the behavior in the model is able to address the various ways in which it is intended that the system will be used. We have verified our protocol model against all the Use Cases using this technique. We illustrate below how our protocol model meets the requirements expressed in three of the key Use Cases in the CMS Spec. UC1: “Resolve Crisis” . UC1.1 Coordinator captures witness report. Event Create Crisis allows a Coordinator to set up a Crisis and capture a Witness report at the same time. Further reports may be added using event Add Witness.
Aspect-Oriented Development Using Protocol Modeling
131
UC1.2, UC1.3 System recommends to Coordinator the missions that are to be executed based on the current information about the crisis and resources. Coordinator selects one or more missions recommended by the system. When the Coordinator creates a Crisis, the included machine Mission Set Recommendation is also created. Using the event Make Recommendations the Coordinator can ask the System to create an appropriate set of Internal Mission and External Mission machines (the types of mission recommended for a crisis is based on information previously set up to define the needed Mission Types for each Crisis Type). Each instantiated mission machine includes a Mission Recommendation machine that keeps track of whether the mission is confirmed or rejected. This machine offers two events, Confirm Mission and Reject Mission, allowing the Coordinator to select which of the system recommended missions are actually to be executed. Because the behavior for recommending or rejecting missions is identical for both internal and external missions, we use a common behavior Mission Recommendation and generic events Confirm Mission and Reject Mission for both. UC1.4 For each internal resource required by a selected mission, System assigns an internal resource. When the Coordinator uses Confirm Mission, the system finds an available Mobile Employee with the right expertise (found in his attributes) and creates an Assignment Request machine to request assignment of the employee to the mission. This machine allows the Employee to either Accept Request or Decline Request. If the Employee declines the request, the System automatically finds another candidate and instantiates a new Assignment Request machine for this candidate. UC1.5 For each external resource required by a selected mission, System requests an external resource. This step is similar to UC1.4. UC1.6. Resource notifies System of arrival at mission location. When an instance of machine Mobile Employee is created an instance of the included machine Worker Location is created too. This machine allows an Employee to use event Report Location to notify the system of his\her arrival at mission location. UC1.7. Resource executes the mission. An Employee uses event Status Update to update his\her own status and the status of the mission. UC1.8. Resource notifies System of departure from mission location. An Employee uses the event Report Location to report departure. UC1.9. In parallel to steps 6-8, Coordinator receives updates on the mission status from System. The information available from the events Report Location, Status Update and Accomplish Mission are available to the Coordinator.
132
A. McNeile and E. Roubtsova
UC1.10. In parallel to steps 6-8, System informs Resource of relevant changes to mission (crisis) information. The information available from the events Report Location, Status Update and Accomplish Mission are available to the Employees. UC1.11. Resource submits the final mission report to System. The Employee uses event Accomplish Mission to submit a final report. UC1.12. In parallel to steps 4-8, Coordinator receives new information about the crisis from System. The events Add Witness and Add Victim of machine Crisis are used to add further information about the crisis. UC1.13. Coordinator closes the file for the crisis resolution. The Coordinator uses event Close Crisis in machine Crisis to close the file. Event Close Crisis is possible when there are no outstanding missions. This state is derived by machine Crisis Closable. UC2: “Capture Witness Report”. UC2.1, UC2.2. Coordinator provides witness information to System as reported by the witness. Coordinator informs System of location and type of crisis as reported by the witness. These are modeled by the protocol machine Witness with the corresponding events Add Witness and Add Witness Details. UC2.2a.1, UC2.2a.2. System contacts PhoneCompany to verify witness information. PhoneCompany sends address\phone information to System and the extended requirement UC2.5a. PhoneCompany information does not match information received from Witness. These are modeled as machine Report Verification which is instantiated with acceptance of event Add Witness. UC2.2a.2 and UC2.5a represent different outcomes of witness verification modeled as events Report Correct and Report Fake leading to the corresponding states report correct and report fake. UC2.3a.1, UC2.3a.2 System requests video feed from SurveillanceSystem. SurveillanceSystem starts sending video feed to System and UC2.3a.3 System starts displaying video feed for Coordinator. These are modeled by machine Video Verification which is instantiated with acceptance of event Add Witness. UC2.5b.Camera vision of the location is perfect, but Coordinator cannot confirm the situation that the witness describes or the Coordinator determines that the witness is calling in a fake crisis.
Aspect-Oriented Development Using Protocol Modeling
133
This requirement represents a negative outcome of the verification. The video verification should definitely contain a positive outcome of verification which is omitted from the requirements. UC10: “Authenticate User”. This use case presents a commonly recognized Security aspect, modeling password protected access to functionality of a system. UC10.1. System prompts CMSEmployee for login id and password. This is captured by the state not logged in of protocol machine Employee Log In either that shown in Figure 5 or its refined version shown in Figure 3. UC10.2. CMSEmployee enters login id and password into System. This requirements specifies attributes of event Log In, namely Login and Password. UC10.2a. CMSEmployee cancels the authentication process. This is modeled by two possibilities. One possibility is that the employee has not yet succeeded in supplying a correct password. In this case he is not logged on and can just walk away. The other possibility is that he has succeeded in supplying a correct password. He is now logged in, so can log out. UC10.3.System validates the login information. These requirements are modeled by the refined version of Employee Log In shown in Figure 3. The Log In event is allowed provided the system is not states logged in or violation. The state of Employee Log In is computed by comparing the security password in the system with the password entered in the Log In event. If they do not match but the maximum number of tries (3) has not been exceeded, Employee Log In is in the state trying. If the passwords are identical and the maximum number of tries has not been exceeded Employee Log In is in the state logged in. UC10.3a, UC10.3a.1, UC10.3a.1a. System validates the login information. System fails to authenticate the CMSEmployee. CMSEmployee performed three consecutive failed attempts. If the security password in the system with the password entered do not match and the maximum number of tries (3) has been exceeded, Employee Log In is in the state violation. The state can only be reset to logged out using the Reset event. 5.3
Some Observations
A requirements document is never perfect, and building a protocol model helps identify gaps and inconsistencies. In particular, the discipline of identifying the protocol states of every object, and determining the events that cause entry and exit from every identified state, helps to ensure the completeness and coherence of the behavioral requirements. The illustrations of this from the CMS case are:
134
A. McNeile and E. Roubtsova
– No means is provided for defining how the system should determine what missions to recommend for a crisis (UC1.2, UC1.3). The system must have knowledge of the relationship between crisis types and mission types to do this. – Video verification (UC2.3a.2 and UC2.5b) should require a positive confirmation of verification. No means of doing this is given. – The need for a Reset (or a time out) (UC10) if the number of password tries is exceeded, is not discussed in requirement document.
6
From Model to System
While the protocol model of a system is an executable artifact, it is not, in general, deployable as the final system. Work is required to create an implementation that has the appropriate physical characteristics. Information from the protocol model can be directly used in this process, and an example is the extraction of an Entity Relationship Model. The attributes of the machines, given in the ATTRIBUTES entries of the machines in the model, are examined to identify those that represent “foreign key” pointers. These are the attributes that are typed using other machines: for instance, Expertise: Mission Type in Mobile Employee. Such foreign key attributes
Surveillance
Phone Company Crisis Type
1
1 1
0 …*
0 …*
Witness
Victim
Person Report Verification Video Verification
Person
1
1
0…*
0…*
0…*
Needed External Mission
Needed Mission
0…* 1
0…*
1
0…*
Crisis 0…*
1
Mission Set Recommendation Crisis Closable 0…*
1
Mission Type
1
1
1 0…*
1 0…*
Coordinator
First Aid Worker Mobile Employee Internal Resource Mobile Employee Worker Location Resource CMSInternal Employee Worker Location Worker CMS Employee Person Worker Employee Log In WantPerson Log In Employee Log In Want Log In
Mission Recommendation
0…*
0…*
Internal Mission
p y CMS Employee Worker Person Employee Log In Want Log In
Super Observer
External Mission
Mission Recommendation Mission Resourcing Status
1
1
Police Station 1 0…*
1
1
Fire Station External Resource System External Resource System
0…* 0…*
Assignment Request 0…* 1
1
0…1 0…1
Ambulance Car Vehicle Truck Internal Resource Vehicle Internal Resource Vehicle Internal Resource
Fig. 7. Entity-Relation Model of the Crisis Management System
Aspect-Oriented Development Using Protocol Modeling
135
can be used to create the “entity relationship” model shown in Figure 7, for instance the Expertise attribute results in the relationship marked with a star. This model can then be used as the basis of database design using traditional design techniques. The extraction of this model from the protocol model can be automated. The techniques and mechanisms used to convert a protocol model into a final system design depends on a number of factors, including the technology platform and the need to integrate with a pre-existing software architecture. Sometimes the process can be entirely mechanized and sometimes it cannot. Discussion of this is beyond the scope of this paper.
7
Aspect-Orientation of Protocol Modelling
In this section we discuss the claim of Protocol Modeling to be an aspect-oriented approach, and the way in which aspects have been used in our solution to the case study. 7.1
CSP Composition as Weaving
The basis for any claim to support aspects is a notion of weaving, whereby two independently defined parts of a model are combined but without explicit invocation, such a method or subroutine call. The mechanism for composition in Protocol Modeling is CSP composition, as described in Section 2.6. The semantics of CSP composition can be thought of as “trace weaving” whereby the sets of traces of individual protocol machines are woven to form the set of traces of the system as a whole. Because it works by synchronizing machines on events that are in the alphabets of both, CSP weaving uses events as join points. It is in these terms that we discuss the aspect orientation of Protocol Modeling. 7.2
Quantification of Event
Events in a protocol model may be described at different levels of abstraction using GENERIC events. This has two uses: – Where a number of different event types have the same treatment and effect in a given context. The difference between those event types may be abstracted away in contexts where the difference is immaterial. – To facilitate re-use, by allowing the creation of a generic definition that has different interpretations in different contexts. An example is of the first of these is Restricted Event, defined as: GENERIC Restricted Event # Events only allowed when an Employee is logged in MATCHES Accept Request, Decline Request
This abstraction is used in the machine Logged In Check at the bottom left of Figure 6 to model the fact that certain events are restricted (not possible) unless an Employee is logged into the system, but Logged In Check does not itself need to differentiate between the different kinds of restricted event.
136
A. McNeile and E. Roubtsova
An example of the second is Create Internal Resource, defined as: GENERIC Create Internal Resource # Events that can create an Internal Resource MATCHES Create Worker, Create Vehicle
When the model is run in ModelScope the following messages relating to it are generated as the model is compiled: Generic Generic Generic Generic Generic
‘Create ‘Create ‘Create ‘Create ‘Create
Internal Internal Internal Internal Internal
Resource’ Resource’ Resource’ Resource’ Resource’
in in in in in
object object object object object
‘Ambulance’ expands to: Create Vehicle ‘Car’ expands to: Create Vehicle ‘First Aid Worker’ expands to: Create Worker ‘Super Observer’ expands to: Create Worker ‘Truck’ expands to: Create Vehicle
Here the compiler is interpreting this generic event appropriately for the context9 . Most of the weaving that takes place in a protocol model is defined in terms of the event types of the domain. In this case, the weaving is completely symmetric and there is no formal way of distinguishing the “base behavior” and the “advice”. However, as these examples show, the use of generic events provide for a degree of quantification, whereby a single join point in the model, specified as the label on a transition, can match multiple labels in other machines and/or can match a different label depending on context. When generic events are used, there is asymmetry between the machines that are woven and we can identify the machine that uses the generic as representing the “advice”. In the CMS case study there are 4 uses of generic events. 7.3
Symmetric Approach
One view of aspect-oriented software development is that every major feature of the system: core concern (business logic), or cross-cutting concern (additional features), is an aspect, and by weaving them together (a process also called composition), you finally produce a whole out of the separate aspects. This approach is known as the symmetric (or pure) aspect approach. However, asymmetric (or hybrid) approaches, where a base model is built using one technique and aspects are applied to it using a specialist aspect language, are more commonly used perhaps since then there is less of a paradigm shift between object and aspect orientation10 . Within this classification, Protocol Modeling is clearly a symmetric aspectoriented approach, as there is no difference in syntax and semantics between a protocol machine that models an aspect and any other protocol machine in the model. 7.4
Derived States as Join Points Refinements
It is worth mentioning that using derived states can help provide economy and clarity in the expression machine behavior and interaction under composition. 9 10
This uses a technique in Protocol Modeling called conditional repertoire entries, which is described fully in [7]. This is a form of polymorphism. See the Wikipedia entry on “Aspect” at: http://en.wikipedia.org/wiki/Aspect (computer science)
Aspect-Oriented Development Using Protocol Modeling
137
package AOMCase; import com.metamaxim.modelscope.callbacks.*; public class LoggedInCheck extends Behaviour { public String getState() { //Determines whether the Employee is logged in or not return (this.getInstance("Internal Resource").getState("Employee Log In").equals("logged in")) ? "logged in" : "not logged in"; } }
Fig. 8. State Derivation in Logged In Check
For instance, the state derivation function of the machine Logged In Check shown in Figure 8 abstracts over the states of the machine Employee Log In (the refined version shown in Figure 3). Thus, the state not logged in of Logged In Check represents any of the states {logged out, trying, violation} of Employee Log In. This machine can then be used to make a more succinct definition of the constraints that being logged in versus not logged in has on the behavior of the system as it only expresses these two states. 7.5
Mixins as Aspects
When modeling a system, the structure of the model will be dominated by the model architect’s view of the key elements of the model and their relationships and connections. The more a core modeling language imposes and constrains the structure of a model, the less likely that all the elements of a problem and their relationships can be accommodated, as the structure chosen for some elements necessarily means that others cross-cut. This is sometimes referred to, for instance by Ossher and Tarr, as the “Tyranny of the Dominant Decomposition”[17]. This problem is immediately manifested with single inheritance structures, where the single hierarchy of the class structure is the tyrant, and the modeler has to resort to using a asymmetric approach, with a specialist aspect language being used to model those elements which clash with the main structure of the model. This is, in general, not the case with a mixin-based inheritance approach supporting multiple inheritance. As Filman and Friedman observe: “In using inheritance to achieve aspects, single superclass inheritance systems require all aspects to match the class structure of the original program, while multiple inheritance systems allow quantification independent of the programs dominant decomposition. Mixins with multiple inheritance are thus a full aspect-oriented programming technology”[25]. A similar observation is made by Apel et al. [28]. The use of mixin-based inheritance in Protocol Modeling qualifies it as aspectoriented. This is true, in particular, because the means by which mixins are combined is CSP composition, and this entails weaving of trace behavior. However, the aspects are pervasive in the model rather than being invoked as an exceptional technique to handle cross-cutting concerns. To avoid structural tyranny it is necessary to minimize the structure constraints imposed by the inheritance scheme on a model, and the partial ordering
138
A. McNeile and E. Roubtsova
of Protocol Modeling (see Section 3.2) is the minimum structuring possible. As applied to the CMS case study, examination of the structures in Figures 5 and 6 shows that multiple inheritance, measured formally as the definition of machine type that INCLUDES more than one other machine type, is used 7 times.
8
Protocol Modeling in Practice
This section describes various practical considerations in the use of Protocol Modeling, both positive and negative. 8.1
Barriers to Protocol Modeling
The difficulties with application of Protocol Modeling fall into two categories: one associated with the Protocol Modeling paradigm (1) and the other with the nature of the problem which is to be addressed (2). 1. Paradigm Related. The Protocol Modeling paradigm is not well aligned to the prevalent paradigm of current mainstream modeling languages (UML) and programming languages (Java, C#, C++): – The use of pure mixin-based approach, contrasting with the prevalent focus on inheritance. – The use of process algebraic composition (CSP). – The idea that the state of a state-transition machine may be calculated, rather than simply driven by transitions. – The idea of using modal semantics to model workflow. These entail different ways of thinking so becoming fluent in the technique requires time and effort, analogous to that required to convert from imperative programming to OO programming. Moreover, the conceptual distance between Protocol Modeling and current programming languages means that mapping a protocol model to an implementation is not trivial. For instance, if the target programming language does not support multiple inheritance, other means (which could include Aspect Oriented Programming techniques) may be required to implement a model. 2. Problem Related. The second consideration is the nature of the problem being addressed. Protocol Modeling has its own domain of applicability, which can be roughly characterized as discrete event-based systems which are based on what Jackson, in his work on “Problem Frames” [22], refers to as an analogic model. Examples of systems that do not conform to this characterization are: a word processing system, a compiler and a chess game; and attempts to apply Protocol Modeling to such problems will be problematic and unlikely to give a useful solution.
Aspect-Oriented Development Using Protocol Modeling
8.2
139
Model Execution and Testability
Protocol models can be directly executed (tested) after any step of model evolution, and this is supported by the ModelScope [6] tool, providing run-time machine composition and a generic (metadata driven) user interface. The input of the tool is the textual presentation of a protocol model described in Section 3, and Figure 9 shows the user interface as it appears when executing the CMS case study. The tests are recorded in a test-file. The value of providing stakeholders with working (executable) artifacts early in the development process is well recognized. By presenting a working representation of the intended system, model execution offers the potential to make early modeling accessible to stakeholders even those who are not familiar with technical modeling notations, and thus widens the circle of participants in review activities. Such widening of the review activities can help to expose and eliminate misunderstandings between the development and user communities early in the development lifecycle, when mistakes are still relatively cheap to correct, and thus reduce risk and improve quality. The use of ModelScope in this context is discussed fully in [4].
Fig. 9. ModelScope Generic User Interface
The tests are used to validate the model against use cases. Tests can also validate other properties formulated by the developer. For example, “A Crisis case can be closed only if all its missions have been accomplished”. Testing can help to find counter examples to the properties formulated by the developer and this usually means that the model needs a correction. 8.3
Model Evolution
In practice, it is not possible to collect all the requirements for a model at once, so models evolve. Evolution of a protocol model normally entails adding or deleting protocol machines. As all protocol machines are equally composed, the changes are local.
140
A. McNeile and E. Roubtsova
Typically, a behavior model is built in phases, each phase scoped by a Use Case or part of a Use Case. The compositional nature of Protocol Modeling makes this kind of incremental approach attractive and natural. In the CMS case study, initial phases of modeling might be as follows: – Phase 1: Events and machines for Crisis Type, Crisis, Mission Type and Mission. Events and machines for Person, Worker, CMS Employee, Coordinator, and Mobile Employee. Development of support for steps 1 - 2 of Use Case 1. – Phase 2: Events and machines for Needed Mission, Mission Recommendation and development of support for steps 3 - 5 of Use Case 1. – Phase 3: Events and machines for Internal Resource and Assignment Request. Development of support for steps 1 - 2 of Use Case 3. – Phase 4: Events and machines for Witness, Victim, Phone Company, Surveillance, Report Verification and Video Verification. Development of support for the steps 1 - 2 of Use Case 2. In general, each increment will go through the stages of development described in Section 4. After each increment the model is tested and, at key stages, validated with users for correct interpretation of requirements. The validation process allows users and other stakeholders to play scenarios through the model. 8.4
Scalability
Scalability concerns the ability of a technique to be applied to large, complex problems without exhibiting non-linear growth in complexity [1]. In a compositional modeling approach such as Protocol Modeling, scalability can be discussed in terms of the following questions: 1. How does the size of the state space of the solution grow as more complex problems are modeled? In particular, can the approach prevent the phenomenon of “state space explosion” resulting from combinatorial effects? 2. Is the author of the model able to maintain intellectual control over a model as its size grows? We discuss these in turn. 1. State Space. The ability of state transition approaches to scale to complex behavior requires avoidance of the “state-space explosion”, whereby the number of states that have to be used to describe a problem increases geometrically rather than linearly with the size of the problem. Protocol Modeling is not vulnerable to this phenomenon, as the new states of an object needed to describe new behavior are added in new machines. This is in contrast with some other state-transition approaches, such as that suggested by Mellor and Balcer [32], which do not support composition so that all important state combinations of an object must be represented as a single machine. The size of state space of individual protocol machines is dictated by the preferences of designers. Usually, the machines of a model follow the psychological restriction that a person cannot control and reason at one moment more than nine elements. This can be seen in the model in Figures 5 and 6 whose individual machines do not use more than five states.
Aspect-Oriented Development Using Protocol Modeling
141
2. Intellectual Control. In Protocol Modeling, the key to maintaining intellectual control over a model as it grows is the ability to do “local reasoning”: to reason reliably about the behavior of the whole from examination of a part in isolation. If the use of aspect technologies results in specifications becoming distributed through multiple design artifacts (the base behavior or code definitions and separate aspects that have been added to them) in such a way that no reliable deductions about the behavior of the whole can be made from examination of a part, then there is little chance of maintaining intellectual control over a complex model. Local reasoning in Protocol Modeling is based on the following property of CSP composition: If we take a sequence, S, of events that is accepted by the composition (M1 M2 ) of the two machines M1 and M2 , then the subsequence, S , of S obtained by removing all events in S that are not in the alphabet of M1 would be accepted by the machine M1 by itself. This property is sometimes known as observational consistency [18] between a composite and its component machines. The fact that CSP composition gives observational consistency was established by Hoare [10]; however, Hoare’s formulation was based on the composition of algebraic processes and did not consider machines that access the local storage of other machines (in particular, to derive their state) and a proof extended to cover composed protocol machines is given in [3]. These ideas are very closely related to the categorization of aspects suggested by Katz [31]: – Spectative aspects can change the values of variables local to the aspect, but do not change either the value of any variable or the flow of method calls of the underlying system. – Regulative aspects can affect the flow of control of the underlying system by restricting operations, delaying some operations, or preventing the continuation of a computation. – Invasive aspects can change the values of variables and therefore the behavior in the underlying system. Katz was also concerned with the issue of how to reason about software behavior in the presence of aspects, and argues that Invasive aspects make reasoning hard or impossible. The fact that CSP composition cannot break trace behavior means that protocol machines cannot be Invasive. Another way of stating the observational consistency property is: composing another machine with M1 cannot “break its trace behavior” by overriding a constraint that M1 says must be true. The property can be used to support local reasoning thus: if the sequence S was not acceptable to M1 , the original sequence S could not have been acceptable to (M1 M2 ). This means that we can use properties of M1 (or M2 ) alone to argue about the behavior of M1 M2 . This is key to retaining intellectual control. When creating a model, the author needs to ensure that the protocol constraints in each machine of the model are true by examining each machine separately, as composition preserves the constraints specified by each machine. This allows intellectual control to be maintained over a model even if it comprises a large number of fine grained machines.
142
8.5
A. McNeile and E. Roubtsova
Correctness
By correctness we mean the use of formal proof techniques to establish behavioral properties in a model. These are properties such as liveness or absence of deadlock and are normally addressed using model proving techniques. This is a large topic, and we only give a summary here. Our view is that the approach needed to establish behavioral correctness depends on the nature of the system. The key determinant is whether the system is: 1. Deterministic in which case local reasoning about models combined with model execution (testing) is generally sufficient for ensuring correctness. This is because with a deterministic system you can repeat tests. 2. Non-deterministic in which case you must use global reasoning (model checking) to ensure correctness. This is because the execution path of the system cannot be determined in advance or controlled during execution, and consequently repeatability of behavior cannot be assured. This makes systematic testing hard or impossible. Within the realm of Protocol Modeling, models fall into two classes corresponding to the above: – Protocol models that only use the deterministic parallel composition of CSP11 . – Protocol models that use composition operators that introduce non-determinism, such as the composition operator of Robin Milner’s CCS (or the π-calculus) [26]. We discuss these in turn. 1. Deterministic Models. The CMS case study (at least as we have modeled it for this paper) falls into the first class of deterministic models. Here, the ability to apply local reasoning to the model and use a tool such as ModelScope is generally enough to establish correctness. Both techniques are essentially needed. The CSP parallel composition and its property of local reasoning guarantees that traces of parts will not be reordered by the the composition. Model execution provides an extra check that the composition of Protocol Machines produces desired behavior and does not unnecessary behavioral constraints. CSP composition always works, in that it never produces a composite that fails in execution (generates a run-time error). However, it is possible to create machines that interlock with each other. Consider the two machines: P = x.y and Q = y.x where “.” indicates sequencing of events. In this case P Q will refuse both x and y and so will not be able to engage in any event. This will not generate a run time error: it just will not do anything. 11
As Hoare himself notes: “. . . the concurrent operator by itself does not introduce non-determinism.” [11].
Aspect-Oriented Development Using Protocol Modeling
143
It might be possible to devise a static analyzer that could detect such situations. However, as there are often cases in a model where refusal of the events is the intention (e.g., as Logged In Check purposefully refuses Restricted Events when the Employee is not authenticated by the system) such an analyzer could only detect candidate problems: for instance, using model checking to find states of the system in which composition causes all exit transitions to be refused. We have not found this to be necessary as, in practice, model testing is sufficient to detect such mistakes in the model by exercising the required Use Cases. 2. Non-Deterministic Models. When modeling software that is required to be distributed across multiple (real or virtual) unsynchronized processors it is necessary to use composition operators that result in non-deterministic behavior and then correctness must, in general, be established using model proving techniques. Model proving generally requires that the multiple machines of a protocol model be combined into a single machine for the purpose of global analysis of the possible execution paths: for instance to establish that no path ends in a state from which there no exit transition (a deadlock). This is usually done with the help of specialist model-proving tools. This application of model proving to Protocol Modeling is a subject of current research and beyond the scope of this paper, but the following general statements can be made: – Protocol models that comprise a fixed population of machines lend themselves well to traditional model proving techniques. The general approach is to form a state space of the model as whole as the Cartesian product of the state spaces of the constituent machines of model, and then draw the valid transitions between the states of this global state space according to the rules of the composition operators (normally both CSP and CCS) used in the model. The resultant overall machine can then be analyzed for the presence (or absence) of topological properties corresponding to desired (or pathological) behavioral properties. The proving is a mechanical process that can be carried out by a software tool. – As described in Section 7, derived states can be used to abstract over the data and states of a model and hence maximize the economy of the state space required. This reduces the chance that model proving becomes untractable because of the size of the global state space that needs to be constructed and explored. – Because, as noted in Section 2.4, derived state machines are not “topological” extra steps are sometimes needed in the model proving process to convert these machines into a form that allows them to be included in the analysis. These techniques have useful application. For instance, the combination of model proving and the ideas described in Section 2.5 for representing modality makes it possible to conduct formal progress analysis on distributed (multi-party) collaborative workflows whereby it is possible to establish analytically that a collaboration will always reach a successful conclusion. Another example of formal
144
A. McNeile and E. Roubtsova
proving techniques using protocol models is the work by McNeile on choreography realizability [2].
9
Related Work and Conclusion
In this section we make an overview of some related aspect-based modeling approaches and draw some conclusions. 9.1
Related Work
We have chosen the workflow-based Theme approach, the RAM approach using multiple behavioral views and approaches that use Statecharts for capturing of aspects, to show that composition semantics may enrich those approaches and make them more flexible. Theme. The Theme [29,13] approach is used both at requirements and the design level. At the requirements level Theme/Doc exposes the relationship between behaviors (features) in the model. The Design level Theme/UML supports modeling features and aspects in UML. Theme/Doc views are mapped onto the Theme/UML model allowing traceability of requirements. At the requirements level a designer identifies actions as verbs in textual requirements. Each action potentially becomes a theme. The actions have relations via concepts. Actions found in different themes become potential aspects. An action view of each theme is a graph that contains actions and entities. The size of this view grows with the number of entities and actions in the model. The scalability is achieved by the separation major and minor actions. “Major actions become themes, while minor actions are slotted to become methods within a theme” [13]. The action view “drives composition semantics for design in Theme/UML” [13]. The action view is analyzed to produce the Theme/UML specification of actionsaspects as a combination of a class and sequence diagrams. So, actions in the Theme approach are not elementary, they are activities. If a Theme/action is reused in the model, the pointcuts are specified in the Theme/UML view. The evolution of the model is handled by re-generating the views for the new set of requirements. This we see as a shortcoming of this approach. Reusable Aspect Models (RAM). In the Reusable Aspect Models (RAM) [19] approach a model of a concern or functionality “contains up to three different kinds of views: a structural view, state views and message views, which are grouped together in an aspect model, a special UML package” [19]. The structural view is expressed using a UML class diagram where the specified public methods of classes are annotated with “+”. The structural view of a concern may present only classes and associations relevant to the concern. The structural view may contain “incomplete classes, i.e. entities that are not directly or indirectly bound to model elements of some other aspect models, and methods whose name and signature are yet to be determined”. These incomplete
Aspect-Oriented Development Using Protocol Modeling
145
classes are called “mandatory instantiation parameters” and they are recognized by | character attached to their name and as UML template parameters on the right hand side of the structural view compartment [19]. The classes may later be composed by the weaver with other classes when the aspect is instantiated or bound to a base model. The class diagrams are composed using the algorithm proposed in France et al. [27]. The composed elements at an aspect model and a target model must be instances of the same metamodel class and have matched signature, i.e two elements with the same signature represent the same concept and composed. For each class (complete or incomplete) defined in the structural view one state view is defined. “Using a UML state diagram, the state view of an entity describes the internal states of that entity that are relevant within the concern. A state is relevant if it affects the messages that the entity is capable of processing. In UML terms, the state view compartment describes the usage protocol of the entity. To be complete, the state diagram must contain each method defined in the structural view for the entity at least once [19]”. For incomplete classes, an aspect state diagram consists of two parts: a pointcut and an advice. “The pointcut defines the states and transitions that have to exist in the target state diagram, i.e. the state diagram with which the aspect state diagram is composed.” The advice defines the state diagram that replaces the occurrence of the pointcut in the target state diagram. “States that are not directly or indirectly bound to states defined in a standard state diagram are mandatory instantiation parameters of the state view [19]”. So far, weaving of state views is not supported. For each public method defined in the structural view, there is at most one message view. “Each message view describes, using a UML sequence diagram, the sequencing of message interchanges that occur between entities when providing the functionality offered by the public method. Hence, if the functionality does not involve any message exchanges, but only computation internal to the entity, no message view compartment is shown for that method.” A message view has two parts: a pointcut and an advice. The message views are woven on the basis of the algorithm known as Generic weaving with Kermeta [9,36]. The result of weaving of sequence diagrams is a sequence diagram. The RAM approach generates aspect dependencies. The dependencies are declared in the aspect heading. “If A depends on B, A explicitly states that it reuses the functionality provided by B by instantiating B. If an aspect A depends on an aspect B, i.e. an incomplete class X (or | X) in the structural view of an aspect A needs to be composed with a complete class Y defined in B, the state view X in A might also need to refine the state view Y. In this case, A has to define a binding directive that maps the incomplete entities of As structural view, state view or message view into the structural view, state view or message view of the aspect defining Y. Instantiations and binding directives can be one-to-many or many-to-one, if needed” [19]. Aspect dependencies are
146
A. McNeile and E. Roubtsova
kept unresolved until the aspects are woven with the final application model. An aspect A can have complex dependencies in the form of a directed acyclic graph. The weaving algorithm resolving aspect dependencies is recursive. It processes the directed acyclic graph of dependencies step by step in depth-first order. All aspects should be woven with a base application model. Before weaving each aspect model goes through consistency checks, then the adherence of aspect models to the instantiation and binding rules is checked. The third of consistency checks is performed within the independent aspect model and within the final base model.“For each object life line in the sequence diagram, the incoming messages to that object are presented in sequence to the state diagram describing the protocol of the corresponding class. If the state diagram refuses a message, consistency is violated” [19]. We should notice that the refuse semantics used for consistency checkers is different from the semantics of refuse in Protocol Modeling. In Protocol Modeling “refuse” is not a violation, it is a normal situation when a protocol machine being in its current state cannot accept an event. RAM models are not executable. The authors plan to extend the approach “by adding yet another kind of view that describes the detailed execution paths for individual methods. Detailed method algorithms could be expressed, for instance, with UML activity diagrams or SDL. With this additional view, RAM would be capable of generating final application models that are fully executable [19].” Approaches using Statecharts. There are several approaches using statecharts for capturing aspects. Mahoney et al. [23] use the semantics defined by D. Harel [12]: “When event a occurs in state A, if condition C is true at the time, the system transfers to state B ”. Moreover, the authors exploit the AND-composition of several independent (orthogonal) statecharts and “the key feature of orthogonal statecharts is that events from every composed statechart are broadcast to all others. Therefore, an event can cause transitions in two or more orthogonal statecharts simultaneously” [23]. We should notice that this semantics does not define what happens if one of orthogonal statecharts is in a such a state where it cannot accept the broadcast event. This incomplete semantics does not allow use of CSP or CCS composition for orthogonal statecharts. The most that can be said is that the result of the composition of orthogonal statecharts is a computation tree that represents partial behavior of the system when the orthogonal statecharts are in suitable states to accept broadcasted events. The UML Specification [24] includes two behavioral semantics for finite state transition systems: Behavioral State Machines (BSM) and Protocol State Machines (PSM) and several approaches [16,34] use these as a basis for defining aspect semantics. High-Level Aspects (HiLA) [16] uses UML State Machines with declarative specification of concerns such as synchronization of orthogonal regions or historybased behaviors. The authors use Behavioral State Machines (BSM) semantics. The semantic model used for Behavior State Machine Execution in UML2
Aspect-Oriented Development Using Protocol Modeling
147
(which was first included in UML at version 1.5) is based on the “Recursive Design” method of Shlaer and Mellor [33] whose work has been mainly in the real-time/embedded systems domain. The approach is based on using state machines to model so-called “active objects”: objects whose instances execute autonomously and asynchronously (i.e., as if executing on independent threads) resulting in system behavior that is inherently non-deterministic [35]. The authors of paper [16] notice that “UML state machines work fine as long as the only form of communication among states is the activation of the subsequent state via a transition. More often than not, however, an active state has to know how often some other state has already been active and/or if other states (in other regions) are also active. Unfortunately, behavior that depends on such information cannot be modeled modularly in UML state machines.” We agree with this observation, which our use of derived states avoids. The asynchronous and non-deterministic composition semantics of BSMs make reasoning about behavior difficult. Complete analysis of the behavior of the model must allow, in general, for arbitrary queuing of events between objects and for the accumulation of deferred events. If a model comprises a number of communicating objects this results in a large number of possible execution states for the system as a whole, and reasoning on models is impossible without model checking algorithms. This does not make sense when models are being developed, as they are in most projects, in an iterative manner and subject to frequent change; and it is hard to reconcile this semantic basis with the characteristics of the business information systems domain, where behavioral issues are related to transactional integrity and business rules, and strictly deterministic behavior of business logic is important to ensure repeatability, auditability and testability12 . While there is some native support in Shlaer/Mellor for behavior abstraction through the use of “polymorphic events”, this has been included neither in the UML BSM standard nor is there any method to compose multiple machines to form the behavior of a single classifier. This places severe limits on the ability of BSMs to describe generalization/specialization of behaviors or to support behavior re-use. As described in [32], a single object class is modeled with a single state machine, and only concrete classes are modeled. This also means that crosscutting behaviors (aspects) have to be addressed by other means, potentially further complicating model analysis. As noted above, UML also supports Protocol State Machines (PSM). These are not related to Shlaer/Mellor and have semantics that define the legal lifecycles of a classifier (an object, interface, or port) in terms of the allowable order of invocation of its operations. PSMs can (to a limited extent) be composed. “A classifier may have several protocol state machines. This happens frequently, for example, when a class 12
We note that the commercial tools that support this approach (such as those from Telelogic, Kennedy Carter and Mentor Graphics) are not well adapted for use in the business information systems domain and are positioned by their vendors to target the real time/embedded market.
148
A. McNeile and E. Roubtsova
inherits several parent classes having a protocol state machine, when the protocols are orthogonal” [24]. In this context, “orthogonal” means that they have a disjoint alphabets. The occurrence of an event that a PSM cannot handle is viewed as a precondition violation and the consequent behavior of the PSM is left open: “The interpretation of the reception of an event in an unexpected situation (current state, state invariant, and pre-condition) is a semantic variation point : the event can be ignored, rejected, or deferred, an exception can be raised, or the application can stop on an error. It corresponds semantically to a pre-condition violation, for which no predefined behavior is defined in UML” [24]. Only if such a situation was interpreted as a refusal could CSP style composition be supported, but this does not seem to be intention of the specification. PSM semantics are simpler and more abstract than the BSM semantics, and this makes them more widely usable and easier to analyze. However, as evidenced by the language used to describe them, PSMs are clearly positioned in UML as contracts of legal usage; and this gives it a different meaning and role from that of BSMs. While a contract must specify what is legal, it is neither concerned with the mechanism by which non-legal behavior is avoided, nor is it required to specify the effect of violation. In other words, a contract cannot be used as the instrument that guarantees its own satisfaction. It would therefore be a logical error to execute PSMs directly or to generate code from them, and this seems to make use as a means of specifying behavioral aspects problematic. 9.2
Conclusion
In this paper we have shown an approach to aspect modeling using Protocol Modeling, a mixin-based behavioral modeling technique. Protocol Modeling embodies semantics needed to capture and compose behavioral aspects, including events represented as data, machines with state and local storage, state derivation and formal parallel composition techniques. This enables behavioral aspects and behavior inheritance to be handled by a common mechanism and thus provides a unified view of these different abstraction techniques.
References 1. Bondi, A.: Characteristics of Scalability and their impact on Performance. In: Proceedings of the 2nd international workshop on Software and performance, Ottawa, Ontario, Canada, pp. 195–203 (2000) 2. McNeile, A.: Protocol Contracts with application to Choreographed Multiparty Collaborations. In: Service Oriented Computing and Applications (in Publication, 2010) 3. McNeile, A., Roubtsova, E.: CSP parallel composition of aspect models. In: AOM 2008: Proceedings of the 2008 AOSD Workshop on Aspect-Oriented Modeling, pp. 13–18. ACM DL (2008) 4. McNeile, A., Roubtsova, E.: Executable Protocol Models as a Requirements Engineering Tool. In: Proceedings of the 41st Annual Simulation Symposium (anss-41 2008), Washington, DC, USA, pp. 95–102. IEEE Computer Society, Los Alamitos (2008)
Aspect-Oriented Development Using Protocol Modeling
149
5. McNeile, A., Roubtsova, E.: Composition Semantics for Executable and Evolvable Behavioural Modeling in MDA. In: BM-MDA 2009: Proceedings of the 1st Workshop on Behaviour Modelling in Model-Driven Architecture, pp. 1–8. ACM DL (2009) 6. McNeile, A., Simons, N.: http://www.metamaxim.com/ 7. McNeile, A., Simons, N.: Protocol Modelling. A Modelling Approach that Supports Reusable Behavioural Abstractions. Software and System Modeling 5(1), 91–107 (2006) 8. McNeile, A., Simons, N.: A Typing Scheme for Behavioural Models. Journal of Object Technology 6(10), 81–94 (2007) 9. Morin, B., Klein, J., Barais, O., J´ez´equel, F.-M.: A Generic Weaver for Supporting Product Lines. In: EA 2008: Proceedings of the 13th international Workshop on Early Aspects, pp. 11–18. ACM, New York (2008) 10. Hoare, C.: Communicating Sequential Processes. Prentice-Hall International, Englewood Cliffs (1985) 11. Hoare, C.: Why ever CSP? Electronic Notes in Theoretical Computer Science 162, 209–215 (2006) 12. Harel, D., Gery, E.: Executable Object Modelling with Statecharts. IEEE Computer 30(7), 31–42 (1997) 13. Baniassad, E., Clarke, S.: Theme: An Approach for Aspect-Oriented Analysis and Design. In: ICSE 2004. Proceedings. 26th International Conference on Software Engineering, pp. 158–167. IEEE, Los Alamitos (2004) 14. Roubtsova, E., McNeile, A.: Abstractions, Composition and Reasoning. In: AOM 2009: Proceedings of the 13th workshop on Aspect-Oriented Modeling, Charlottesville, Virginia, USA. ACM DL (2009) 15. Bracha, G., Cook, W.: Mixin-based inheritance. In: Proc. of the ASM conference on Object-Oriented Programming, Systems, Languages, Applications, OOPSLA/ECOOP 1990, ACM SIGPLAN Notices, vol. 25(10), pp. 179–183 (1990) 16. Zhang, G., H¨ olzl, M., Knapp, A.: Enhancing UML State Machines with Aspects. In: Engels, G., Opdyke, B., Schmidt, D.C., Weil, F. (eds.) MODELS 2007. LNCS, vol. 4735, pp. 529–543. Springer, Heidelberg (2007) 17. Ossher, H., Tarr, P.: Multidimentional Separation of Concerns and the Hyperspace Approach. In: Proc. Architectures and Component Technology: The State-of-the Art in Software Development (January 2000) 18. Ebert, J., Engels, G.: Observable or invocable behaviour - You have to choose. Technical report. Universit¨ at Koblenz, Koblenz, Germany (1994) 19. Kienzle, J., Al Abed, W., Klein, J.: Aspect-oriented Multi-view Modeling. In: Proceedings of the International Conference on Aspect-Oriented Software Development, AOSD 2009, Charlottesville, Virginia, USA, pp. 87–98. ACM DL (2009) 20. Kienzle, J., Guelfi, N., Mustafiz, S.: Crisis Management Systems: A Case Study for Aspect-Oriented Modeling. In: Katz, S., Mezini, M., Kienzle, J. (eds.) Transactions on AOSD VII, LNCS, vol. 6210, pp. 1–22. Springer, Heidelberg (2010) 21. Jackson, M.: System Development. Prentice Hall, Englewood Cliffs (1983) 22. Jackson, M.: Problem Frames: Analyzing and Structuring Software Development Problems. Addison-Wesley Longman Publishing Co., Inc., Boston (2001) 23. Mahoney, M., Bader, A., Elrad, T., Aldawud, O.: Using Aspects to Abstract and Modularize Statecharts. In: The 5th Aspect-Oriented Modeling Workshop In Conjunction with UML 2004 (2004) 24. OMG. Unified Modeling Language, Superstructure, v2.2. OMG Document formal/09-02-02 (2009)
150
A. McNeile and E. Roubtsova
25. Filman, R., Friedman, D.: Aspect-Oriented Programming is Quantification and Obliviousness. In: Tarr, P., Bergmans, L., Griss, M., Ossher, H. (eds.) Proceedings of Workshop on Advanced Separation of Concerns, OOPSLA 2000. Department of Computer Science. University of Twente, The Netherlands (2000) 26. Milner, R.: A Calculus of Communicating Systems, LNCS, vol. 92. Springer, Heidelberg (1980) 27. Reddy, R., Ghosh, S., France, R., Straw, B.: Directives for composing aspectoriented design class models. In: Rashid, A., Aksit, M. (eds.) Transactions on Aspect-Oriented Software Development I. LNCS, vol. 3880, pp. 75–105. Springer, Heidelberg (2006) 28. Apel, S., Leich, T., Saake, G.: Mixin-Based Aspect Inheritance. Technical Report No. 10/2005, University of Magdeburg, Germany (2005) 29. Clarke, S., Baniassad, E.: Aspect-Oriented Analysis and Design: The Theme Approach. Addison Wesley, Reading (2005) 30. Cook, S., Daniels, J.: Designing Object Systems. Object-Oriented Modelling with Syntropy. Prentice Hall, Englewood Cliffs (1994) 31. Katz, S.: Aspect Categories and Classes of Temporal Properties. In: Rashid, A., Aksit, M. (eds.) Transactions on Aspect-Oriented Software Development I. LNCS, vol. 3880, pp. 106–134. Springer, Heidelberg (2006) 32. Mellor, S., Balcer, M.: Executable UML: A Foundation for Model Driven Architecture. Addison Wesely, London (2002) 33. Shlaer, S., Mellor, S.: Object Life Cycles - Modeling the World in States. Yourdon Press/Prentice Hall (1992) 34. Elrad, T., Algawud, O., Baber, A.: Aspect-oriented modelling-Briging the gap Between Design and Implementation. In: Proceedings of the First ACM International Conference on Generative PRogramming and Component Engineering GPCE), Pittsburg, pp. 1189–1202 (2002) 35. Santen, T., Seifert, D.: Executing UML State Machines. Technical Report 2006-04, Fakult¨ at f¨ ur Elektrotechnik und Informatik, Technische Universit¨ at Berlin (2006) 36. Drey, Z., Faucher, C., Fleurey, F., Mah´e, V., Vojtisek, D.: Kermeta language (2009), http://kermeta.org/documents/manual/htm_chunked
Using VCL as an Aspect-Oriented Approach to Requirements Modelling Nuno Am´ alio, Pierre Kelsen, Qin Ma, and Christian Glodt University of Luxembourg, 6, r. Coudenhove-Kalergi, L-1359 Luxembourg {nuno.amalio,pierre.kelsen,qin.ma,christian.glodt}@uni.lu Abstract. Software systems are becoming larger and more complex. By tackling the modularisation of crosscutting concerns, aspect orientation draws attention to modularity as a means to address the problems of scalability, complexity and evolution in software systems development. Aspect-oriented modelling (AOM) applies aspect-orientation to the construction of models. Most existing AOM approaches are designed without a formal semantics, and use multi-view partial descriptions of behaviour. This paper presents an AOM approach based on the Visual Contract Language (VCL): a visual language for abstract and precise modelling, designed with a formal semantics, and comprising a novel approach to visual behavioural modelling based on design by contract where behavioural descriptions are total. By applying VCL to a large case study of a car-crash crisis management system, the paper demonstrates how modularity of VCL’s constructs, at different levels of granularity, help to tackle complexity. In particular, it shows how VCL’s package construct and its associated composition mechanisms are key in supporting separation of concerns, coarse-grained problem decomposition and aspect-orientation. The case study’s modelling solution has a clear and well-defined modular structure; the backbone of this structure is a collection of packages encapsulating local solutions to concerns. Keywords: modularity, separation of concerns, aspect-oriented modelling, design by contract, VCL.
1
Introduction
Software systems are becoming larger, more complex and part of our everyday lives. They need to evolve in order to keep up with their complex and dynamic environments. To help reduce complexity, improve reusability, and simplify evolution, software engineering emphasises the principle of separation of concerns [1]. By tackling the modularisation of crosscutting concerns, aspect-orientation enhances traditional approaches to modularity, providing techniques to achieve designs with a good level of separation of concerns that effectively separate and isolate non-orthogonal (or crosscutting) concerns. This enables concerns to be understood and analysed in isolation, and then composed in a modular fashion. Aspect-oriented modelling (AOM) raises the level of abstraction of aspectoriented software development by applying aspect-orientation to the construction of models of software systems. S. Katz et al. (Eds.): Transactions on AOSD VII, LNCS 6210, pp. 151–199, 2010. c Springer-Verlag Berlin Heidelberg 2010
152
N. Am´ alio et al.
Visual languages like UML are limited at separating concerns, not supporting concerns that are crosscutting [2]. There has been substantial work on AOM (section 11). Most existing AOM approaches: (a) extend UML to enable aspectorientation, (b) are designed to enable code generation, (c) are based on multiple partial view descriptions of behaviour (using scenarios and state diagrams) or total descriptions based on OCL, (d) are not designed with a formal semantics (precluding, this way, formal verification), (e) are asymmetric, treating aspects differently from other modules, and (f) involve complex weaving algorithms to compose models. This paper presents an AOM approach based on the Visual Contract Language (VCL) [3,4,5]. VCL is a visual language for abstract and precise modelling at the level of system requirements or high-level system designs. It embodies a novel approach to visual behavioural modelling based on design by contract [6] where its behavioural descriptions are total. VCL expresses operations and invariants visually; UML needs to resort to textual OCL to do this. Unlike UML and other mainstream languages, VCL is designed to have formal semantic foundations to enable formal semantic analysis. Its semantic is expressed in Z [7], using the ZOO semantic domain of object-orientation [8,9], which has been applied to UML-based models in [10,11,9]. VCL is accompanied by a tool, the Visual Contract Builder1 , which is being developed as part of the VCL effort. VCL is novel in its modular approach to modelling based on different levels of granularity. At a more finer-grained level, VCL’s contracts and constraints are modules that can be combined using logical operators. It is, however, through its coarse-grained construct of packages that VCL realises AOM. VCL packages are reusable functional units encapsulating structure and behaviour that can be used or extended by other packages. They enable the definition of modules that localise solutions to concerns. VCL is symmetric in the way it treats classical modules and aspects, not making a distinction between them. VCL packages constitute modules that can be described, understood and analysed in isolation and then used as a piece in multiple contexts to make larger packages addressing multiple concerns. In VCL, package compositions have a declarative nature, not involving complex weaving algorithms. This paper shows how VCL tackles the complexity of large-scale systems with a large case study, the car-crash crisis management system (CCCMS) [12]. It illustrates VCL’s package construct and associated composition mechanisms, showing how they support separation of concerns, coarse-grained problem decomposition and aspect-orientation. The resulting VCL model has a clear and well-defined modular structure; the backbone of this structure is a collection of packages encapsulating local solutions to concerns. This paper is organised as follows. Section 2 explains the process that we followed to model the CCCMS using the VCL-based AOM approach presented here. Section 3 presents the high-level requirements model of the CCCMS. Section 4 overviews the detailed VCL system requirements model. Sections 5 to 8 build parts of the overall VCL model. Section 9 discusses the paper’s results. 1
http://vcl.gforge.uni.lu
Using VCL as an Aspect-Oriented Approach to Requirements Modelling
High-Level Requirements Modelling using architecture models and use cases
153
Detailed Requirements Modelling usingVCL
Fig. 1. Process used to model the CCCMS using VCL
Section 10 evaluates our approach with respect to a number of qualitative criteria. Section 11 discusses related work. The final section presents the conclusions.
2
Process
VCL is a language that emphasises precision and is suited to describe requirements (or high-level design) models of software systems. The process used to model the CCCMS in our VCL-based AOM approach consists of two big steps (figure 1): 1. High-level requirements modelling. This identifies subsystems and their highlevel functionality. It uses notations other than VCL, such as architectural diagrams, and UML use case and sequence diagrams. 2. Detailed requirements modelling. This builds VCL models of the identified subsystems, describing their structure and behaviour. Figure 1 highlights the iterative nature of this process. It was necessary to iterate through these different levels of modelling; forwards and backwards. The high-level model is the basis of modelling in VCL; often, the detailed VCL model provides useful feedback to elaborate the high-level model. Crosscutting concerns are identified through the iterative process of figure 1, being identified in both modelling stages: – During high-level modelling, cross-cutting concerns manifest themselves by appearing repeatedly in use cases. Such concerns are then modularised as VCL packages in the detailed model. – During VCL modelling, cross-cutting concerns emerge when we observe a behavioural pattern occurring repeatedly. In this case, it is necessary to go back and update the high-level requirements model. The following describes these two levels of modelling in detail. 2.1
High-Level Requirements Modelling
The high-level requirements phase consists of the following steps: 1. Build high-level architectural models. Architectural models describe the system’s subsystems and their main units of functionality (features). This helps structuring the overall model to reflect this decomposition.
154
N. Am´ alio et al.
2. Build use case models. Main functional units (features) coming from architectural model are refined into UML use cases. 3. Derive system operations. System operations are derived by drawing UML sequence diagrams describing use case scenarios, highlighting the interaction between the environment and the system (see [13]). Derived system operations are then described in detail in VCL. 2.2
Detailed Requirements Modelling in VCL
The high-level requirements model is the basis for modelling in VCL. For each subsystem, we build a VCL model, which comprises a collection of VCL packages; one package represents the overall subsystem. The method followed to build VCL packages is as follows: 1. Build or reuse VCL packages addressing generic concerns. From the highlevel requirements model, we derive a set of generic concerns, some of which are crosscutting. These generic concerns are modularised as VCL packages; there is at least one package for each generic concern. VCL packages should be designed to be independent in order to achieve low-coupling. 2. Build VCL packages to address problem domain concerns. Problem domain concerns (crosscutting or not) are derived from the high-level requirements model. They are modularised in VCL as packages. The aim is to model relevant fragments of the problem domain in isolation, abstracting away from other concerns of the system and trying to achieve low-coupling. 3. Build composite packages. Larger packages are built incrementally from the individual packages using VCL’s composition mechanisms. They may represent the configuration of generic concerns, compositions to represent generic or problem domain concerns, and compositions linking domain and aspects packages. Ultimately, there is a VCL package for each subsystem.
3
High-Level Requirements Model of CCCMS
The process highlighted above (section 2, figure 1) was used to build the VCLbased requirements model of the CCCMS [12]. The complete model is given in [14]. The following describes the high-level requirements model of CCCMS. 3.1
Subsystems and Their Functional Features
The diagram of figure 2 describes the systems architecture of the CCCMS, highlighting a decomposition into subsystems. This reflects architectural decisions that have been taken by balancing the case study’s requirements. The CCCMS’s subsystems are as follows: – MobCCCMS is a system that runs on mobile devices to assist in real-time resources deployed to rescue missions. It addresses the mobility non-functional requirement (NFR) (see [12]). This consists of user interfaces to provide resources with sensible information for the execution of rescue missions.
Using VCL as an Aspect-Oriented Approach to Requirements Modelling
155
CCCMS MobCCCMS
CentralCCCMS
Fig. 2. Systems diagram showing subsystems of CCCMS. MobCCCMS (Mobile CCCMS) is deployed on mobile devices and used in real-time by resources sent to missions. CentralCCCMS (Central CCCMS) is used at crisis management headquarters. Subsystems exchange information through messages.
MobCCCMS
CentralCCCMS
MappingMobile LocationTracking
CrisisManagement
MissionManagement
ResourceManagement
MappingCentral
GUIMobile
GUICentral
Authentication
AccessControl
SystemsAdministration
(a) M obCCCM S
(b) CentralCCCM S
Fig. 3. Diagrams describing features of the CCCMS’s subsystems
– CentralCCCMS is the system used at the crisis management control-centre by crisis coordinators. It addresses the persistence NFR of [12]; all data related with domain functionality is held in this subsystem. The high-level functional units (features) of the CCCMS’s subsystems are identified in the block diagrams of figure 3; each block represents a feature. Table 1 describes these features indicating the requirements they address. 3.2
Use Cases and System Sequence Diagrams
Use cases were organised around the subsystems and their features. Each subsystem comprises a set of use cases. The use case model of [12] was re-factored to take subsystems and their features into account, to clarify some omissions and ambiguities that we found in the requirements, and to enable a clear derivation of system operations from the use cases. Figure 4 presents sample use case diagrams belonging to the use case model of CCCMS [14] for the features MappingMobile and CrisisManagement. In [14], the scenarios of each use case are described using UML sequence diagrams to derive system operations. Figure 5 presents sample system sequence diagrams for use cases of feature CrisisManagement. All messages going from external actors into the system, identify system operations. System sequence diagrams of figure 5 highlight crosscutting functionality; in this case the functionality related to authentication and the Login system operation.
156
N. Am´ alio et al. Table 1. Features of CCCMS’s subsystems, and their requirements
Subsystem M obCCCM S M obCCCM S M obCCCM S CentralCCCM S CentralCCCM S CentralCCCM S CentralCCCM S CentralCCCM S CentralCCCM S CentralCCCM S CentralCCCM S
Feature Mapping Mobile Location Tracking GU IM obile
Description Requirements Handling of maps on mobile de- Mobility NFR of [12]. vices. Tracking location of resources. Mobility NFR of [12].
Displays information for re- Accuracy NFR sources deployed to missions. of [12]. Crisis Manage- Management of crisis. Use cases of [12]. ment Resource Man- Management of resources. Use cases of [12]. agement Mission Man- Management of missions. Use cases of [12]. agement Mapping Handling of maps in control cen- Accuracy NFR tre. of [12]. GU ICentral Graphical user interfaces for cri- Use cases of [12]. sis coordinators. Authentication Authentication of users. Security NFR of [12]. Access Control Access-control security policies. Security NFR of [12]. Systems Ad- Tasks related to administration of Use cases of [12]. ministration users and access control policies.
Central CCCMS - Crisis Management Capture Witness Reports
Mob CCCMS - Mapping Mobile
<uses> DisplayCrisisSite
Create Crisis
Crisis Coordinator
DisplayRoute
Mapping System
(a) M appingM obile feature
Authenticate
<uses>
Crisis Coordinator
DisplayCurrentLocation
<uses>
Check Witness Reports Surveillance System
(b) CrisisM anagement feature
Fig. 4. Sample use case diagrams of CCCM S
4
Detailed VCL Model
The process described in section 2.2 is used to build detailed VCL models for subsystems MobCCCMS and CentralCCCMS, taking into account all features and their system operations identified in the high-level requirements model (section 3). Each subsystem is represented as a VCL package. A subsystem package is built by incorporating packages representing the subsystem’s concerns. Figure 6 presents VCL package diagrams for subsystems CentralCCCMS and MobCCCMS. In VCL, packages are represented as clouds to allude to the fact that they
Using VCL as an Aspect-Oriented Approach to Requirements Modelling sd Check Witness Report
sd Capture Witness Report
Video Surveillance System
Central CCCMS
Crisis Coordinator
sd Authentication(Nat maxPwMisses)
Central CCCMS
Crisis Coordinator
Authentication () : LoginResult
Authentication () : LoginResult
Central CCCMS
Crisis Coordinator
ref
ref
157
loop (maxPwMisses)
CreateWR ()
Login(UID, Passwd)
GetWRs () ViewWR ()
LoginResult
ReqVideoSurveillance () ReqVideoSurveillance ()
sd Create Crisis
break [LoginResult = success]
CancelVSReq ShowVideoSurveillance () CancelVSReq
Central CCCMS
Crisis Coordinator
CreateCrisisFromWR ()
ref
AssociateWrWithCrisis ()
Authentication () : LoginResult
IgnoreWR ()
blockUser(UID)
CreateCrisis ()
Fig. 5. Sequence diagrams describing scenarios of CrisisManagement feature. Diagrams highlight (in red) authentication crosscutting functionality.
CentralCCCMS CrisisWithAspects
ResourceWithAspects
MissionWithAspects
AuthenticationOps
MappingDisplayCentralCCCMS
SecAuthorisationMgmt
MobCCCMS LocationTrackingMobCCCMS MissionInfoDisplay CrisisInfoDisplay
MobCCMSGUI
MappingDisplayMobCCCMS
Fig. 6. Package diagrams defining packages representing CentralCCCMS (left) and MobCCCMS (right) subsystems
define a world of their own. A VCL package diagram highlights the package being defined (in bold) and the packages being extended. Package extension means incorporation; state structures and operations defined in the incorporated package become part of the composite package2 . Package diagrams of figure 6 highlight constituent individual VCL packages that are also, themselves, composite packages. All VCL packages of the overall model of CCCMS are defined in [14]. Each subsystem has its own VCL model with its set of constituent packages, some of them common to both subsystems. The next sections present fragments of the overall VCL model to illustrate the process described in section 2.2. They highlight VCL’s capabilities to support abstract modelling in an aspect-oriented way, illustrating VCL and its package 2
Semantically, incorporation means conjunction; structures of composite are those of packages it incorporates, plus those that composite defines as its own.
158
N. Am´ alio et al.
UID
maxPwMisses:Nat
uid
Name
name
pw
Password
pwMisses
UsersMgmt Users
Nat
⃝UserStatus IDOfUsersUnique MaxPwMissesInv
User
status
loggedIn blocked
loggedOut
Fig. 7. Package diagram of package UsersMgmt, which extends Users (left). Structural diagram of package Users defining User blob (right).
construct in their capability to capture generic concerns, support flexible problem decomposition, and enable a plug-and-play style of modular composition where modules are plugged to make a whole. The following sections show how VCL packages modularise generic concerns (section 5), how VCL packages are used to customise generic packages to some context (section 6), how VCL packages modularise concerns of the problem domain, which can either be crosscutting or not (section 7), and how VCL packages can be composed to make larger packages, ultimately to arrive at a package of a subsystem (section 8).
5
Packages That Localise Generic Concerns
VCL packages can modularise solutions to generic concerns to enable their use in various settings. They constitute a functional unit that can be reused and has state of its own; each package comprises a definition of structure (described using structural and constraint diagrams) and behaviour (described using contracts). The following shows the VCL modularisation of the following generic crosscutting concerns: authentication of users, access control, management of session activity, security management, logging, mapping and video-surveillance. In [14] we also address the location tracking concern. To illustrate VCL’s formal Z semantics, we provide in [14] the Z representation of some of the packages developed in the next sections. 5.1
Users
Common to both authentication and access control, are concerns related with users. This section defines packages to represent and manage users. Package definitions. To represent user information and manage users, we introduce packages Users and UsersMgmt; both describe user-related concerns. Figure 7 (left) defines package UsersMgmt, which extends Users; this means that the former incorporates the latter and adds something of its own. The Z model resulting from these VCL packages is given in [14].
Using VCL as an Aspect-Oriented Approach to Requirements Modelling
IDOfUsersUnique
UsersHaveSameId
UsersHaveSameId
㱺 UsersEqual
UsersEqual
u1 : User
u1 : User
u2 : User
u2 : User
u1
uid
u2.uid
159
u1
u2
Fig. 8. Constraint diagram defining constraint IDOfUsersUnique
Structure. Packages encapsulate structures, which are defined in the package’s VCL structural diagram (SD). SDs’ main construct is the blob, a rounded contour denoting a set, that represents some system entity. There are two types of blobs: domain (bold line) and value (normal line). Domain blobs are part of the state of the overall system; they are dynamic and need to be maintained by the system. Value blobs define an immutable set of values that do not need to be maintained by the system. To represent objects (members of some blob) VCL uses rectangles. Figure 7 presents SD of package Users. Domain blob User represents users of a system; it is to be used by other packages requiring user-related functionality. Value blob UserStatus defines a set by enumerating its elements inside its contour (symbol says that a blob is defined by what it encloses); it says UserStatus comprises distinct elements named loggedIn, loggedOut and blocked. The labelled arrows emanating from User are called property edges; they define properties possessed by all elements of the set. User objects have a user identifier (uid), the actual name of the user (name), a password (pw), a record of the number of password misses (pwMisses) kept for security reasons, and a login status (status), representing the fact that a user may be logged-out, logged-in or blocked because the number of password tries exceeded the allowed maximum. The object (rectangle) linked to User defines a local constant visible only in the scope of this blob; maxPwMisses of blob Nat (natural numbers) represents the maximum number of allowed consecutive password misses. In VCL, elongated hexagons represent constraints. The one connected to User defines a local invariant (in OO terms a class invariant), which restricts the number of valid instances of this blob. Invariant IDOfUsersUnique is defined in the constraint diagram of figure 8, which expresses graphically, in a style akin to the predicate-calculus (see [5,3] for details), that if two users have the same id, then they must be the same user. Behaviour. VCL’s unit of behaviour is the operation. VCL packages comprise a collection of structures, such as blobs and property edges; operations manipulate the information stored in these structures. Contracts define operations, describing what they must do. In VCL, operations may be local or global. They are local when they describe the internal behaviour of a single structure. A global operation describes the collective behaviour of a collection of structures. The global operations of a package define the behaviour that the package offers to the outside world.
160
N. Am´ alio et al.
CreateUser
New
EditUser
User Edit
User
RemoveUser
GetUserGivenID
ChangeUserPassword Delete ChangePassword
GetID
Fig. 9. Behavioural diagrams of package Users (left) and UsersMgmt (right)
GetID
GetUserGivenID uid? : UID
u! : User uid u!
uid?
u? : User uid u?
uid! : UID
uid!
Fig. 10. Constraint diagrams defining local observe operations GetUserGivenID and GetID of blob User in package Users
VCL behavioural diagrams (BDs) identify the operations of a package. There are two types of operations: update and observe (or query). Update operations perform changes of state in the system; they involve a pair of states: before-state (described by pre-condition) and an after-state (described by post-condition). They are defined in VCL contract diagrams. Query operations observe some state of the system and they involve a single state. They are defined in constraint diagrams, differing from ordinary constraints in that they return values (the observations). In BDs, update operations are represented as contracts (double-lined elongated hexagons labelled with the name of the operation); observe operations are represented as constraints (single-lined elongated hexagons); in VCL’s tool, double-clicking on operations represented in a BD takes the user to their definition. Local operations are connected to the structure whose behaviour they operate upon. Global operations stand alone. Figure 9 presents BDs of package Users (left) and UsersMgmt (right). BD of package Users introduces observe operations GetUserGivenID and GetID of blob User, which yield, respectively, a user object given a user identifier and a user identifier from a user object. Package UsersMgmt defines operations for managing users; it introduces global operations CreateUser, EditUser, RemoveUser and ChangeUserPassword, and local operations of blob User. Because they involve a single state, query operations are defined using constraint diagrams. Constraint diagrams of figure 10 define observe operations GetUserGivenID (left) and GetID (right) of blob User. They differ from the normal constraint of figure 8 in that they output a value (the observation). GetUserGivenID receives a user id as input (uid?) and outputs the corresponding User object (u!).3 In VCL, inputs are decorated with ?; outputs with !. GetID receives a user object as input (u?) and outputs a user id (uid!). 3
In VCL contract and constraint diagrams, objects say the set to which they belong; such sets must be visible in the package of the contract or constraint.
Using VCL as an Aspect-Oriented Approach to Requirements Modelling New
Delete
uid? : UserID
pw? : Password
name? : Name
u! : User
ChangePassword u? : User
pwNew? : Password
pwOld? : Password
uid u!
status
u? : User
161
uid? u?
name pw
name?
pwMisses
pw?
loggedOut
0
u?
pw
u?
pw
status [] pwOld?
pwNew?
loggedIn
Fig. 11. Contract diagrams defining local operations New, Delete and ChangePassword of blob User
VCL contract diagrams describe update operations. They have a name, a declarations compartment, and a predicate compartment sub-divided into preand post- condition compartments. Predicate compartments have a differential meaning regarding an active unit (object, link or blob), which is represented in bold: (a) an active unit on the left (precondition), but not on the right means deletion; (b) an active unit that is on the right compartment (postcondition), but not on the left means creation; (c) the state of an active unit is updated if it is both on left and right compartments. Figure 11 presents contract diagrams for local operations New, Delete and ChangePassword of blob User. They are as follows: – New receives as inputs a user id (uid?), a password (pw?), and an actual name of a user (name), and assigns these to the properties of the newly created User object (u!) (an active object) in the postcondition compartment; u! is an output of the contract. – Delete receives the User object to delete (input u?), and states as a precondition that u? may be deleted provided its status is not logged-in. – ChangePassword takes as inputs a user (u?), old password (pwOld?) and new password (pwNew?). Precondition requires that user’s new password matches old password. Postcondition sets user’s password (pw) to new password. Global operations incorporate (or extend) local ones, and they define some extra behaviour of their own (in the form of pre- and post- conditions). This form of contract composition is achieved through contract importing. A contract placed on the declarations compartment means that it is being imported. Figure 12 presents contract diagrams for global operations CreateUser, RemoveUser and ChangeUserPassword. These contracts import, respectively, local operations New, Delete and ChangePassword of blob User. The meaning of contract importing is conjunction. When a contract imports other contracts, this means that the overall contract is formed as the conjunction of all imported contracts plus the part that the importer defines as its own; pre- and post- conditions of imported contracts are conjoined with pre- and post- conditions of importer. There is no implicit or required ordering in the
162
N. Am´ alio et al.
CreateUser uid? : UID
RemoveUser pw? : PassWord
name? : Name User
ChangeUserPassword
uid? : UID User
uid? : UID Delete
New
User User
pwNew? : Password
pwOld? : Password GetUserGivenId [u?/u!]
GetUserGivenId [u?/u!] User
ChangePassword
Fig. 12. Contract diagrams defining global operations CreateUSer, RemoveUser and ChangeUserPassword of package UsersMgmt
conjunctions underlying contract importing (in logic, conjunction is commutative). VCL operations specify a computation, when operations are conjoined that means that corresponding computations are performed in parallel synchronised on the communication channels being shared. The actual sequential ordering of operations is a decision to be taken at lower levels of abstraction, such as implementation. Contracts may import constraints as well as other contracts. A constraint is imported when placed on the declarations compartment; in this case, the constraint’s state refers to the contract’s before-state (the precondition). Usually, we place query operations in the declarations part to convey the fact that they are operations, and because they usually operate on the before state. We place constraints describing pre- or post- conditions in the appropriate predicate compartment. In contracts, inputs and outputs are communication channels; those having the same name in importer and imported contracts are shared. Sharing means that whatever goes through the channel in composite also goes through the channel with same name in parts; whenever channel names are shared, the bindings involved in the communication do not have to be made explicit. In figure 12, inputs defined in contract CreateUser are shared with imported contract User.New of figure 11. When a communication channel (input or output) is declared in imported contract, but not in composite that means that declared input is existentially quantified in composite contract and is not made available to the outside world. In contract CreateUser, output u! of User.New is existentially quantified. Contracts of figure 12 are as follows: – CreateUser takes inputs uid?, name? and pw? corresponding to inputs with same name in operation User.New (see figure 11). Output u! of User.New is existentially quantified in CreateUser. Pre- and post-conditions are those of User.New. – RemoveUser takes as input a user id (uid?) of user to delete. The declarations compartment imports query operation GetUserGivenId (defined in package Users, see [14]) and the local contract Delete of blob User. The importing of the observe operation includes a renaming expression; the output u! is renamed to u? to enable synchronisation with operation Delete, which uses
Using VCL as an Aspect-Oriented Approach to Requirements Modelling
163
this input. As input u? is not explicitly declared, it is existentially quantified. Precondition is predicate of GetUserGivenId conjoined with precondition of Delete; postcondition is that of Delete. – ChangeUserPassword takes as inputs a user id (uid?), old password (pwOld?) and new password (pwNew?). The last two inputs match those of imported contract ChangePassword of User. Imported query GetUserGivenId includes a rename expression to enable synchronisation with ChangePassword. Precondition is predicate GetUserGivenId conjoined with ChangePassword’s precondition; postcondition is that of ChangePassword. 5.2
Authentication
The authentication security concern deals with authentication of users to enable them to gain access to the system’s resources. The VCL packages addressing this concern provide a solution based on password control; they are as follows: – Authentication represents the core of authentication; it constitutes an aspect. – AuthenticationOps includes authentication operations, enabling users to login and logout from a system. – AuthenticationMgmt includes operations to enable management and administration of authentication. The Z model resulting from these VCL packages is given in [14]. Package Authentication. It modularises the core of a general solution to the concern of user authentication. This package focuses on structure; it is to be extended by other packages to provide authentication-related functionality. Package Authentication (figure 13, left) extends package Users. To avoid clutter and improve usability of SDs, a system of views (part of the design of VCL’s tool) is provided. SDs have a global and a local view. The global view highlights a package’s main entities and the relations that exist between them; the local view highlights the details of some blob. Figure 13 (centre) presents the global view of Authentication package’s SD. SD of figure 13 refers to blob User of Users and introduces domain blob Session (set of sessions users can open in the system). In SDs, Relational edges or associations are labelled directed lines connecting pairs of blobs (direction is indicated by arrow symbol). They describe relations between concepts, denoting IDOfSessionsUnique Users
SID
sid Authentication User Users
HasSession 1
0..1
startTm
Session
Time
Session HasSessionIffLoggedIn
lastTmActive
Fig. 13. Package Authentication extends Users (left). Global structural diagram of Authentication (centre). Local structural diagram for blob Session (right).
164
N. Am´ alio et al.
IsLoggedIn
UserIsLoggedIn
User
cu? : User
IsLoggedIn
UserIsLoggedIn status cu?
User
loggedIn
IsLoggedIn
Fig. 14. Behavioural diagram of Authentication (left). Contract diagrams defining observe operations IsLoggedIn of blob User (centre), and global UserIsLoggedIn of package Authentication (right).
AuthenticationOps Authentication
⃝LoginResult loginOk wrongPW
Login
Logout
isBlocked User
Session
HasSession
Fig. 15. Package AuthenticationOps extends Authentication (left). SD of AuthenticationOps introduces blob LoginResult (centre). Global view of AuthenticationOps package’s behaviour diagram (right).
a mathematical relation between sets. In the diagram, HasSession is a relational edge between User and Session; its UML-style multiplicity constraint says that a user has at most one session and that a session has one user. In VCL SDs, zooming yields the local details of blobs (their local view ). Figure 13 (right) presents Session’s local SD. Session objects have a session identifier (sid); they record their starting time (startTm) and the last time they were active (lastTmActive). Constraint IDOfSessionsUnique represents Session’s local invariant requiring uniqueness of sids (see [14]); its definition is similar to the constraint diagram of figure 8, which requires uniqueness of User identifiers. Authentication’s BD (figure 14, left) introduces observe operations UserIsLoggedIn (global) and local IsLoggedIn of blob User, where the former promotes the latter. These operations check whether some user is logged or not; they are defined in figure 14 (centre, and right). Package AuthenticationOps. It provides login and logout operations. Its package diagram (figure 15, left) says that it extends Authentication. Its SD (figure 15, centre) introduces value blob LoginResult, representing the set of values to be output as a result of a Login operation. As SDs, BDs are articulated with a zooming system based on views to reduce clutter. The local view shows local behaviour of a particular modelling element; the global view highlights the package’s overall behaviour. Figure 15 (right) presents global BD of package AuthenticationOps, identifying the following operations: – Login: it authenticates users granting them access to the system by opening a system session. – Logout: it is used by users to terminate their system sessions.
Using VCL as an Aspect-Oriented Approach to Requirements Modelling LogInOk
165
Logout
u? : User
r!: LoginResult
u? : User
pw? : Password
loggedOut LoginOK
pwMisses u?
0
u?
u?
status
status
status
status loggedIn
User
LoginNotOK
u?
pw
pw?
Logout
loggedIn
loginOk
r!
loggedOut
Fig. 16. Local behaviour diagram of blob User in package AuthenticationOps (left). Contract diagrams of User operations LoginOk and Logout. LoginNotOK u? : User
LoginBlocked
pw? : PassWord
r!: LoginResult
u? : User
u?
LogInBlocked
r!: LoginResult
r!
status
LogInWrongPWToBlocked
pw? : PassWord
isBlocked
blocked
LogInWrongPw
LoginWrongPW u? : User
loggedOut
status
LoginWrongPWToBlocked
pw? : PassWord
r!: LoginResult
u?
pw?
pw []
u?
pwMisses [<] maxPwMisses
pw? : PassWord
u? : User
loggedOut
pwMisses pwMisses + 1
u?
status pw []
wrongPW
u?
blocked
pw?
pwMisses r!
r!: LoginResult
r!
wrongPw
maxPwMisses
Fig. 17. Contract diagrams describing operation LoginNotOk of blob User
Local BD of User in package AuthenticationOps is given in figure 16 (left). This introduces operations related with login and logout from the local perspective of blob User. Operation LoginOk (figure 16, centre) describes a successful login. Operation Logout (figure 16, right) describes a logout. Operation loginNotOk (figure 17) describes all cases of an unsuccessful login. Local BDs of blob Session and relational edge HasSession are described in detail in [14]. Remaining contracts of package AuthenticationOps, local and global, are also described in detail in [14]. Package AuthenticationOps is to be incorporated by CentralCCCMS package to provide user authentication services (see figure 6). Package AuthenticationMgmt. It introduces administration operations of authentication. It is built from package Authentication (figure 18, left).
166
N. Am´ alio et al.
AuthenticationMgmt ReactivateUser
Authentication
BlockUser
Fig. 18. Package AuthenticationMgmt extends Authentication (left). Global behavioural diagram of package AuthenticationMgmt (right).
Authentication UpdSessionActivity
SessionMgmt
UpdActiveTm
Session
Session
IsExpired
AuthenticationOps maxInactivityTm : Time
HasSession
GetUserSession
Fig. 19. Package diagram showing package SessionMgmt extends AuthenticationOps (left). Structural diagram showing package SessionMgmt introduces constant maxInactivityTm to blob Session defined in Authentication package (centre). SessionMgmt’s Behavioural diagram (right).
Its BD (figure 18, right) introduces global operations ReactivateUser and BlockUser (see [14] for their definitions). 5.3
Session Management
The session management concern deals with the management of the activity of user sessions. It is addressed by package SessionMgmt (figure 19, left), which extends package AuthenticationOps. This package’s SD (figure 19, centre) introduces constant maxInactivityTm, which captures the maximum period of inactivity that some session may reach. Its BD (figure 19, right) introduces global operation UpdSessionActivity, which says that there has been activity in some user session.4 Figure 20 defines the local operations of blob Session: – UpdActiveTm is used to say that there has been activity in some user session. It takes as inputs a session object (s?) and current time (now?); postcondition compartment sets property lastActiveTm of object s? to current time. – IsExpired says whether some session has expired or not. It takes as inputs a session (s?) and a current time (now?). The predicate compartment defines constraint by saying that the last time a session was updated (property lastActiveTm) must be less or equal than the current time subtracted by the maximum time of inactivity (constant maxInactivityTm). 4
Note that SessionMgmt does not make available to the outside world the global operations of package Session; it merely uses those operations internally.
Using VCL as an Aspect-Oriented Approach to Requirements Modelling IsExpired
UpdActiveTm s? : Session
167
s? : Session
now? : Time
now? : Time
lastTmActive [] lastTmActive s?
s?
now?
s?
now? - maxInactivityTm
Fig. 20. Contracts diagram of local operation UpdActiveTm (left) and constraint diagram for query IsExpired (right)
UpdSessionActivity cu? : User
UpdSessionActivityOk now? : Time
UpdSessionActivityOk
Session UpdActiveTm
UpdSessionActivityNotOk
HasSession
GetUserSession [s?/s!]
UpdSessionActivityNotOk s? : Session User Logout
cu? : User
now? : Time
GetID [u?/cu?, uid!/uid?] AuthenticationOps
Session Session
IsExpired
¬ IsExpired
Fig. 21. Contracts diagrams of global operation UpdSessionActivity
Figure 21 defines UpdSessionActivity, a global (or package) operation. It identifies two possible cases: (a) session has not expired and the last time active needs to be updated (UpdSessionActivityOk), or (b) the session has expired and therefore needs to be terminated ( UpdSessionActivityNotOk). In UpdSessionActivityOk, note the use of ↑ symbol; this imports the communications channels (inputs and outputs), as well as the predicate part of the contract (by default contract importing just imports the predicate). Contracts are as follows: – UpdSessionActivity takes as inputs a current user (cu?) and a current time (now?); it imports query HasSession.GetSession to get session of current user, which is used by the operations combined in the disjunction. – UpdSessionActivityOk imports contract Session.UpdActiveTm to update last active time of session. The precondition requires that the current session has not expired (constraint Session.IsExpired is negated). – UpdSessionActivityNotOk takes a session (s?), current time (now?) and current user (cu?) as inputs. It imports query User.GetID to get the user identifier of current user (cu?). The precondition says that the session must have expired (constraint IsExpired). Contract Logout of package AuthenticationOps is imported, so that current user is logged out and the session is deleted. Package SessionMgmt defines an aspect that is to be added to the problem domain packages so that the system takes the crosscutting functionality that it embodies into account. This involves customising the package for the CCCMS
168
N. Am´ alio et al.
String
Users AccessControl Users
RoleDescsUnique
desc 0..* User
HasRole
0..*
0..* Role
HasPerm
0..* Task
Fig. 22. Package AccessControl extends Users (left). Structural diagram for the AccessControl package (right).
context (section 6.3) and then compose the customisation of this aspect into domain packages to enable its crosscutting functionality (section 8). 5.4
Access Control
Package Authentication (section 5.2) encapsulates a simple security mechanism of user authentication: users authenticate themselves to gain access to system’s resources. In most cases, however, not all users have the same permissions in terms of the system resources they can use. This section addresses this concern by providing packages with solutions based on the rˆ ole-based access control (RBAC) [15] scheme. This is based on the rˆoles that users hold within an organisation; access permissions are defined at the level of rˆoles. The Z representation of the access control packages presented in the next sections is given in [14]. Package AccessControl. It describes a simple RBAC scheme, introducing the notion of access control policies to define who is authorised to use certain system’s resources. Package AccessControl (Fig 22, left) extends package Users (section 5.1). Figure 22 (right) presents the VCL SD of this package. It is as follows: – Domain blob Role represents a set of rˆoles; a Role has a description that identifies it. Abstract blob Task defines the set of tasks that can be performed in a system; it defines the resources that a system offers. Task is abstract because the actual set is dependent on the application domain; AccessControl is meant to be domain-independent. – Relational edge HasPerm defines permissions, saying which rˆoles are allowed to execute tasks; a Task can be executed by many Roles, and a Role may execute many tasks. Relational edge HasRole indicates rˆ oles a user can play; a User may play many rˆ oles; a Role may be played by many users. – Invariant RoleDescsUnique says that rˆ ole descriptions assigned to roles are unique. See [14] for its VCL definition. Figure 23 (left) presents BD of package AccessControl. Observe operation UserHasPerm says whether a user is allowed to execute a given task; it is defined in constraint diagram of figure 23 (right).
Using VCL as an Aspect-Oriented Approach to Requirements Modelling
UserHasPerm cu? : User
169
RoleHasPerm t? : Task
r? : Role
t? : Task
RoleHasPerm
cu?
HasRole
r?
HasPerm
t?
r?
UserHasPerm
Fig. 23. Behavioural diagram of package AccessControl (left). Constraint diagram defining query UserHasPerm of package AccessControl (right).
AccessControlMgmt AccessControl
CreateRole
DelRole
AssignUserRole
DelRoleAssignment
AddPermission
DelPermission
Fig. 24. Package AccessControlMgmt extends AccessControl (left). Global behavioural diagram of package AccessControlMgmt (right).
Package AccessControlMgmt. This package extends AccessControl (Fig 24, left). It provides operations to create and delete rˆoles, permissions, and rˆ ole assignments, as shown by its global BD presented also in figure 24 (right). See [14] for full definitions of behaviour provided by this package. 5.5
Authenticated Access Control: Composing Aspects
Package Authentication (section 5.2) provides a general user authentication scheme. AccessControl (section 5.4) provides a general rˆ ole-based access control scheme. We put these two packages together in a single package to provide a general solution to authenticated rˆ ole-based access control. Package Authorisation (figure 25, left) extends both Authentication and AccessControl. It provides the functionality of incorporated packages, plus some extra behaviour of its own. Its BD (figure 25, centre) introduces observe operation UserLoggedInAndHasPerm, which checks if some user is logged in the system and has permission to execute some task. This query is defined in constraint diagram of figure 25 (right); it puts together two observe operations. Package Authorisation constitutes an aspect to be joined with problem domain packages so that the functionality it embodies is part of the overall system. This generic package is customised to the CCCMS context in section 6.1; the customisation is then composed with problem domain packages in section 8. The Z model that defines this VCL package is given in [14].
170
N. Am´ alio et al. UserLoggedInAndHasPerm cu? : User
Authorisation Authentication
AccessControl
t? : Task
AccessControl
UserHasPerm
Authentication
UserIsLoggedIn
UserLoggedInAndHasPerm
Fig. 25. Package Authorisation extends Authentication and AccessControl (left). Authorisation’s behavioural diagram (centre). Constraint diagram defining behavioural constraint UserIsLoggedInAndHasPerm.
Users
SecAuthorisationMgmt AccessControlMgmt
SysAdmin
SysAdmin User Users
AuthenticationMgmt
UsersMgmt
UserAdmin
Fig. 26. Package SysAdmin (system administration) extends package Users (left). SD of package SysAdmin (centre). Package SecAuthorisationMgmt (secure authorisation management) extends packages UsersMgmt, AuthenticationMgmt, AccessControlMgmt and SysAdmin (right).
5.6
System Administration and Security Management
The administration and management operations of packages UsersMgmt, AuthenticationMgmt and AccessControlMgmt need to be performed in a secure way. These packages are not secure because they allow any user to add or delete users, rˆ oles and permissions. This section deals with this problem by introducing a package that localises the system administration concern, and then adds this crosscutting concern to the various packages to make them secure. Package SysAdmin (figure 26, left) extends the package Users to enable system administration by a restricted set of users. SD of this package (figure 26, centre) introduces blob UserAdmin, which is defined as a subset of blob User from package Users. UserAdmin represents users that are system administrators and have authority to perform system related tasks. This package constitutes an aspect that is to be added to the management and administration packages. Package SecAuthorisationMgmt (figure 26, right) provides a secure way of managing users, rˆ oles, permissions and rˆ ole assignments. It extends packages UserMgmt, AuthenticationMgmt, AccessControlMgmt and SysAdmin (see above). The Z model resulting from this VCL package is given in [14]. Figure 27 presents the BD of package SecAuthorisationMgmt. This illustrates the join extension mechanism, which is used here to weave in the system administration aspect. In join extension, there is a contract that describes the joining
Using VCL as an Aspect-Oriented Approach to Requirements Modelling
171
Join All
SysAdminJoin
SysAdminOp
UsersMgmt
All
AuthenticationMgmt
All
AccessControlMgmt
Fig. 27. Behavioural diagram of package SecAuthorisationMgmt. Join extension is used to add secure system administration operations.
SysAdminJoin cu? : User
SysAdmin Authentication
CreateUser
SysAdminOp
IsSysAdmin UserIsLoggedIn
cu? : User
SysAdmin
Authentication
UsersMgmt
CreateUser
IsSysAdmin
UserIsLoggedIn
Fig. 28. Contract diagram of join operation SysAdminJoin in package SecAuthorisationMgmt (left) and result of join extension for operation CreateUser of package UsersMgmt.
behaviour of an aspect (a join contract ) that is composed with a group of operations placed on a join-box. In figure 27, the join contract is SysAdminJoin, which is joined with the group of operations within the box, comprising all operations from UsersMgmt, AuthenticationMgmt and AccessControlMgmt (contracts named with keyword All refer to all global operations of a package). Label SysAdminOp on the line from SysAdminJoin to the box, names the interface operation used in SysAdminJoin. Semantics of join extension is conjunction. It means that each operation from the group placed in the join-box is conjoined with the join contract. In the joinextension of figure 27, each operation of the group is conjoined with SysAdminJoin to make a new operation named after the original operation whose behaviour is extended. Figure 28 presents the contract diagram of join contract SysAdminJoin (left) and the result of join composition for operation CreateUser of package UsersMgmt (right). These are as follows: – SysAdminJoin declares one input to represent current user (cu?), and imports the contract to which the join is to apply along with its inputs (symbol ↑); this contract is represented by the name SysAdminOp. The precondition requires that the current user is a system administrator that is logged in the system; this is expressed by placing the constraints from packages Authentication and SysAdmin in the precondition compartment.
172
N. Am´ alio et al.
EventKind Message evKind LogItem
Logging
CreateLogItem
msg tm
Time
LogItem
New
Fig. 29. Package Logging (left), its SD (centre) and its BD (right). SD defines domain blob LogItem. BD introduces global operation CreateItem and local operation New of blob LogItem.
CreateLogItem
New msg? : Message
now? : Time
msg? : Message
evk? : EventKind
li! : LogItem
evk? : EventKind
tm
li! evKind ek?
now? : Time
LogItem
New
now?
msg msg?
Fig. 30. Contract diagram for local operation New of blob LogItem (left) and global operation CreateLogItem (right) in Package Logging
– CreateUser mimics what is defined in contract SysAdminJoin: input cu?, imported contract, in this case CreateUser from package UsersMgmt, and statement of precondition. Package SecAuthorisationMgmt constitutes a module that is to be incorporated by the CentralCCCMS package to provide a secure way of managing securitycritical information (see figure 6, left). 5.7
Logging
Package Logging (figure 29, left) defines a general solution to the logging concern. It logs the activity of a system by recording events as they are executed. Figure 29 (centre) defines Logging’s SD. Domain blob LogItem represents events to be logged; LogItems have a creation time (tm), a logging message (msg) and the type of event being logged (evKind). Figure 29 (right) presents the BD of package Logging. This introduces the global (or package) operation CreateLogItem, and the New local operation of LogItem. Figure 30 gives contract diagrams for these operations. They are as follows: – New receives as inputs a logging message (msg?), a logging event (evk?), and a current time (now?), outputting the newly created LogItem object (li!); the postcondition compartment sets attributes of object li! from given input objects.
Using VCL as an Aspect-Oriented Approach to Requirements Modelling
⃝MapType MappingCommon
Loc
Route
173
mapTy Map
Fig. 31. Package (left) and structural (right) diagrams of package MappingCommon
– CreateLogItem defines the same inputs as imported local contract New. This establishes that those inputs are shared communication channels between these two contracts; as they are defined in the global contract, those inputs are to be provided by the package’s environment. Package Logging constitutes an aspect that needs to be added to problem domain packages so that the crosscutting functionality that it embodies is part of the overall system. This package is customised to the CCCMS context in section 6.2 and the customisation package is composed with problem domain packages in section 8. 5.8
Mapping
The mapping concern represents functionality related with the handling of maps. Our model considers that there is an external mapping system that provides maps upon request (use case diagram of figure 4, page 156 identifies such a system as an actor). Package Mapping defines a general solution to the mapping concern by providing an interface to this external system. The following defines the VCL packages addressing the mapping generic concern. Package MappingCommon. It defines structures that are common across several mapping packages. Its package and structural diagrams are given in figure 31. SD introduces blobs MapType (defining the two types of maps, location or route) and Map (defining a map to be displayed). Package Mapping. It encapsulates the general solution to the mapping concern. Its package and structural diagrams are given in figure 32. Blob MapManager is the package’s controller; it contains a single object5 . A MapManager holds a url of the mapping system, an availability flag of the mapping system (sysStatus), a time at which the last request to the mapping system was made (lastReqAt), a flag indicating whether there is an active mapping request or not (activeReq). In addition, blob MapManager includes a constant MReqTimeout, indicating the timeout period associated with a request to the mapping system. Blob MappingRequest represents a request to the mapping system. A MappingRequest has a request kind of blob MappingRequestKind; this represents queries to ask whether the external mapping system is available (QIsAvailable), to request a location map (RequesLocMap), or request a route map (RequesRouteMap). MappingRequest also also has two locations (locFr and locTo). 5
This follows singleton pattern of [16].
174
N. Am´ alio et al.
URL Mapping
MReqTimeout : Nat
url
⃝MapSysStatus availble
sysStatus
unavailble
MappingCommon ⃝Mapmanager
Time
lastReqAt
theMapmanager
MappingRequest activeReq
kind
locFr ⃝YesNo Yes
locTo
0..1
No
⃝MappingRequestKind ReqLocMap
0..1
ReqRouteMap
Location
QIsAvailable
Fig. 32. Package (left) and structural (right) diagrams of package Mapping
Startup
MapSysAvailable
RetryMapSys
RequestLocationMap
PutRequestedMap
RequestedMapTimeout
CouldNotFindMap
ChangeMapSys
RequestRouteMap
Fig. 33. Global Behavioural diagram package Mapping
Figure 33 presents Mapping’s global BD showing the operations offered to the outside world. This includes operations to: start the mapping controller (Startup), check if external mapping system is available (MapSysAvailable), retry an availability query on the external mapping system (RetryMapSys), request a location map from the external mapping system (RequestLocationMap), request a route map from the external mapping system (RequestRouteMap), load requested map (PutRequestedMap), issue a timeout when requested map is not delivered on time (RequestedMapTimeout), indicate that requested map could not be found (CouldNotFindMap), and change the external mapping system (ChangeMapSys). Figure 34 presents contract diagrams for the operations of Mapping that are involved in defining the global operation PutRequestedMap. It presents a contract diagram for local operation PutRequestedMap of blob MapManager (figure 34, left); this requires (pre-condition) that the external mapping system is available, that there is an active request and that the timeout period for the request has not expired; the post-condition says that there is no active request. Global contract PutRequestedMap imports its local counter-part and says that the local operation is to be executed on the sole MapManager instance. 5.9
Video Surveillance
The video-surveillance concern is related with the handling of videos requested from the external video surveillance system. In our model, we consider that there
Using VCL as an Aspect-Oriented Approach to Requirements Modelling
PutRequestedMap
PutRequestedMap
mm? : Mapmanager
m? : Map
now? : Time
sysStatus mm?
175
mm?
available activeReq
activeReq
Yes now? - mm?.lastReqAt
<
m? : Map
MReqTimeout
PutRequestedMap
now? : Time
Mapmanager
mm?
theMapManager
No
Fig. 34. Contract diagrams of operation PutRequestedMap of blob MapManager (left), and global operation with same name (right).
VideoSurveillanceCommon
Video
Fig. 35. Package (left) and structural (right) diagrams of package VideoSurveillanceCommon
is an external video surveillance system that provides video footage upon request (use case diagram of figure 4, page 156 identifies such a system as an actor). Package VideoSurveillance defines a general solution to the video-surveillance concern by providing an interface to this external system. The following defines the packages addressing this generic crosscutting concern. Package VideoSurveillanceCommon. It defines structures that are common across several packages that need video surveillance. Figure 35 presents its package (left) and structural (right) diagrams. SD introduces blob Video, which defines a video footage to be shown to the user. Package VideoSurveillance. It defines the actual general solution to the video surveillance concern. Its package (left) and structural (right) diagrams are given in figure 36. Blob Controller is the package’s controller; it represents a singleton set. Its property edges include: time of last request to the mapping system was made (lastReqAt), flag indicating whether there is an active video request (activeReq). In addition, Controller has constant VReqTimeout, indicating the timeout delay of a request to the external video-surveillance system. Blob VideoSurveillanceReq represents a request to the external video surveillance system. It has properties: location (loc) and a time period (fromTm and toTm); these indicates location and time-period of requested video footage. Figure 37 (left) presents VideoSurveillance’s global BD showing the operations offered to the outside world. This includes operations to: start the controller (Startup), request video footage from external system (ReqVideoSurveillance), cancel a video surveillance request (CancelVideoReq), load requested video (PutVideo), and issue a timeout when a video request expires (VideoRequestTimeout).
176
N. Am´ alio et al.
VReqTimeout : Nat
Time
lastReqAt
⃝Controller
toTm
fromTm
theController VideoSurveillanceReq activeReq
VideoSurveillance
loc ⃝YesNo
VideoSurveillanceCommon
Yes
Location
No
Fig. 36. Package (left) and structural (right) diagrams of package VideoSurveillance
RequestVideo
c? : Controller
New
VideoSurveillanceReq
now? : Time Startup
CancelVideoReq
RequestVideo
PutVideo
c?
activeReq
No
c?
activeReq
Yes
lastReqAt
VideoRequestTimeout
now?
Fig. 37. Global behaviour diagram of package VideoSurveillance. Contract diagrams of operation ViewVideoSurveillance of blob Controller (left)
Figure 37 (right) presents the contract diagram of operation RequestVideo of blob Controller. This requires (pre-condition) that there is no active request; the post-condition sets the active request flag and the lastReqAt property to the current time (input now?). The global contract of RequestVideo would import the local contract with the same name and request it to be carried out by the sole Controller instance (similarly to Mapping’s global contract of figure 34).
6
Customising Generic Packages for the CCCMS Context
Generic packages are designed to be used in various settings. Usually, they need to be configured (or adjusted) for the new context in which they are used. The next sections illustrate such customisations; they show how generic packages from section 5 are customised to the CCCMS. 6.1
Customising Authorisation by Defining a Configuration
Customisation of package Authorisation is performed by defining packages ACTasksCCCMS and the configuration AuthorisationCCCMS (figure 38). Package ACTasksCCCMS defines the set of tasks that are subject to access control in the CCCMS; it sees package AccessControl (figure 38, left). The sees arrow defines a dependency relationship; in the figure, it means that it uses
Using VCL as an Aspect-Oriented Approach to Requirements Modelling
177
AccessControl
Task AuthorisationCCCMS
⃝CCCMSTask
ACTasksCCCMS
CrisisTask
Authorisation
ResourceTask
sees ResourceMgmtTask
ACTasksCCCMS
CoordinatorTask
AccessControl
Fig. 38. Package ACTasksCCCMS sees AccessControl (left). Package ACTasksCCCMS specialises Task in the context of CCCMS (centre). Package AuthorisationCCCMS extends Authorisation and sees ACTasksCCCMS (right).
DefMaxPwMisses
Authorisation
User
maxPwMisses:Nat maxPwMisses
3
DefMaxPwMisses
Fig. 39. SD of package AuthorisationCCCMS (left). Definition of constant maxPwMisses (right).
structures defined in AccessControl, but those structures are not part of the state of the newly defined package. Package ACTasksCCCMS defines set CCCMSTask, which subsets set Task of package AccessControl (see [14] for further details) and defines all CCCMS tasks to be subject to access control. Package AuthorisationCCCMS (figure 38, right) customises package Authorisation (authentication+access control, section 5.5) to the CCCMS; it extends packages Authorisation and ACTasksCCCMS. It defines a set of initial rˆ oles and permissions, and customises constant maxPwMisses of blob User. Figure 39 (left) presents SD of package AuthorisationCCCMS. This package does not add any new state; it merely inherits state from package Authorisation. SD says that constant maxPwMisses of blob User has a constraint defining it. This constraint defines maxPwMisses to hold value 3 (figure 39, right). Figure 40 presents constraint diagrams defining the initial state of package AuthorisationCCCMS. In VCL, the keyword Init associated with a constraint indicates that an initialisation of some structure or package is being defined. Constraint diagrams of figure 40 are as follows: – Init defines package’s initial state. It imports other constraint diagrams defining initial state of set Role (InitRoles), and initial state of permissions with respect to tasks of crisis management (InitCrisis), mission management (InitMission) and resource management (InitResources). – InitRoles defines rˆ oles Coordinator and Resource.
178
N. Am´ alio et al. Init
InitRoles InitCrisis
InitRoles
InitMission
r1 : Role
InitCrisis
r2 : Role
r1 : Role
InitResourceMgmt
HasPerm r1 : Role
desc r1 : Role
CrisisTask
'Coordinator'
desc r2 : Role
'Resource'
ACTasksCCCMS
Fig. 40. Constraint diagrams specifying initialisation of the package AuthorisationCCCMS (Init), initialisation of roles (InitRoles) and an initialisation for the permissions for the tasks related with crisis management (InitCrisis).
– InitCrisis says that the role r1 (Coordinator) has permission to execute all tasks of set CrisisTask defined in package ACTasksCCCMS. – Remaining constraint diagrams defining initial states are defined in [14]. Package AuthorisationCCCMS needs to extend the behaviour of Authorisation. Its BD is given in figAuthorisation All ure 41. Its global operations are all operations of Authorisation, which are kept unaltered; this is deFig. 41. BD of Authorisa- fined using integral extension on all global operations of package Authorisation. This is expressed by tionCCCMS package. connecting a contract with keyword All to the package where operations come from. When extensions are defined in this way, no extra contract definitions are necessary. 6.2
Customising Logging by Adjusting Behaviour
To use the generic Logging package in CCCMS, its structure and behaviour need to be adjusted. This is done following the incremental or additive approach to change that characterises VCL: we define new structures and operations that extend those of the generic package. Packages EventsCCCMS and LoggingCCCMS customise package Logging (section 5.7) to the CCCMS context. This involves the following adjustments: – Package EventsCCCMS defines the events to be logged in CCCMS, by defining set CCCMSEventKind, a subset of EventKind blob defined in Logging (Figure 42). – Blob LogItem of package Logging does not carry enough information for the needs of CCCMS. LoggingCCCMS extends this blob to carry the required extra information, providing operations for the new structure. Package LoggingCCCMS (figure 43, left) extends package Logging and sees package EventsCCCMS. Its SD (figure 43, right) introduces three sub-blobs (subsets) of blob LogItem: CrisisLogItem, ResourceLogItem and MissionLogItem. These blobs represent log items of events related with crisis management, resource management and mission management, respectively. They define a property to hold an identifier of either a crisis, mission or resource.
Using VCL as an Aspect-Oriented Approach to Requirements Modelling
179
EventKind EventsCCCMS
⃝CCCMSEventKind Logging
sees MissionEventKind
CrisisEventKind
ResourceEventKind
Logging
Fig. 42. Package EventsCCCMS extends Logging (left). EventsCCCMS’s SD specialise blob EventKind defined in Logging (right).
LogItem crisisID
CrisisLogItem
LoggingCCCMS resourceID
Logging
ID
Logging
ResourceLogItem missionID
EventsCCCMS
MissionLogItem
Fig. 43. Package LoggingCCCMS extends Logging and sees EventsCCCMS (left). LoggingCCCMS’s SD introduces blobs CrisisLogItem, ResourceLogItem and MissionLogItem, which are defined as subsets of blob LogItem defined in package Logging (right).
CreateLogItem
Logging
CrisisLogItem
New
ResourceLogItem
New
MissionLogItem
New
CreateCrisisLogItem CreateResourceLogItem CreateMissionLogItem
Fig. 44. Behavioural diagram of package LoggingCCCMS, comprising local operations New of blobs CrisisLogItem, MissionLogItem and ResourceLogItem, and global operations CreateLogItem (defined from Logging by integral extension), CreateCrisisLogItem, CreateResourceLogItem and CreateMissionLogItem.
Figure 44 presents BD of package LoggingCCCMS. This defines local operations New of blobs CrisisLogItem, MissionLogItem and ResourceLogItem, and global operations CreateLogItem (defined by integral extension), CreateCrisisLogItem, CreateResourceLogItem and CreateMissionLogItem. Global operation CreateLogItem enables logging of general log items; remaining global operations log items related with crisis, resource and mission management. Contracts for these operations are fully defined in [14]. Operation New of blob LogItem, defined in package Logging, creates general LogItem objects; in package LoggingCCCMS, we need new operations to take specialisations of LogItem into account; this is done using behavioural extension.
180
N. Am´ alio et al. CreateCrisisLogItem
New cID? : ID
now? : Time
ek? : EventKind ek?
li! : LogItem
now? : Time
ek? : EventKind
CrisisLogItem
New
LogItem
'Crisis Event'
li!
New
msg?
CrisisLogItem
CrisisEventKind
cID? : ID
crisisID
cID?
Fig. 45. Contract diagram defining operations New of blob CrisisLogItem and CreateCrisisLogItem.
This is illustrated in figure 45, which gives contract diagrams for operations New of blob CrisisLogItem and global operation CreateCrisisLogItem: – Operations New of blob CrisisLogItem declares inputs cID?, ek? and now? and imports operation New of blob LogItem (defined in package Logging), which is the operation to specialise. Predicate compartments define the extra behaviour of this operation. The precondition says that input ek? must belong to set CrisisEventKind defined in package EventsCCCMS. The postcondition sets property crisisID of object li! to input cID?, requires that li belongs to set CrisisLogItem, and sends the message to be logged with value ‘Crisis Event’ to imported operation New over input msg?. – Global operation CreateCrisisLogItem declares same inputs as imported CrisisLogItem.New. Pre- and post-conditions are as in imported contract. 6.3
Customising Session Management
VCL package SessionMgmtCCCMS customises package SessionMgmt (figure 31). It specifies the value of constant maxInactivityTm (maximum period of inactivity) to be 30 minutes and defines its operations by integral extension (as operations of LoggingCCMS in figure 44). See [14] for full details. 6.4
Customising Mapping
VCL package MappingCCCMS represents customisation of package Mapping (figure 32) to the CCCMS. It specifies the value of constant MReqTimeout (timeout of a request to the mapping system) to be 30 seconds and defines its operations by integral extension (as operations of package LoggingCCMS in figure 44). See [14] for full details. 6.5
Customising Video-Surveillance
VCL package VideoSurveillanceCCCMS represents customisation of package VideoSurveillance (figure 35) to the CCCMS. It specifies value of constant VReqTimeout (timeout of a request to the video-surveillance system) to be 30 seconds and defines its operations by integral extension (as operations of package LoggingCCMS in figure 44). See [14] for full details.
Using VCL as an Aspect-Oriented Approach to Requirements Modelling
Mission
ResourceMgmt
Resource
Resource
181
Crisis
MappingDisplay
Fig. 46. Core packages that modularise problem domain concerns in CentralCCCMS subsystem
7
Packages That Localise Problem Domain Concerns
A key design principle that we followed in modelling this large-scale case study is to decompose by localising key functionalities and then incrementally add details by defining extensions. We call this design principle: keep key modules as local as possible. This principle is followed in order to maintain low-coupling in our package design. This can be observed in our design for the general packages that describe a solution to a crosscutting concern, such as Authentication and AccessControl (section 5). We can see that from these more localised packages, we defined an extension that brings the two packages together to define Authorisation, and then we add further detail to adjust Authorisation to the problem domain context (section 6). In the design of the packages that capture the problem domain, the same principle is followed. Core domain packages focus on domain concerns only in order to keep things as small and as local as possible. Domain packages are then composed with other packages to bring about the desired system. Figure 46 overviews the core domain packages of the CentralCCCMS subsystem. This includes: – package Mission, which extends package Resource and localises the mission management concern; – package ResourceManagement, which extends package Resource and localises the resource management concern; – package Crisis, which localises the crisis management concern and; – package MappingDisplay, which localises the concern of map handling that is common to both MobCCCMS and CentralCCCMS subsystems. All these packages are fully defined in [14]. The next sections present the domain packages that address the crisis management concern, and illustrate VCL’s capability to capture crosscutting domain concerns with package MappingDisplay. 7.1
Crisis Management
The following overviews the VCL model of the crisis management domain concern, presenting VCL packages CrisisCommon, WitnessReports and Crisis. Package CrisisCommon. It introduces structures that are common across crisisrelated functionality. Its package and global structural diagrams are given in figure 47. Its complete definition is given in [14].
182
N. Am´ alio et al.
⃝CStatus
⃝Level
active
low
ongoing
medium
solved
high
ViID
CrisisType
VeID
CrisisID
⃝VehicleType Victim
VictimListInfo
Vehicle
VehicleListInfo
⃝AgeGroup
CrisisCommon child
adult
Car
Van
Truck
Bus
⃝Gender senior
female
male
Fig. 47. Package diagram describing package CrisisCommon (left) and its global structural diagram (right)
Package WitnessReports. It encapsulates functionality related with witness reports. Its package, structural and behavioural diagrams are given in figure 48. The SD introduces blob WitnessReport, which holds information of car crashes reported by witnesses. The BD introduces global operations CreateWR (to create a witness report), ViewWR (to view a witness report), GetUnassignedWrs (to obtain those witness reports that are active and have not been assigned to a crisis), together with local operations of blob WitnessReport. Full definition of this package is given in [14]. Package Crisis. It encapsulates the functionality of the crisis management feature. Its package and structural diagrams are given in figure 49. The package diagram says that Crisis extends packages CrisisCommon, WitnessReports and VideoSurveillanceCommon (section 5.9, page 174). The SD introduces blob Crisis, which represents the actual crisis instance opened in the system, and some relational edges. Relational edges Vehicles and Victims indicate, respectively, the vehicles and victims involved in a crisis. Relational edge BasedOn indicates that the witness reports are associated with a crisis instance. Figure 50 presents the global BD of package Crisis. This uses integral extension to say that all global operations of package WitnessReports are brought into Crisis, and introduces the following global operations: – – – – – –
CreateCrisisFromWR: create a crisis from some witness report. AssociateWRWithCrisis: associates a witness report with an existing crisis. IgnoreWR: ignores a witness report because it is considered irrelevant. AddNewCrisisVictim: adds a victim record as part of an existing crisis. AddNewCrisisVehicle: adds a vehicle record as part of an existing crisis. ViewVideoSurveillance: asks for video surveillance footage of some location (contract diagram defining this operation is given in figure 50). – CancelVideoSurveillanceReq: cancels a previous request for video surveillance. – ShowVideoSurveillanceReq: shows the video surveillance request footage. This package’s complete definition is given in [14].
Using VCL as an Aspect-Oriented Approach to Requirements Modelling
Name
183
PhoneNo WRID witPhNo
reportedBy
id Location
where
witNm
Time
createdAt
WitnessReport
when CreateWR
Notes
desc status
ViewWR
IDOfWRsUnique
roadBlocked
GetUnassignedWRs
⃝WRStatus
⃝YesNo yes
no
created
activated
ignored
WitnessReport
New
WitnessReports associatedWithCrisis
GetWR
Fig. 48. Package diagram describing package WitnessReports (left), and its structural (centre) and behavioural diagrams (right)
Crisis WitnessReports
CrisisCommon
Victim 0..*
CrisisCommon
WitnessReports Victims
VideoSurveillanceCommon
1 Vehicle
0..*
1
Vehicles
Crisis
BasedOn 0..1
0..*
WitnessReport
Fig. 49. Package (left) and structural (right) diagrams of package Crisis
WitnessReport
All
ViewVideoSurveillance loc? : Location
CreateCrisisFromWR IgnoreWR AddNewCrisisVehicle
CancelVideoSurveillance
AssociateWRWithCrisis
now? : Time
fromTm? : Time toTm? : Time
AddNewCrisisVictim ViewVideoSurveillance ShowVideoSurveillance
Fig. 50. Behavioural diagram of package Crisis and contract diagram defining operation ViewVideoSurveillance
184
N. Am´ alio et al.
⃝MapDisplayStatus NotActive status ⃝MapDisplay MappingDisplay
⃝MapLoadingStat us Loading
Active
BeingShown
loadMode currMap
0..1
theMapDisplay
Map
MappingCommon
mapTy MappingCommon
MapType prvMapTy
Fig. 51. Package diagram describing package MappingDisplay, which extends MappingCommon. Structural diagram of package MappingDisplay.
New Startup
StartMapDisplay
LoadMap
LoadMapTimeout
CouldNotFindMap
DisplayLocation
StartMapDisplay
MapDisplay
LoadMap LoadMapTimeout CouldNotFindMap
DisplayRoute DisplayRoute
DisplayLocation
Fig. 52. Behavioural diagram of package MappingDisplay
7.2
Package MappingDisplay
This package describes a generic user interface for handling maps that is common to both MobCCCMS and CentralCCCMS. It is package focused on the display of maps to the user that abstracts away from other features of mapping (such as the interface to the mapping system). Its package diagram is given in figure 51 (left); package MappingDisplay extends package MappingCommon (section 5.8). Package MappingDisplayWithMapSys (section 8) extends this package to incorporate the Mapping package defined in section 5.8. Structure. Figure 51 (right) presents the SD of package MappingDisplay. Blob MapDisplay is a singleton. Blob MapDisplay has properties: map to display (currMap), current map type (mapTy), type of previous map (prvMapTy), load mode (loadMode), which indicates whether a map is currently being loaded (Loaded) or it has been loaded and is being shown (BeingShown), and current status of the display (status), which can either be Active or NotActive. Behaviour. Figure 52 presents the BD of package MappingDisplay. This identifies this package’s global operations together with local operations of blob
Using VCL as an Aspect-Oriented Approach to Requirements Modelling
185
LoadMap
md? : MapDisplay
md?
status
loadMode loading
LoadMap
m? : Map
Active
md? currMap
loadMode
theMapDisplay
BeingShown
m? : Map
md? LoadMap
MapDisplay
prvMapTy
m?
md?.mapTy
Fig. 53. Contract diagrams of local operation LoadMap of blob MapDisplay (left) and global operation with same name (right) in package MappingDisplay
MapDisplay. This includes operations to: initialise the map display controller (Startup), start displaying some map (StartMapDisplay), load a new map to display (LoadMap), take the appropriate action when there is timeout in loading some map (LoadMapTimeout), indicate that the requested map has not been found (CouldNotFindMap), display a location map for some location (DisplayLocation), and display a route map (DisplayRoute). Figure 53 presents contract diagrams of local operation LoadMap of blob MapDisplay together with the global operation with same name. Local LoadMap requires that the map display is active and that the loading mode is Loading; the post-condition takes the map sent as input and sets it as the current map, changes the loading mode to BeingShown and sets the previous map type to that of the current map. Global LoadMap just dispatches the request to the sole MapDisplay instance. Remaining operations of this package are defined in [14].
8
Composing Domain Packages with Aspect Packages
The previous section fragmented the problem domain into coherent modules. These modules are confined to problem domain phenomena. They talk about crisis, missions, and mission resources, excluding access control, logging and other crosscutting concerns. This section shows how aspect packages are joined with problem-domain packages. This is illustrated with the crosscutting concerns: authentication, access control, session management, logging and mapping. VCL package composition has already been illustrated. We have seen in sections 5 and 7 how it enables composition of any kind of module, be it a classical module or an aspect. This section continues this theme by showing how aspect packages can be joined into domain packages. In our AOM approach based on VCL, this can be done in two ways: (a) directly by specifying a package that represents the composition and incorporates the packages being composed, (b) or indirectly via a join interface. The following illustrates these two approaches. 8.1
Direct Composition
The direct composition approach is illustrated with mapping and videosurveillance.
186
N. Am´ alio et al. Merge StartMapDisplay
MappingDisplay
Startup PutRequestedMap CouldNotFindMap
MappingCCCMS MappingDisplayWithMapSys
Startup
PutRequestedMapTimeout DisplayRoute
CouldNotFindMap DisplayLocation
MappingDisplay MappingCCCMS
MapSysAvailable
MappingCCCMS RetryMapSys
Fig. 54. Package (left) and behavioural (right) diagrams of package MappingDisplayWithMapSys PutRequestedMap
MappingDisplay
LoadMap
MappingCCCMS
PutRequestedMap
Fig. 55. Contract diagram of global operation PutRequestedMap of package MappingDisplayWithMapSys
Mapping. Package MappingDisplayWithMapSys (figure 54) links domain package MappingDisplay (section 7.2) with generic Mapping package (section 5.8) to make a package that displays maps and interacts with an external mapping system. Figure 54 presents its package (left) and behavioural (right) diagrams. The package diagram says that this package incorporates packages MappingDisplay and Mapping. These two packages are linked at the behavioural level. BD says that the operations Startup and CouldNotFindMap of packages MappingDisplay and Mapping are to be merged ; this is expressed using VCL’s merge join box, which creates, through merging (conjunction) a new operation with the same name as those being merged. BD uses integral extension to say that operations MapSysAvailable and RetryMapSys are to be used integrally. The remaining operations of BD perform the behavioural composition using custom extension, being defined in their own contract diagrams. Figure 55 shows how this is done for operation PutRequestedMap; it puts together operations PutRequestedMap from Mapping (figure 34, page 175) and LoadMap from MappingDisplay (figure 53, page 185). Video surveillance. Package CrisisWithVS links the domain package Crisis (section 7.1) with the generic VideoSurveillance package (section 5.9) to make
Using VCL as an Aspect-Oriented Approach to Requirements Modelling
187
CreateCrisisFromWR
CreateWR
IgnoreWR
CrisisWithVS
Crisis
ViewWR
AssociateWRWithCrisis AddNewCrisisVictim
Crisis GetUnassignedWRs
VideoSurveillanceCCCMS
ViewVideoSurveillance
AddNewCrisisVehicle ShowVideoSurveillance
CancelVideoSurveillance
Fig. 56. Package (left) and behavioural (right) diagrams of package CrisisWithVS ViewVideoSurveillance Crisis VideoSurveillance
ViewVideoSurveillance
RequestVideo
Fig. 57. Contract diagram of global operation ViewVideoSurveillance of package CrisisWithVS
a package that handles crisis and interacts with a video surveillance system. Its package (left) and behavioural (right) diagrams are given in figure 56. The package diagram says that it incorporates both packages Crisis and VideoSurveillance. These two packages are combined at the behavioural level. The BD uses integral extension to say that operations of package Crisis are used integrally in the new package (CreateWR, etc.). Remaining operations interact with the video surveillance system and are defined using custom extension. Figure 57 presents contract diagram of operation ViewVideoSurveillance, which joins two operations using a custom extension. This puts together operations ViewVideoSurveillance from Crisis (figure 50, page 183) and RequestVideo from VideoSurveillance (figure 37, page 176). 8.2
Indirect Composition via a Join Interface
In many cases, package compositions cannot be performed directly. Sometimes an interface between the packages being composed is needed. This provides extra information to link the two worlds so that composition is meaningful; at the same time, it ensures that the two worlds can be specified apart and unaware from each other; the link between the two is described in a join interface package. The method for building compositions via join interfaces is as follows: 1. Build join interfaces that describe link (or bridge) between different packages. This involves defining the extra information (usually operations) required to link the packages being composed.
188
N. Am´ alio et al.
CrisisWithJI CrisisAuthorisationJI sees ACTasksCCCMS
CrisisLoggingJI
sees
CrisisAuthorisationJI
CrisisLoggingJI
CrisisWithVS
EventsCCCMS
Fig. 58. Adding the required join interfaces to package Crisis. Package CrisisAuthorisationJI defines join interface for package Authorisation. CrisisAuthorisationJI defines joins interface for Logging. Package CrisisWithJI extends CrisisWithVS with required join interfaces.
2. Add the join interfaces to a base package (here a domain package) to make the base package fit for composition. This is usually done using a merge extension. 3. Compose aspect packages with the package representing the base enriched with the interfaces. This is usually done using join extension. Above, we added video-surveillance to domain package Crisis. This resulted in package CrisisWithVS, which is now composed with more aspects. The following illustrates the method of indirect composition with package CrisisWithVS. Defining join interfaces. Join interfaces packages for adding aspects to package CrisisWithVS are as follows (figure 58): – Authorisation requires each global operation of CrisisWithVS to indicate the corresponding access-controlled task (an object of set Task defined in package ACTasksCCCMS); this is described in join-interface package CrisisAuthorisationJI. – Logging requires each global operation of CrisisWithVS to indicate corresponding logging event (from set EventKind defined in EventsCCCMS); this is described in the join-interface package CrisisLoggiongJI. – Join with SessionMgmt does not need an interface package. – Package CrisisWithJI (Crisis with join interfaces) enriches the base package CrisisWithVS to make it fit for composition with aspect packages; it extends join interface packages and CrisisWithVS. BDs of packages CrisisAuthorisationJI and CrisisLoggingJI (figure 59) comprise operations named after global operations of CrisisWithVS. Figure 60 presents contract diagrams of operation CreateWR in CrisisAuthorisationJI (left) and CrisisLoggingJI (right). In CrisisAuthorisationJI, the contract diagram declares output t! and says in postcondition compartment that its value is TCreateWR, which is the access-controlled task corresponding to this operation. In CrisisLoggingJI, CreateWR declares output ek! and says in postcondition compartment that its value is EvCreateWR, which is the logging event corresponding to operation CreateWR.
Using VCL as an Aspect-Oriented Approach to Requirements Modelling CreateWR
CreateCrisisFromWR
ViewWR
AssociateWRWithCrisis
ShowVideoSurveillance
IgnoreWR
ViewVideoSurveillance
CancelVideoSurveillance
CreateVictim
189
GetWRs
Fig. 59. Behavioural diagram is the same in packages CrisisAuthorisationJI and CrisisLoggingJI CreateWR
CreateWR
t! : Task
ek! : EventKind
t!
TCreateWR
ek!
EvCreateWR
Fig. 60. Contract diagrams for join interface operations CreateWR in CrisisAuthorisationJI (left) and CrisisLoggingJI (right) Merge
All
CrisisWithVS
CreateWR CrisisWithVS CrisisAuthorisationJI
All
CrisisLoggingJI
All
CrisisAuthorisationJI
CrisisLoggingJI
CreateWR
CreateWR
CreateWR
Fig. 61. Behavioural diagram of package CrisisWithJI, which uses merge extension (left). Operation CreateWR of package CrisisWithJI that results from merge extension (right).
Enriching a base package with join interfaces. Individual join interfaces need to be added to the base package that is going to be the target of the ultimate composition. Package CrisisWithJI represents this composition; it extends the join interface packages and base package CrisisWithVS (figure 58, right). Joining of behaviour is done using merge extension. BD of CrisisWithJI (figure 61, left) illustrates this; it declares operations with the same name as globals of CrisisWithVS and packages defining the join interfaces. Operations with same name are merged, which results in their composition through conjunction. Figure 61 (right) shows the effect of the merge for operation CreateWR. Adding aspects to the base package. Once a base package is equipped with a join interface, it is possible to incorporate aspects. This is done following the extension or additive approach that characterises VCL.
190
N. Am´ alio et al.
CrisisWithAspects LoggingCCCMS
CrisisWithJI
LoggingOp
SessionMgmtOp
CrisisOp
Join AuthorisationCCCMS
All
CrisisWithJI
SessionMgmtCCCMS CrisisOp AuthorisationOp
Fig. 62. Package CrisisWithAspects extends packages CrisisWithJI, AuthorisationCCMS and LoggingCCMS (left). Behavioural diagram of package CrisisWithAspects specifying the join extensions (right). LoggingOp
AuthorisationOp cu? : User
CrisisOp
LoggingCCCMS
CrisisOp
AuthorisationCCCMS
CreateCrisisLogItem [ek?/ek!]
UserLoggedInAndHasPerm [t?/t!]
SessionMgmtOp
SessionMgmtCCCMS
UpdSessionActivity
Fig. 63. Contract diagrams of join operations LoggingOp, AuthorisationOp and SessionMgmtOp
Package CrisisWithAspects represents the result of adding aspects to the base package CrisisWithVS. It extends packages CrisisWithJI, LoggingCCCMS, AuthorisationCCCMS and SessionMgmt (figure 62, left). Figure 62 (right) presents its BD, which defines the global behaviour of the package using join extension. BD says that the behaviour of package CrisisWithAspects is made of all global operations defined in the package CrisisWithJI, but extended with the join contracts AuthorisationOp, SessionMgmtOp and LoggingOp. Join operations of figure 62 (right) are described in figure 63. They are as follows: – AuthorisationOp imports operation to join (CrisisOp) and declares input cu? to represent current user. Precondition says that current user must be logged in and has the required execute permissions for given task (constraint UserLoggedInAndHasPerm).
Using VCL as an Aspect-Oriented Approach to Requirements Modelling
191
– LoggingOp imports operation to join (CrisisOp), and CreateCrisisLogItem, which represents extra behaviour to add. – SessionMgmtOp imports UpdSessionActivity (see figure 21, page 167). This results in the updating of activity for session of the current user. Package CrisisWithAspects is to be incorporated by the subsystem package CentralCCCMS (see figure 6) so that this system’s model includes problem domain functionality of package Crisis augmented with all required crosscutting concerns. The process illustrated above is applied to the construction of other packages, namely: ResourceWithAspects and MissionWithAspects, also part of CentralCCCMS (see figure 6).
9
Discussion
This paper illustrates an AOM approach based on VCL with a large-scale case study. It shows how VCL’s package construct enables the modularisation of concerns that can either be generic or problem-specific, and crosscutting or not. It highlights VCL’s plug-configure-and-play based on packages, where the configuration step is in most cases trivial. VCL is a language with an abstract and declarative nature designed with a formal semantics. It tends to emphasise the what rather than the how ; it describes what is to be achieved and computed, abstracting away from the details of how it is achieved. VCL’s contracts, for instance, describe what an operation is to perform, without going into specific details on how the operation is to be implemented. This style follows the abstract mathematical semantics of VCL, which is based on set theory, predicate calculus, and design by contract. A VCL model results in a Z specification, which can be subject to formal semantic analysis using proof (assisted by a theorem prover, such as Z/Eves) to enable verification and validation of VCL models. The VCL-based AOM approach presented here is symmetric. Crosscutting and non-crosscuting modules all are represented equally as VCL packages that can be composed using VCL’s compositions mechanisms. This paper provides several illustrations of this: section 5 composes aspect packages, section 7 composes packages addressing non-crosscutting concerns, and section 8 composes aspect packages with non-crosscutting problem domain packages. VCL’s package composition mechanisms provide various ways of specifying compositions. They are as follows: – State Extension. This occurs when composite packages define their own state structures by combining state from the packages being extended; this tends to create more tightly coupled compositions. The Crisis package (figure 49, page 183) was built in this way. – Custom behavioural extension. Most package compositions presented here involve behaviour only: different behaviours from different packages are combined to make new behaviours. Custom extension combines in a single operation the behaviours from the different packages being imported. This is
192
N. Am´ alio et al.
illustrated in compositions of generic mapping with package MappingDisplay and video-surveillance with package Crisis in section 8.1. – Integral, merge and join extensions. VCL provides other ways of composing behaviour; these specialise custom extension to facilitate behavioural composition. Integral extension makes available in a new context operations coming from some package being extended; the operation is used in the new context integrally (it is not changed in any way). Merge extension merges (or conjoins) operations from different packages but with the same name in a new context. Join extension enables the addition of aspects to a group of operations. These extensions are illustrated in sections 5 and 8. VCL takes a plug-configure-and-play approach to composition. Its compositions are additive and non-invasive (composed packages are not changed); they describe how packages are plugged in or out. The configuration of compositions is, in most cases, trivial; it involves integral, join and merge extensions, which have nice modular properties. More complicated configurations involve state and custom extensions. Section 8.2 showed how concerns of access control, authentication and logging could be added to a collection of packages representing problem domain concerns in a non-invasive way (i.e., composed packages were not changed), where the laborious part consisted of defining the surrounding interface between the packages being composed. Once this was done, the composition itself was trivial; it involved merge and join extension. In other cases, the composition involves a custom extension, which, although more laborious, can also be specified in a modular and non-invasive way. VCL is designed to capture concerns with functional solutions. This reflects functional nature of VCL packages, which are functional units encapsulating structure and behaviour. France et al [2] consider two broad categories of concerns: concrete and quantitative. Concrete concerns have functional solutions, whereas quantitative concerns are based on the quantification of qualities or attributes of a system. VCL-based AOM approach presented here is applicable to concrete concerns only. Therefore, all requirements of [12] that refer to quantitative qualities (such as the system shall not exceed a maximum failure rate of 0.001%) are not expressible in VCL. VCL described most requirements of CCCMS case study [12]. We did not find difficulties in describing functional requirements. Requirements classified as non-functional in [12], such as those dealing with security, mobility, persistence, and accuracy, could also be described in VCL because they could be expressed functionally. Again, requirements corresponding to quantitative concerns could not be described because VCL has not been designed to express such properties. The size of the problem was the biggest obstacle to model the CCCMS. This often hampered our ability to conceptualise the problem, to separate concerns, and to find the right abstractions. However, once this was achieved, we could proceed with VCL modelling. Despite the difficulties, VCL’s mechanisms of separation of concerns helped to tackle the complexity of the problem. The technical report that accompanies this paper [14] is 212 pages long; the overall VCL model of CCCMS addresses eight system concerns and is made of 33 VCL packages.
Using VCL as an Aspect-Oriented Approach to Requirements Modelling
10
193
Evaluation
This section evaluates VCL against some qualitative criteria using the VCL model of CCCMS presented here. 10.1
Scalability
VCL enables the decomposition of a problem into meaningful and manageable pieces. VCL packages represent modules that are very focussed in terms of what they do and small in terms of size. VCL’s plug-configure-and-play approach to composition, where the configuration step is in most cases trivial, clearly states how a whole is composed out of its parts. It enables a non-invasive approach to composition that clearly separates the details of the composition from the inner details of the composed packages. This helps scalability by reducing complexity, aiding understanding and facilitating the construction of large models. A system can be understood by analysing its parts in isolation together with the compositions fitting different parts into ensembles. In the VCL model of CCCMS, the generic packages have less than ten structures and global operations; larger packages describe the composition of smaller parts into a whole. VCL’s package composition mechanisms do not incur a big overhead of complexity. Semantically, all they do is to define a contract, which is then conjoined with the contract(s) being imported. In the case of custom and join extensions, the composite contract may add an extra precondition and postcondition. In the end, all that needs to be done when going from the visual world to the underlying Z world is to build these conjunctions. 10.2
Usability
There are many features in VCL that benefit usability: – VCL is a visual language, which by itself tends to aid usability [17]. Visual representations, when well designed, tend to facilitate human processing [17]. – VCL’s zooming features help to reduce clutter in diagrams, which benefits usability. Users zoom in to see details and zoom out to get an overview; this is possible in both definitions of structure and behaviour. In the SD of package Authentication (figure 13, page 163), the global view highlights the package’s main structures and the relations that exist between them; through zooming it is possible to see the details of blobs Session and User (Fig. 13, right, page 163). The same applies to BDs: the global view highlights the package’s global behaviour, through zooming it is possible to see the behaviour of local structures, and by clicking on the operation (in VCL’s tool) it is possible to see its definition — for instance, see global BD of package AuthenticationOps (figure 15) and local BD of blob User (figure 16). – VCL is designed with an underlying formal semantics, providing a layer that abstracts away from the underlying mathematics. This enables users to build large formal models using intuitive visual concepts, saving them from
194
N. Am´ alio et al.
the details of mathematical formulas6 . We found that it was more productive to specify in VCL than in Z directly, and that VCL was easier to learn than Z; this, of course, need further empirical validation7 . – VCL packages and its plugging style of modular composition benefit usability by facilitating large-scale modelling. Packages can address a single concern or more than one concern; concerns can be removed or added using VCL’s plug-configure-and-play approach. 10.3
Reuse
VCL packages enable large-scale reuse at the level of abstract models. In the VCL model presented here, packages Authentication and AccessControl represent generic solutions to common concerns; they can be reused in multiple contexts requiring a similar solution. We have also seen how we could define packages that were reused in both VCL models of CentralCCCMS and MobCCCMS (package MappingDisplay of section 7.2, page 184). In the VCL-based approach presented here, adaptation and customisation of generic packages to a context is done through a configuration in an additive and non-invasive fashion, which enhances reuse. This can be observed in the customisation of generic packages to the CCCMS context done in section 6. 10.4
Correctness and Testability
VCL is designed with a formal semantics. It takes a translational approach to semantics, where Z specifications are generated from VCL models8 . These Z specifications are key for correctness and testability in VCL because they enable formal validation (or testing) and verification of certain desired properties. In Z, this is done using theorem proving. A visual approach to formal validation of UML-based models that have a ZOO semantics (also used for VCL), called snapshot analysis, is developed in [18,9]. This tests a Z specification against examples and counter-examples (represented as snapshots) using theorem proving. We intend to incorporate this approach in VCL in the future. Snapshot-analysis of [18,9] is as follows: – The modelled system’s state space can be tested using single snapshots (UML object diagrams), which can either constitute a valid model instance or not (examples and counter-examples). Theorem proving ([18,9] uses the Z-Eves prover) checks whether the snapshot is valid or not. Snapshots effectively constitute tests, and they can reveal subtle errors in models. 6
7
8
VCL’s formal Z semantics is illustrated in [14] with the Z specification of package Authorisation and its sub-packages (sections 5.1 to 5.5). Complete VCL formalisation and generation of Z in VCL’s tool, are ongoing efforts at the time of writing. VCL model presented here was developed by a team made of one Z expert, two Alloy experts and one programmer. According to our experience, VCL appeared to be easier to learn and use than Z, and it appeared that it was more productive (and abstract) to specify in VCL than in Z directly. Generation of Z from VCL is an ongoing effort at time of writing; [14] illustrates the generation of Z from VCL for some packages of the CCCMS’s VCL model.
Using VCL as an Aspect-Oriented Approach to Requirements Modelling
195
– Operations of a model can be validated using snapshot-pairs. Snapshot-pairs have a before state and an after state; they can represent either a valid or invalid state transition. Theorem proving checks the validity of snapshot pairs. The ZOO-based snapshot analysis of [18,9] has not been applied to the VCL model presented here. It could have been applied in the following ways: – We could check the security properties of access control. For instance, to check that users are not authorised to execute tasks for which they do not have the required permissions. This would involve building a snapshot-pair that would achieve this (a non-authorised user executing some task) whose invalidity would be checked using theorem proving. This could be done in isolation within the scope of package AccessControl or in the broader model of the system where AccessControl has been weaved in. – We could check properties of authentication, session management and other system concerns in a similar way. 10.5
Evolution
The VCL-based AOM approach illustrated here emphasises localisation of concerns and incremental construction of packages. This facilitates evolution because changes can be done either locally, as they are confined to individual packages, or incrementally, by adding new packages to encapsulate new requirements; often without requiring big changes to the overall model. The model of the CCCMS presented here evolved in this way. Initially, we developed a simple model that focussed on the problem domain in order to gain a better understanding of the problem. Incrementally, we kept adding more features following the process described in section 2, by building new packages that would be composed to make a larger whole. It was often the case that we needed to go back and elaborate parts of the model; however, most of these changes were local with little impact upon the overall model. 10.6
Variability
VCL’s package construct and its composition mechanisms enable the design of hierarchies of packages describing a family of model solutions. This is done by defining packages capturing the commonality of some domain, which are then specialised for several variants. For instance, in the model presented here, package Users captures the commonality that exists between Authentication and AccessControl. We could have built packages representing more than one model of RBAC in a similar way; these various models could be defined by extending a base RBAC model. 10.7
Aspect Interaction
VCL is a declarative and abstract language. Its models are set in an abstract world where computations of individual components are performed in parallel.
196
N. Am´ alio et al.
This mitigates the ordering problem that is typical of aspect interaction [19]. In the operations of our case study, there is a before-state (pre-condition) and an after state (post-condition); individual changes to the system’s components are considered to be done in parallel; there is, therefore, no sequential ordering of computations. This precludes the ordering problems associated with aspect interaction. In our VCL models, all that is required to add aspects is to enforce the pre-condition, or the post-condition, or both; the execution order of computations representing pre- and post-condition predicates does not matter at this level of abstraction. For example, the custom extension of figure 55 composes the generic mapping with MappingDisplay; the two operations being composed LoadMap and PutRequestedMap are considered to be performed in parallel, but synchronised on the communication channels that they share. In an implementation, PutRequestedMap would be executed before LoadMap, but at this level of abstraction this does not matter — that is a decision to be taken by a refinement of this model. This simplifies most compositions to a simple conjunction, without the need to specify an ordering of computations.
11
Related Work
VCL is a visual language for describing precisely structures, their constraints and behaviour at the abstract level of requirements (or high-level designs). It has a semantics based on set theory, predicate calculus and design by contract. VCL can be used on its own or in conjunction with other languages. This paper uses architectural block diagrams, and UML use case and sequence diagrams to describe the high-level requirements of the CCCMS; VCL is used to define a detailed yet abstract requirements model. 11.1
Contracts Notation
VCL uses diagrams of contracts to describe operations. VCL contracts use two compartments placed side-by-side (left and right) to describe pre- (left) and post(right) conditions. This is inspired by Catalysis’ snapshot-pairs [20], where each snapshot represents a specific system state. VCL contract diagrams, however, denote an operation specification (a relation between before and after states). Some approaches augment UML with contracts described as pairs of UML object-diagram pairs. Lohmann et al. [21,22,23] translate, using graph transformations, UML class diagrams and contracts to Java skeletons and JML assertions. Visual OCL [24] also uses graph transformations to go from contracts to OCL. Like VCL, these approaches follow a translational approach to semantics. Constraint diagrams [25,26] notation has many similarities with VCL; it describes behaviour based on pre- and post-conditions and uses circles to represent sets and insideness to represent the subset relation. Unlike VCL, this approach does not take a translational approach to semantics; instead, the language is given a semantics to enable modelling and reasoning at the visual level. Constraint diagrams, however, are formally defined notation; VCL presented here
Using VCL as an Aspect-Oriented Approach to Requirements Modelling
197
is a design of a language with an outline of a formal semantics. VCL’s design illustrated here, however, provides better modularity mechanisms than all these approaches to contracts: contracts are modules that can be composed, and packages are coarse-grained modular units encapsulating structure and behaviour. 11.2
AOM
Several aspect-oriented modelling (AOM) approaches enhance UML to support modularisation of crosscutting concerns [2,27,28,29]. France et al. [2,27] propose an approach to architectural modelling based on class models and textual OCL operations, where template-based aspect models are instantiated for a particular context and then composed with a base model; the result of the composition is a merge based on signatures (a conjunction). VCL differs in that it targets requirements modelling, it is entirely visual, and does not use templates. The composition mechanisms of [2] are akin to VCL’s merge extension; VCL provides other mechanisms of composition, such as custom and join extensions. Other AOM approaches represent crosscutting behaviour as scenarios [28,29]. Whittle and Ara´ ujo’s asymmetric approach [28] builds scenarios of crosscutting behaviour as interaction templates; these are composed with base scenarios (described as UML sequence diagrams) through an integration operator to synthesise state diagrams. The asymmetric approach of Kienzle et al. [29] defines aspect models made of class, state and sequence diagrams; it relies on pointcuts to describe points of insertion of crosscutting behaviour; behavioural models are composed through a weaving algorithm. VCL differs from these approaches in that it is symmetric, it uses contracts to totally describe behaviour (as opposed to partial scenario descriptions), and does not require complex weaving algorithms — compositions are done at the level of semantics, hidden from the visual world, and they involve simple conjunction with some merging of names. Unlike [28], VCL does not need ordering constraints to specify compositions involving crosscutting behaviour; at VCL’s level of abstraction computations occur in parallel. Unlike [29], VCL does not need pointcuts; package operations are specified separately from compositions, which are described externally in a non-invasive way. The protocol modelling AOM approach [30,31] has many things in common with VCL. It is, like VCL, symmetric and declarative, and designed for abstract modelling with an underlying formal semantics. Both take a similar declarative approach to composition not requiring weaving algorithms: the semantics of the composition operators rely on the properties of a composition operator of an underlying formal language; protocol modelling relies on the CSP parallel composition operator; VCL presented here relies on the schema conjunction operator of Z. The protocol machines approach defines compositions of individual protocol state machines, which are descriptions of behaviour. VCL offers similar compositions for contracts, VCL’s behavioural artefact. In addition, VCL provides more flexible operators for coarser-grained compositions at the package level. The composite package may define some extra behaviour of its own. VCL provides join and merge extension mechanisms to enable flexible behavioural
198
N. Am´ alio et al.
compositions at the package level, avoiding the need for individual behavioural compositions.
12
Conclusions
This paper illustrates a AOM approach based on VCL with the large car-crash crisis management system case study [12]. It illustrates VCL with fragments of the overall model to highlight VCL’s AOM features. The complete VCL model of the case study is given in [14]. This paper illustrates several VCL features that are novel: (a) a modular approach to visual description of behaviour based on contracts, and (b) the coarse-grained modularity mechanism of packages, enabling the construction and flexible composition of classical modules and packages. The most relevant contribution of this paper is to show that VCL’s novel modularity mechanisms are able to cope with the demands of large-scale modelling. In particular, the paper shows (a) how VCL’s contract notation is capable of capturing complex behaviour, (b) how VCL’s package construct enables modularisation of concerns, which can either be generic or problem-specific, crosscutting or not crosscutting; (c) how VCL’s composition mechanisms provide a general and symmetric approach to the composition of concerns; and (d) how VCL packages constitute a coarse-grained unit of reuse enabling coarse-grained modular composition.
References 1. Parnas, D.L.: On the criteria to be used in decomposing systems into modules. Communications of the ACM 15(12), 1053–1058 (1972) 2. France, R., Ray, I., Ghosh, S.: Aspect-oriented approach to early design modelling. IEE Proc. Softw. 151(4), 173–185 (2004) 3. Am´ alio, N., Kelsen, P., Ma, Q.: Specifying structural properties and their constraints formally, visually and modularly using VCL. In: EMMSAD 2010. LNBIP, vol. 50, Springer, Heidelberg (1977) 4. Am´ alio, N., Kelsen, P.: VCL, a visual language for modelling software systems formally. In: Jamnik, M. (ed.) Diagrams 2010. LNCS (LNAI), vol. 6170, pp. 282– 284. Springer, Heidelberg (2010) 5. Am´ alio, N., Kelsen, P., Ma, Q.: The visual contract language: abstract modelling of software systems visually, formally and modularly. Technical Report TR-LASSY10-03, LASSY, Univ. of Luxembourg (2010), http://vcl.gforge.uni.lu/doc/vcl-tech-rep.pdf 6. Meyer, B.: Applying design by contract. Computer 25(10), 40–51 (1992) 7. Spivey, J.M.: The Z notation: A reference manual. Prentice-Hall, Englewood Cliffs (1992) 8. Am´ alio, N., Polack, F., Stepney, S.: An object-oriented structuring for Z based on views. In: Treharne, H., King, S., Henson, M., Schneider, S. (eds.) ZB 2005. LNCS, vol. 3455, pp. 262–278. Springer, Heidelberg (2005) 9. Am´ alio, N.: Generative frameworks for rigorous model-driven development. Ph.D. thesis, Dept. Computer Science, Univ. of York (2007) 10. Am´ alio, N., Polack, F., Stepney, S.: UML+Z: Augmenting UML with Z. In: Abrias, H., Frappier, M. (eds.) Software Specification Methods. ISTE (2006)
Using VCL as an Aspect-Oriented Approach to Requirements Modelling
199
11. Am´ alio, N., Polack, F., Stepney, S.: Frameworks based on templates for rigorous model-driven development. ENTCS 191, 3–23 (2007) 12. Kienzle, J., Guelfi, N., Mustafiz, S.: Crisis management systems: a case study for aspect-oriented modeling. Transactions on Aspect-Oriented Software Development 7, 1–22 (2010) 13. Larman, C.: Applying UML and patterns. Prentice-Hall, Englewood Cliffs (2002) 14. Am´ alio, N., Ma, Q., Glodt, C., Kelsen, P.: VCL specification of the car-crash crisis management system. Technical Report TR-LASSY-09-03, LASSY, Univ. of Luxembourg (2009), http://vcl.gforge.uni.lu/doc/vcl-cccms.pdf 15. Sandhu, R.S., Coyne, E.J., Feinstein, H.L., Youman, C.E.: Role-based access control models. Computer 29(2) (1996) 16. Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of reusable object-oriented software. Addison-Wesley, Reading (1994) 17. Larkin, J.H., Simon, H.A.: Why a diagram is (sometimes) worth ten thousand words. Cognitive Sciece 11, 65–99 (1987) 18. Am´ alio, N., Stepney, S., Polack, F.: Formal proof from UML models. In: Davies, J., Schulte, W., Barnett, M. (eds.) ICFEM 2004. LNCS, vol. 3308, pp. 418–433. Springer, Heidelberg (2004) 19. Wilke Havings, I.N.L.B., Aksit, M.: A graph-based approach to modeling and detecting composition conflicts related to introductions. In: AOSD 2007, pp. 85–95. ACM Press, New York (2007) 20. D’Souza, D., Wills, A.C.: Objects, Components and Frameworks with UML: the Catalysis approach. Addison-Wesley, Reading (1998) 21. Lohmann, M., Sauer, S., Engels, G.: Executable visual contracts. In: IEEE Symposium on Visual Languages and Human-Centric Computing, pp. 63–70 (2005) 22. Engels, G., Lohmann, M., Sauer, S., Heckel, R.: Model-driven monitoring: an application of graph transformation for design by contract. In: Corradini, A., Ehrig, H., Montanari, U., Ribeiro, L., Rozenberg, G. (eds.) ICGT 2006. LNCS, vol. 4178, pp. 336–350. Springer, Heidelberg (2006) 23. Heckel, R., Lohmann, M.: Model-driven development of reactive information systems: from graph transformation rules to JML contracts. International Journal on Software Tools for Technology Transfer 9(2), 193–207 (2007) 24. Ehrig, K., Winkelmann, J.: Model transformation from visual OCL to OCL using graph transformation. ENTCS 152, 23–37 (2006) 25. Fish, A., Flowe, J., Howse, J.: The semantics of augmented constraint diagrams. Journal of Visual Languages and Computing 16, 541–573 (2005) 26. Howse, J., Schuman, S., Stapleton, G.: Diagrammatic formal specification of a configuration control platform. ENTCS 259, 87–104 (2009) 27. Reddy, R., Ghosh, S., France, R., Straw, G., Bieman, J.M., et al.: Directives for composing aspect-oriented design class models. In: Rashid, A., Aksit, M. (eds.) Transactions on Aspect-Oriented Software Development I. LNCS, vol. 3880, pp. 75–105. Springer, Heidelberg (2006) 28. Whittle, J., Ara´ ujo, J.: Scenario modelling with aspects. IEE Proc. Softw. 151(4), 157–171 (2004) 29. Kienzle, J., Abed, W.A., Klein, J.: Aspect-oriented multi-view modelling. In: AOSD 2009, IEEE, Los Alamitos (2009) 30. McNeile, A., Simons, N.: Protocol modelling: a modelling approach that supports reusable behavioural abstractions. Software and Systems Modelling 5(1), 91–107 (2006) 31. McNeile, A., Roubtsova, E.: CSP parallel composition of aspect models. In: AOM 2008, ACM Press, New York (2008)
Workflow Design Using Fragment Composition Crisis Management System Design through ADORE S´ebastien Mosser1, Mireille Blay-Fornarino1, and Robert France2 1
University of Nice – Sophia Antipolis Cnrs, I3s Laboratory, Modalis team Sophia Antipolis, France {mosser,blay}@polytech.unice.fr 2 Computer Science Department Colorado State University Fort Collins, CO 80523-1873 [email protected]
Abstract. The Service-Oriented Architecture (Soa) paradigm supports the assembly of atomic services to create applications that implement complex business processes. Assembly can be accomplished by service orchestrations defined by Soa architects. The Adore method allows Soa architects to model complex orchestrations of services by composing models of smaller orchestrations called orchestration fragments. The Adore method can also be used to weave fragments that address new concerns into existing application models. In this paper we illustrate how the Adore method can be used to separate and compose process aspects in a Soa design of the Car Crash Crisis Management System. The paper also includes a discussion of the benefits and limitations of the Adore method.
1
Introduction
In the Service-Oriented Architecture (Soa) paradigm [1], an application is an assembly of services that typically implements a mission-critical business process. A design model of a Soa application describes how services will be orchestrated when implemented, and is typically created by business process specialists. A factor that contributes to the difficulty of developing complex Soa applications is the need to address non-orthogonal concerns, such as security, data persistence and fault tolerance, in business processes. The complexity of addressing non-orthogonal concerns during design can be effectively managed using process modeling techniques that support separation and composition of non-orthogonal concerns. The use of these techniques allows developers to model orchestrations that weave and coordinate non-orthogonal behaviors across a set of services. Support for separately modeling and composing different aspects of a process can also make it easier to extend models of Soa applications with behaviors that address new or changed concerns, or with features that improve system properties such as response time. Existing process modeling tools and formalisms (e.g. Bpmn [2], Bpel [3]) do not provide the separation of concerns mechanisms needed to separate and S. Katz et al. (Eds.): Transactions on AOSD VII, LNCS 6210, pp. 200–233, 2010. c Springer-Verlag Berlin Heidelberg 2010
Workflow Design Using Fragment Composition
201
compose non-orthogonal process aspects. The Adore (Activity moDel supOrting oRchestration Evolution) method1 supports a compositional approach to modeling complex orchestrations. Models describing smaller orchestrations of services are composed to produce a model describing an orchestration of a larger set of services. The models of smaller orchestrations, called orchestration fragments, describe different aspects of a complex business process, where each aspect addresses a concern. Aspects that address non-functional concerns may be nonorthogonal and thus orchestrations that involve weaving aspects at different points in one or more services may be required. Adore allows business process specialists to model different process aspects separately and then compose them. The support for separation of concerns helps to tame the complexity of creating and evolving models of large business processes in which many functional and non-functional concerns must be addressed. Adore consists of a process modeling language and a composition algorithm. Composition is automated, and thus business process specialists do not need to manually compose the fragments they create. Adore can be viewed as a method that integrates Model Driven Development and Aspect Oriented Modeling (Aom) techniques to support development of Soa applications. From an Aom perspective, the fragments are aspects and the Adore composition mechanisms use join points, pointcuts, and advise to determine what, where and how to compose. It is important to note that Adore provides support for modeling only business process concerns, i.e., activities and their orchestrations. For example, the modeling of object structures manipulated by the activities is not supported in Adore. In this respect, Adore can be considered to be complementary to other AOM approaches that support modeling of object structures, but not of activities and their orchestrations. In this paper we demonstrate how the Adore method can be used to model processes in the Car Crash Crisis Management System (Cccms). In Section 2 we give an overview of the Adore modeling language and show how it can be used to model different aspects of the Cccms as orchestration fragments. In Section 3 we describe the Adore composition mechanism and illustrates its use on the Cccms. Consistency checking of ADORE models is discussed in Section 4. Section 5 presents an evaluation of the approach with respect to its ability to reduce cognitive load and tedious, error-prone manual effort through automated support for composing aspects. In Section 6 we give an overview of a prototype tool we developed to support the use of Adore and discuss the limitations ofAdore method, and in Section 7 we discuss related AOM work. Section 8 concludes the paper by summarizing the results and outlining planned further work.
2
Using ADORE to Model the CCCMS
In this section, we illustrate how the Cccms can be modeled using the Adore method. The complete set of models can be found on the following website: http://www.adore-design.org/doku/examples/cccms/start 1
See http://www.adore-design.org
202
S. Mosser, M. Blay-Fornarino, and R. France
After a brief introduction to Adore meta-model, we show how it can be used to realize textual use case descriptions of main success scenarios as orchestrations (cf. 2.2). A main success scenario describes a main process flow that has only one exit point [4]. Alternate scenarios and error handling are described as use case extension behavior, realized as fragments in our approach (cf. 2.3). Nonfunctional requirements are also realized as fragments (cf. 2.4). 2.1
The ADORE Method: An Overview
The Bpel is defined as “a model and a grammar for describing the behavior of a business process based on interactions between the process and its partners” [3]. It defines 9 different kinds of atomic activities (e.g., service invocation, message reception and response) and 7 composite activities (e.g., sequence, flow, if/then/else), plus additional mechanisms such as transactions and message persistence. In Adore, an orchestration of services is defined as a partially ordered set of activities, denoted as A . The different types of activities that can be defined in Adore include (i) service invocation (denoted by invoke), (ii) variable assignment (assign), (iii) fault reporting (throw), (iv) message reception (receive), (v) response sending (reply), and (vi) the null activity, which is used for synchronization purpose (nop). In an Adore process model, each process starts with a receive activity and ends with reply or throw activities. Consequently, the Adore meta-model contains all the atomic activities defined in the Bpel normative document except the wait (stopwatch activity) and the rethrow (assimilated as a simple throw) activities. Adore defines four different types of relationships between activities: wait : Start an activity a after the end of an activity a . guard : Describes a conditional wait relationship2 . fail : Start an activity a when an activity a throws a given error. weak–wait : Represents a mutual exclusion relationship 3 . As the Adore meta-model does not define composite activities, Bpel composite constructions are reified using the different relations available in the meta-model. A sequence of activities is defined by a waitFor relation; If/then/else flows are modeled using guard relations. Unlike Bpel which uses composite activities to implement loops, Adore uses iteration policies. As loop handling in Adore is out of the scope of this paper, the interested reader can find a full description of it in our previously published work [5]. A more complete description of the Adore modeling language can be found on the project web site. 2 3
An activity a guarded by (a , v, true) will start after the end of a if its output v is equal to true. Weak–wait is denoted as . Weak relations like {a c, b c} means that c will start after the end of the first activity picked from the set {a, b}. Note that wait relations like {a ≺ c , b ≺ c } means that c will start at the end of a and b .
Workflow Design Using Fragment Composition
203
According to the Ercim working group on software evolution [6], aspect– oriented approaches rely at a syntactic level on four elementary notions: (i) joinpoints, (ii), pointcuts (iii), advice and finally (iv) aspects. Joinpoints represents the set of well-defined places in the program where additional behavior can be added. In the context of Adore, we use activities to reify this notion. Pointcuts are usually defined as a set of joinpoints. In Adore, one can identify sets of activities as pointcuts using explicit declarations (e.g., use {act3 , act4 } activities as pointcuts) or computed declarations (e.g., all activities calling the service srv). Advice describes the additional business logic to be added in the initial system. Adore represents systems as a set of business processes. We reify advices in an endogenous way as business processes called fragment (see section 2.3). Finally, aspects are defined as a set of pointcuts and advices. Adore uses composition directives to bind fragments to set of activities. An aspect-oriented approach also defines at least two mechanisms: (i) aspect weaving (to integrate aspect into base program) and (ii) aspect ordering (to define an order between aspect woven around the same join points). Adore differs on the second point, as we define a merge algorithm to compose fragments around a shared join point [7] instead of ordering them (see section 3). Based on these definitions, we consider Adore to be an aspect-oriented modeling approach. 2.2
CCCMS as Service Orchestrations
In this paper we describe a Soa design of the Cccms. The use cases defined in the requirements document are treated as informal specifications of service orchestrations. We use the Adore method to produce a design model of orchestrations. It is important to note that the focus is not on modeling the internal behavior of services or activities, but on the modeling of orchestrations. In the approach, a use case is realized as an orchestration of services. The main success scenario in a use case is realized as a base orchestration, while each use case extension is realized as an orchestration fragment. The fragments are composed with the base model to produce a model describing a realization of the use case as a service orchestration. We illustrate the Adore method using the “Capture Witness Report” use case (#2). Below is the description of the main success scenario for this use case, extracted from the requirement document: Coordinator requests Witness to provide his identification. 1. Coordinator provides witness information to System as reported by the witness. 2. Coordinator informs System of location and type of crisis as reported by the witness. In parallel to steps 2–4: 2a.1 System contacts PhoneCompany to verify witness information. 2a.2 PhoneCompany sends address/phone information to System. 2a.3 System validates information received from the PhoneCompany. 3. System provides Coordinator with a crisis-focused checklist.
204
S. Mosser, M. Blay-Fornarino, and R. France
4. Coordinator provides crisis information to System as reported by the witness. 5. System assigns an initial emergency level to the crisis and sets the crisis status to active. Use case ends in success. The above scenario is realized as an orchestration of four service providers: (i) cms represents the services provided by the System actor, (ii) phoneCie represents the services provided by the PhoneCompany actor, (iii) ui represents services used to interact with the Coordinator actor and (iv) msgBus represents services used to broadcast the mission status. It only uses the wait relations between activities.
Step Acts. Step Acts. Step Acts. Step Acts. 1 {a10 , a11 } 2 a2 3 a3 4 a4 5 {a50 , a51 } 2a.1 a2a12 2a.2 a2a12 2a.3 a2a3 Step ↔ Activities correspondences Fig. 1. Orchestration representation for the Capture Witness Report use case (#2)
Figure 1 shows a graphical Adore model of the realization. The first step in the use case scenario is realized by two activities: a10 : The promptW itnessInf o operation provided by the Coordinator is invoked. This operation requests and records witness information. a11 : The setW itness operation provided by the cms is called to add the witness information to the current crisis. Steps 2, 3 and 4 in the main use case scenario (getting crisis preliminary information, building a crisis–dedicated checklist and prompting for check list answers) are each realized by a single activity: a2 , a3 , a4 , respectively. Steps 2a.1, 2a.2 and 2a.3 must be done in parallel with steps 2−4. Steps 2a.1, and 2a.2 are realized by
Workflow Design Using Fragment Composition
205
the activity a2 a12 , while step 2a.3 is realized by a2 a3 . Finally, step 5 is realized by two activities in the Adore model: a50 , which assigns the emergency level, and a51 , which sends a message on the message bus indicating that the status of this crisis is now “active”. 2.3
Realizing Use Case Extensions as Orchestrations Fragments
In Adore, a fragment is a composable orchestration, i.e., an orchestration that can be plugged into others. A fragment corresponds to a specific concern and use a partial point of view on its target. We reify this view using three special activities that are mandatory in each fragment. A special activity, called a hook (assimilated as a proceed in AspectJ [8]), represents where the fragment will be connected into an existing orchestration. An activity P represents hook predecessors, and S represents hook successors in an Adore process structure. A fragment can use a-priori unknown external entities. These entities are modeled as fragment parameters. At composition time these parameters are resolved by syntactically replacing them with references to defined entities. This parameterization mechanism allows modelers to define generic fragments that can be instantiated and used in different contexts. The Capture Witness Report (use case #2) describes six extensions to the main success scenario. We take as an example the extension #3a, stated as follows. In parallel to steps 3–4, if the crisis location is covered by camera surveillance: 3a.1 System requests video feed from SurveillanceSystem. 3a.2 SurveillanceSystem starts sending video feed to System. 3a.3 System starts displaying video feed for Coordinator. Figure 2 shows the fragment that realizes the above extension. The right branch of the fragment contains the hook, h, that represents the behavior in the targeted orchestration to which the fragment will be attached. A hook refers to a block of activities in the target orchestration. A block can consist of one or more activities. The hook predecessors (P) are the immediate predecessors of the first activity in the target block, and the hook successors (S) are the immediate successors of the last activity in the block. The right branch in Fig. 2 describes the following behavior: After the execution of the hook predecessors (P), perform the activity block referred to by (h) and then continue with the hook successors (S). The left branch of the fragment represents the additional behavioral described in the use case the extension #3a. In parallel to the behavior described by the hook (h) the system first determines if the surveillance system can cover the crisis area (t). If this functionality is available4 for this location, the process requests a video feed (steps 1 and 2 in the use case extension are aggregated in a single Adore activity a12 ) and then broadcasts it to the Coordinator interface (a3 ). This fragment uses guard relations. 4
c
The c label on the t → a12 arrow represents a guard: a12 will start only if c is evaluated as true after t’s execution.
206
S. Mosser, M. Blay-Fornarino, and R. France
Step Acts. Step Acts. Step Acts. 3a.1 a12 3a.2 a12 3a.3 a3 Step ↔ Activities correspondences Fig. 2. RequestVideo Fragment dealing with Capture Witness Report extension #3a
If we bind this fragment on the block of activities {a3 , a4 } of the orchestration defined in figure 1, the following correspondences are automatically computed5 : P → {a2 }, 2.4
hook → {a3 , a4 },
inf o → i,
S → {a50 }
Realizing Non-functional Concerns as Fragments
Adore can be used to model non-functional (NF) properties that can be realized as system behaviors. We realized three NF-concerns in the context of the Cccms case study: (i) persistence, (ii) security and (iii) statistics logging. We define five fragments to implement these concerns in the Cccms. The persistence concern involved two fragments: logCreate (transforming a transient entity into a persistent one) and logUpdate (logging status information for a persistent entity). We make the choice to handle employees (both cmsEmployee and worker entities) as persistent resource. As a consequence, the logCreate (resp. logUpdate) fragment must be woven each time a service invocation creates (resp. uses) such an entity. We realized a part of the security concerns through the following scenario: “an idle employee must be re-authenticated”. We define a dedicated fragment (authenticateWhenIdle) to deal with this concerns, and weave it on all activities interacting with an employee through the user-interface. 5
Variable unification (inf o → i) is based on type equivalence. One can explicit a given unification when such a mechanism fail (e.g., two variable with the same type in the hook).
Workflow Design Using Fragment Composition
207
We focus now on the statistics logging property description. The requirement document defines this property using the following text: – The system shall record the following statistical information on both on-going and resolved crises: rate of progression; average response time of rescue teams; individual response time of each rescue team; success rate of each rescue team; rate of casualties; success rate of missions. – The system shall provide statistical analysis tools to analyze individual crisis data and data on multiple crises. We realized this property by storing the execution time of a given action. We differentiate normal execution (the action succeeds, logTime) and exceptional execution (the action failed, logError). The two fragments realizing this property are depicted in fig 3.
(a) logTime Fragment
(b) logError Fragment
Fig. 3. Non–functional fragments storing response times and errors
The modeler can then decide to use one or both to track explicit activities in the Cccms. The previously given definition is very close to the definition of business processes performance indicators (PI) given by Carol [9]: “A performance indicator can be defined as an item of information collected at regular intervals to track the performance of a system”. As the business process management community identify explicit activities to be monitored by PI, it makes sense to use the same identification approach in the context of this case study. We can also notice that the requirement document defines at the business scenario level a non-functional property. The informal specification requires in extensions #1.1a and #3.1a that a given Cccms user must be authenticated! We naturally reified this concern as a dedicated fragment (mustAuthenticate), shared with the two associated business processes (assignInternalResource & resolveCrisis).
208
3
S. Mosser, M. Blay-Fornarino, and R. France
Composing Orchestrations
In this section we describe how the Adore platform handles the composition of orchestrations, by describing the two algorithms involved in the process: (i) fragment weave and (ii) behavioral merge. We summarize in Tab. 1 the number of times each algorithm is called and the number of actions performed on the initial model to execute the composition. Table 1. Algorithms usage (& associated actions) when modeling the Cccms Fragment Weave Behavioral Merge Executed Actions Modeled System Business-driven Cccms 23 5 2422 Including NF concerns 86 38 10838
3.1
Fragment Weaving
In this paper we give an informal description of the algorithm. A more formal and complete description can be found in our previously published work (see [10]). The weave algorithm aims to integrate a given set of fragments into an orchestration. It does not rely on the order in which fragments are presented because it reasons about all fragments separately before finally performing the weaving actions on the target orchestration. But it can only weave a single fragment on each targeted activity. When several entities wust be woven at the same point, the behavioral merge algorithm (described in next section) must be used before weaving. As the weaving algorithm is endogenous, the resulting process is an Adore orchestration that conforms to the Adore meta-model. The algorithm follows the following scenario: 1. Determine where the fragment will be inserted in the base orchestration: The modeler specifies the blocks of activities in the base orchestration that will be bound to the hooks in fragments. A mapping of a fragment hook to an activity block is called a binding. A composition unit is a set of bindings used to weave fragments into a base orchestration. A binding is formally defined as a tuple ω(f, a) where f is a fragment and a an activity or a set of activities. 2. Determine the set of actions needed to compose fragments to the base orchestration: For each binding, the composition algorithm computes the set of actions6 that must be performed on the base orchestration to include the fragment. 3. Perform the weaving: When all actions are computed, the system executes the action set to produce the composed model. To illustrate the principles, we use the Capture Witness Report use case (#2, cf. fig. 1 p. 204). It is realized in Adore as fragments that realize the five extensions specified for this use case: callDisconnected (#1a, #2a), requestVideo 6
e.g. adding an activity, creating an order. All atomic actions defined over the Adore meta-model are available on the project web site.
Workflow Design Using Fragment Composition
209
(#3a), ignoreDisconnection (#4a), fakeWitnessInfo (#5a) and finally fakeCrisisDetected (#5b). These fragments must be composed with the captureWitnessReport orchestration that realizes the main scenario. Figure 4 gives the composition unit (a set of bindings) defined by the Cccms modeler that will be used to weave the fragments into the base orchestration. Each defined fragment is bound to a block of activities using an apply directive. composition cms::captureWitnessReport { apply callDisconnected => a10; apply callDisconnected => a2; apply requestVideo(user: ’coord’) => {a3,a4}; apply ignoreDisconnection => a4; apply fakeWitnessInfo => a2a3; apply fakeCrisisDetected => a4; apply fakeCrisisDetected => requestVideo::a3; }
// // // // // // //
1a. 2a. 3a. 4a. 5a. 5b. 5b.
Fig. 4. Composition unit to build the Capture Witness Report complete process
Fragment weave in Adore is an endogenous process, and thus it is possible to weave a fragment into another fragment to produce a larger fragment. The last line of the composition unit weaves a fragment into another one. Such a composition is performed before using the targeted fragment into other weaving actions. In this case, it means that the fakeCrisisDetected fragment is woven into the requestVideo fragment. The resulting fragment is then woven into the targeted orchestration as required by the extension #3a. The orchestration model obtained for the complete use case after composition is really large, and represented in appendix7 . We show only part of the obtained result in Fig. 5 to ameliorate the readability of the result. This figure shows the before/after composition views that focuses on activities {a3 , a4 , a50 } of the captureWitnessReport orchestration. 3.2
Behavioral Merge
When several fragments {f1 , . . . , fn } must be woven into a process using the same hook, the algorithm automatically performs a preliminary merge of the fragment set to compute a merged fragment. The merge algorithm performs a unification of the fragments’ special activities (P, S and hook) to build the merged fragment [10]. The merge algorithm relies on logical unification and substitution [11]. The process is then deterministic: for a given set of fragment, there will be only one possible merged result. {ω(f1 , a), . . . , ω(fn , a)} ≡ ω(merge({f1 , . . . , fn }), a) 7
The interested reader can browse all the composition results by visiting the case study web site. The figure 17 in annexe depicts the resulting orchestration after weaving all the fragments. But readability is difficult.
210
S. Mosser, M. Blay-Fornarino, and R. France
(a) Capture Witness Report before behavioral composition (Extract)
(b) Capture Witness Report after behavioral composition (Extract) Fig. 5. Illustrating the fragment weave process on Capture Witness Report
From the composition unit described in Fig. 4, the algorithm identifies that two fragments must be woven on the a4 activity: fakeCrisisDetected (Fig. 6a) and ignoreDisconnection8 (Fig. 6b). A merge of these two fragment is then required before weaving the merged fragment using a4 as hook. 3.3
Pointcut Matching Mechanism
Adore does not focus on automatic pointcut matching as it is usual for business processer modeler to explicit the points they want to control in a given process. However, the Adore meta-model intrinsically relies on set theory and first order logic. One can then use these formal tools to automate the pointcut matching phase of the system design. We can take as an example the logError non-functional fragment, previously described. This fragment should be woven on activities which can potentially throw a fault. An activity a is a candidate for such a weaving since there exists another activity b linked to a by a f ail relation (on any ϕ fault). This statement can be formally defined using the following rule: a ∈ A , ∃b ∈ A , ∃ϕ ∈ F aults, f ail(a, ϕ) ≺ b
8
The h
disconected
−→
S red arrow represents the catch of an error thrown by h.
Workflow Design Using Fragment Composition
(a) 5b: f akeCrisisDetected
211
(b) 4a: ignoreDisconnection
(c) merge({f akeCrisisDetected, ignoreDisconnection}) Fig. 6. Illustrating the fragment merge process through a simple example
4
Analyzing ADORE Models to Identify Inconsistencies
The large size and conceptual complexity of applications such as the Cccms is the main motivation for using aspect-oriented orchestration modeling approaches such as Adore. Separation of concerns reduces the complexity when focusing (locally) on one or a few fragments, but, at the same time, increases complexity when looking (globally) at the model as a whole. To tame this complexity we proposed to analyze the fragments and composed models to detect inconsistencies and bad-smells. The Adore framework supports consistency checking at different phases. In the first phase (P1 ), consistency checks are performed within each individual fragment and orchestration model separately. In the second phase (P2 ), consistency checking involves analyzing the set of matched joint points to discover symmetric composition of fragments. In the third phase (P3 ) consistency checks involve checking the consistency of behavioral merge results9 . The last consistency checks are performed on the final orchestration models (P4 ). 9
This is an interesting property of the Adore framework: the behavioral merge only produces new fragments at shared join points. As a consequence, the consistency check mechanism is only triggered on merged fragments, and thus avoiding combinatorial explosion of fragment combinations to check.
212
S. Mosser, M. Blay-Fornarino, and R. France Table 2. Adore identification when detecting inconsistencies Rule \ step of Checks R1 Concurrent Ending R2 Equivalent Calls R3 Lack of Response R4 Design Weakness R5 Reflexive composition R6 Recursive Condition R7 Missing Weave R8 Uninitialized Variable R9 Invocation Cycle
P1 &P3 P2 P4 error – bad–smell bad–smell – bad–smell bad–smell – error bad–smell – bad–smell – error – – error – – bad–smell – bad–smell – error bad–smell – bad–smell
Each check is described as a rule. A rule can be applied at different phases of the composition process. The result is interpreted differently according to the consistency checking phase. For instance, incompleness is interpreted as bad smell at phases P1−3 and as an error at phase P4 . Table 2 summarizes how Adore interprets result of rule violations according to the phase. We applied these rules on the Cccms case study. Here we only present the rules that have helped to detect errors in our design of the application or that indicated deficiencies in the requirements. We classify these rules according to their relationships with the principles of aspect-oriented modeling. Separation of Concerns. Adore focuses on separation of activities modeling according to non-functionnal aspects and extensions to main scenarios. A side effect of separating our concerns is concurrent response spawn, redundant invocations, ... R1 : No Concurrent Ending This rule checks whether an Adore model is deterministic or not. A deterministic Adore model has only one well-defined response activity for one path in the activity graph. Such a situation must not exist in the base and fragment orchestrations. But concurrent responses can occur after composition, as a result of interactions between fragments. Such a non-deterministic situation is considered as an error at phase P1 and as a bad-smell at P4 . A design choice must be done by the modeler to fix it (e.g. introducing new activities, explicitly keeping the nondeterministic behavior). In the Capture Witness Report use case (#2), main success scenario failures are defined in extensions. For example, scenario extensions #5a and #5b are defined in parallel. The first one defines a failure when the Phone Company actor cannot verify witness informations. The second one defines another failure when the Coordinator actor declares this crisis as a fake one. Since those two different situations are handled by two different actors in parallel, the system is non-deterministic at the requirements level. We illustrate the situation in Fig. 7. Activity a131 represents failure defined in extension #5a and activity a139 represents the failure defined in extension #5b.
Workflow Design Using Fragment Composition
213
Fig. 7. R1 violation: Concurrent response spawn {a139 , a131 } (extract)
As defined in the requirements document, there is no order between these two activities. As a consequence, the process behavior is non-deterministic when the two conditions are evaluated to false at the same time. In this particular case, as there is no error handling policy in the main orchestration (resolveCrisis), we decide to let the process be non-deterministic: the first encountered exception will be propagated to the caller without any more reasoning. This rule was particularly useful in detecting “bad” join points (e.g. some invocations to user interfaces with a cmsEmployee as parameter do not correspond to interactions that should be protected by authentication). R2 : No Unanticipated Equivalent Calls. Multiple fragments can introduce service invocations that are equivalent by weaving a same fragment on several activities or by requesting a same service in different fragments. A rule that brings these equivalent services to the attention of the modeler can cause the modeler to consider how the model can be refactored to avoid unnecessary redundant invocations of services. To illustrate this rule, we focus on the statistics logging non-functional propertie. To record statistical information on response time of each rescue team, we weave the fragment logTime (cf. Fig. 3) around each invocation activity involving a cmsEmployee. When this fragment is woven on two immediately consecutive activities, it results in the situation depicted in Fig. 8 (extract of the Execute Rescue Mission use case). The activities a341 and a354 return the same time. The business process can be refactored by unifying these two activities. A knowledge is added in the system to optimize the orchestrations involving these useless concurrency calls (this pattern was detected three times in the Cccms). Another interesting illustration can be found in the Capture Witness Report use case. This rule has also detected that the Coordinator can inform the system that the crisis is a fake one by analyzing witness answers, or by looking at the video feed, if available. Consequently, the Coordinator ’s approval will be requested twice when a video feed is available. In this case, we consider that the redundancy of the situation is handled by the ui service: it will not broadcast to the coordinator the same question multiple times.
214
S. Mosser, M. Blay-Fornarino, and R. France
Fig. 8. R2 violation: Unanticipated Equivalent Call {a341 , a354 }
Model Incompleteness. By nature fragments defined a partial point of view on existing entities. As a consequence, fragments do not necessarily have to be complete, i.e., they only need to specify the variables and the activities that are relevant within the concern that is modeled. R3 : Always a response. This rule checks whether a path exists between an entry point (message reception or predecessors) and an exit point (response sending, error throwing or successors), under all possible branching conditions or error handling expressed inside the control-flow. An Adore model that satisfies this rule is said to be complete with respect to paths from entry to exit points. At phases P1 and P3 , a fragment or orchestration model addresses specific concerns and thus may not be a complete model; this happens when a path from an entry point to an exit point is not in the scope of the concern addressed by the model. One can reasonably expect though that the result of a composition is a complete model and thus if the result of a composition violates this rule, the violation is classified as an error at phase P4 . Use case #6 (Execute SuperObserver Mission 10 .) provides examples of incomplete models in phase 1. In the main success scenario, step 7 is defined as: “7. System acknowledges the mission creation to SuperObserver.” The following step is defined as: “8. System informs SuperObserver that mission was completed successfully.”. In the base orchestration that realizes this use case, step 8 is done only if the mission creation has been acknowledged, but the textual use case does not define what happens if the mission is not acknowledged. Figure 9a shows a partial view on the orchestration that realizes this main scenario (orchestration cms::handleSupObsMission). Adore detects there is no path from a7 to an exit activity when the guard is evaluated as ¬ack. The extension #7a is defined as a fragment represented in Fig. 9b. When this fragment is woven to handleSupObsMission, it automatically completes the process and makes it valid (as the composition result does not violate R3 ). R4 : No Design Weakness. This rule checks for common design weaknesses, specifically, unused variables, exceptions that are not caught, and call signature 10
The intention of the SuperObserver actor is to observe the situation at the crisis site to be able to order appropriate missions.
Workflow Design Using Fragment Composition
215
(a) execSupObsMissions inconsistent initial orchestration (Extract)
(b) Extension 7a fix the inconsistency (h ≡ a7 ) Fig. 9. Illustrating the Lack Of Response (R3 ) inconsistency
mismatches. These weaknesses are considered as bad-smells. Fixing such weaknesses is not mandatory for the modeler who can decide to ignore the violations. The orchestration that we defined for use case #1 (“Resolve Crisis”) provides examples of design weaknesses. It states that “Resource submits the final mission report to System”. But this report is never used again in the use case. In the same use case, step 1 requests that the Coordinator capture witness report. This step refers to use case #2 (“CaptureWitnessReport”), which can fail when a fake crisis is detected. The weakness is that there is no extension defining how the system should manage witness report when a fake crisis is detected (i.e., this exception is not caught).
216
S. Mosser, M. Blay-Fornarino, and R. France
Weaving NF-fragments adds error throwing activities. But in the requirements document there is no information how to deal with these errors. This rule has identified this set of missing information in the requirements. Pointcut interactions. Other aspect-oriented approaches often use pattern matching mechanisms to identify join points. In our approach the modeler has to denote the join points explicitly or to use logical predicates to identify activities. Adore can explicitly visualize and reason on this information to detect wrong matches and unintentional fragment compositions. At phase P2 , the set of compositions directives is analyzed by the engine. We focus in this section on the fragment weaving directives, denoted as ω(f, a). R5 : No reflexive composition Pointcut matching can lead to try to weave a fragment on itself. We forbid this weaving as it does not make sense in Adore. This situation can be identified using the following predicate: ∀ω(f, a) ∈ Directives , a ∈ Activities(f ) If such a weaving directive is identified, a bad-smell warning is raised, and the directive is retracted from the directives set. This detection was useful when introducing the persistence concern through the logUpdate fragment. We first match all service invocations using a cmsEmployee variable, but such an invocation is defined inside logUpdate itself! R6 : No recursive composition This rule is an extension of the previous one. It identifies circular weaving of fragments, detected as non-convergent critical pairs. We define this rule as the transitive closure of the following predicate: ∀ω(f, a) ∈ Directives , a ∈ Activities(f ), ∃ω(f , a ), a ∈ Activities(f ) We met this difficulty by a bad definition of pointcuts for security and persistence. We just said that all invocations with input a variable of type cmsEmployee must be submitted to access control and be logged. Consequently, password entry should be logged and some log activities require authentication. We modified pointcuts as presented before to handle this issue. Fragments and Pointcuts interactions R7 : No missing weave. When a fragment f is woven on an activity a that is equivalent to another activity a that is not yet woven with f , Adore displays a suggestion that the modeler may have forgotten to weave f on the activity a. As an example, consider use case #1 “Resolve Crisis” 11 . An extension (#5a) defines the process behavior when there is no available external resource. But extension #4a requests an external resource when there is no available internal resource. As a consequence, the error processing mechanism defined in extension #5a must also be triggered when extension #4a is used. 11
The intention of the Coordinator actor is to resolve a car crash crisis by asking employees and external workers to execute appropriate missions.
Workflow Design Using Fragment Composition
217
(a) Extract of handleAMission orchestration (UC #1)
(b) Ext. 4a: unavailableIntResource composition cms::handleAMission { apply unavailableIntResource => a41; // Ext 4a. apply unavailableExtResource => {a51, a5x}; // Ext 5a. } Fig. 10. Illustrating the Forgotten Weave directives (R7 ): a2 ≡ a51
Another illustration can be found in use case #2. We weave fragment unavailableIntResource (Fig. 10a) into the base orchestration handleAMission (Fig. 10b). The Adore platform detects that this fragment inserts an activity (a2 ) which is equivalent to an initial activity (a51 ). As a51 is used as a target for another fragment (unavailableExtResource, Fig. 11a), Adore informs the modeler that she is potentially forgetting a composition directive. In this particular case, we decide to compose the two fragments to deal with the conflicting situation (no available resource at all).
218
S. Mosser, M. Blay-Fornarino, and R. France
(a) UnavailableExtRes fragment
(b) handleAMission orchestration
Fig. 11. Illustrating the Uninitialized variables (R8 ) inconsistency
R8 : No Uninitialized Variable. This rule checks whether a variable is used before being initialized. Ensuring this property before composition is not sufficient to ensure it after composition: Faulty interactions can lead to a composition result that violates this rule. Such a situation is typical when handling error in an orchestration. We define this property using the following predicate: ∀a ∈ A , ∀v ∈ Inputs(a), ∃a ∈ A , v ∈ Outputs(a ) ∧ path(a → a) Following the requirement document, in use case #1, each worker must submit a report to the system. But in extension 5a, which describes how the lack of an external resource is handled, there is no information on how to deal with the missing report. We define the fragment unavailableExtRes (Fig. 11a) to represent the extension #5a. When the algorithm weaves this fragment with the targeted orchestration cms::handleAMission (Fig. 11b), the S activity is unified with a5r . As a consequence (even if an error is thrown by a5X ) the process will try to memorize the expected report (a5r ), but this variable may not be initialized by a5X . In this case, we decided to perform the initialization of the erep variable in the fragment. R9 : No Invocation Cycle This rule checks whether fragments introduce a cycle of invocations. If there is no guarded activities in the execution path, we consider it as an error if not as a bad-smell. Several cycles of invocations were detected in the initial orchestrations and in the orchestration resulting from weaving. This rule has detected an unexpected cycle of invocations in the first version of orchestrations integrating security. We prohibited the user to reconnect when she remains idle a too long time. Modifying the associated pointcut modified the computed set of fragment weaving and consequently eliminated the cycle.
Workflow Design Using Fragment Composition
5
219
Quantitative Analysis
In this section, we highlight the need of separation of concerns when designing a large set of business processes. We collect quantitative data (obtained from Adore) representing the initial system and then make a comparison with data collected after composition (with or without NF-fragments). We use a set of software metrics inspired by state-of-the-art research about business process quality [12]. The analysis we present in this section is based on data that is relevant only in the context of the Aom case study. The raw data for metrics computation are available on the case study web site, and the complete quantitative analysis is publicly available12 . 5.1
Coarse-Grained Structural Complexity: |A |
Definition: Software engineering community usually uses Loc (“lines of code”) to measure corse-grained software size. As the Loc metric is not directly suitable when dealing with business processes we translate this coarse-grained complexity using the activity set cardinality (denoted as |A |). Results: Our results according to this metric for the Cccms case study are depicted in Fig. 12. We represent for each process the associated |A |, and compare three different versions of the Cccms: (i) the initial system (main success scenario), (ii) the business-only system (including the scenarios extensions) and (iii) the final system (including both business extensions and non-functional concerns). The cardinality set average is multiplied by five between the initial system (7.83 activities in average) and the final one (39.25 activities in average).
Fig. 12. Evolution of the |A | indicator 12
http://spreadsheets.google.com/pub?key=tgS6qbzqo5CxTxlcTXbtsPA
220
S. Mosser, M. Blay-Fornarino, and R. France
Analysis: This chart clearly shows that the number of activities involved in the Cccms realization grows really fast. Talking about the evolution cost, up to 10.000 elementary actions13 need to be performed on the initial models to build the final ones. The composition algorithm takes in charge the complexity of building the complete process. In the next section, we focus on this induced complexity by looking at the provenance of entities inside computed processes. 5.2
Entity Provenance
Definition: This section is a corollary of the previous one. Based on the coarsegrained complexity of process, we identify how many activities came from the initial orchestration, the business fragments and finally the non-functional fragments. This indicator allows us to quantitatively qualify which part of the final system was initially defined in the requirements. We normalized these values using the final cardinality (|A |) to obtain an activity provenance percentage. Results: Figure 13 represents these indicators for activities in the context of the Cccms. We can immediatly notice than in average, more than 50% of a final process is defined as non-functional activities. Extrema values are interesting too: the cms::assignIntRes (use case #3) process contains only 8% of initial business activities. On the contrary the cms::execRescMission process (use case #7) is composed of more than 70% of initial activities.These values conform to the requirement documents, as scenario #3 defines only two steps in the main scenario and nine in its extensions. On the contrary, scenario #7 defines seven steps and only three in its extension.
Fig. 13. Activities provenance in the final Cccms
13
e.g., creating a variable or defining a new relation. A complete list of Adore elementary actions is available on the tool website.
Workflow Design Using Fragment Composition
221
Analysis: These indicators enforce the straightforward mapping between textual use cases and designed process. A large process with small extensions will be defined as a large orchestration and few fragments. But it also demonstrates the need of automatic composition, as in some case up to 75% of a process is defined as extensions of a main scenario. 5.3
Cognitive Load: Process Surface and Labyrinthine Complexity
Definition: The cognitive load indicator aims to quantify the intrinsic complexity of a business process. It is defined as an coarse-grained approximation of the Control Flow Complexity indicator [13], based on two simple concepts: the process surface and the labyrinthine complexity. Surface is computed as a product between process width (i.e. number of activities executed in parallel) and process height (i.e. longest path between an entry point and a exit point). The labyrinthine complexity represents the number of different path available in the process. Inspired by [14] who defines cognitive load of programs as a linear function (based on structural complexity), we define the cognitive load of an Adore process as the multiplication of its surface and its labyrinthine complexity, normalized by the number of activities inside the process (|A |). This indicator allows us to apprehend both computational and psychological complexities as defined by Cardoso et al [15]. CognitiveLoad(p) =
Surf ace(p) × Labyrinthine(p) |Ap |
Results: We focus in this part on the business-driven Cccms, i.e. the initial system and its business extensions14 . For each process (excepting the handleAWorker one, as its cognitive load is 247.5), Figure 14 represents the sum of initial process and used fragments cognitive load, and the cognitive load of the final process. For five processes (50%), the final load is clearly higher than the sum of initial process and used fragments loads. For the other processes, the final cognitive load follows the same magnitude than the cumulated one. Analysis: This indicator clearly illustrates the immediate advantage of separation of concerns to tame the complexity of designed artifacts. But it also highlights one of the weakness of the Adore platform (and more generally the Aom approach). Designing small processes (or process without multiples extensions) using the separation of concerns paradigm may introduce an overload in the design process. This overload is not visible in terms of result, but can be summarized in the following sentence: “When should one write several small concerns and then express a composition when he/she can directly express the expected result ?”. Such a typical useless composition is illustrated in use case Execute Rescue Mission (#7), as the main scenario is implicitly designed to handle the sole extension defined on it: a request is sent in the main scenario, and the response to this request is handled inside the extension. 14
We consider than non-functional concerns should not be handled manually in an Aom approach.
222
S. Mosser, M. Blay-Fornarino, and R. France
Fig. 14. Cognitive load indicator (Main Success Scenario + Business Extensions)
6
Implementation and Approach Limitations
In this section, we briefly describe the current implementation of the Adore platform. We also describe some intrinsic limitations of the approach. 6.1
Tool Support
Adore user interface is implemented as an Emacs major mode, as shown in Fig. 15. This mode hides in a user-friendly way the set of shell scripts used to interact with the underlying engine. The concrete Adore engine is implemented as a set of logical predicates, using the Prolog language. Rules described in section 4 are also implemented as Prolog predicates. A dedicated compiler (defined using Antlr15 ) implements an automatic transformation between Adore concrete syntax and the associated Prolog facts used internally by the engine (Fig. 16). As visualizing processes is important in design phase, Adore provides a transformation from its internal facts model to a Graphviz1