Facilitating Transition from Requirements to Code with the ... - CiteSeerX

2 downloads 12150 Views 2MB Size Report
RSL specifications can be used to generate complete ... guage called MOLA [6]. ... on the type of notion (domain or UI), the method calls refer ... Int. Conf. Automated Soft. Eng., 2010, pp. 255–264. [6] A. Kalnins, J. ... IOS Press, 2011, ch. 3, pp.
Facilitating Transition from Requirements to Code with the ReDSeeDS Tool ´ Michał Smiałek, Tomasz Straszak Warsaw University of Technology, Warsaw, Poland {smialek,straszat}@iem.pw.edu.pl

Abstract—This paper presents a tool suite that automates transition from precise use case and domain models to code. The suite is built around the Requirements Specification Language (RSL) that is based on a precise constrained language grammar. RSL specifications can be used to generate complete MVC/MVP code structure together with method bodies of the Controller layer.

I. I NTRODUCTION The ability to trace from requirements up to code is crucial for effective software evolution. With the advent of model-driven engineering, automated transformation and tracing from model-based requirements became possible. For instance, several approaches to generating analysis models from requirements exist, as reviewed by Yue et. al [1]). This prominently pertains to use case requirements, as discussed by Astudillo et al. [2]. By applying more detail to use case descriptions (scenarios), we can generate quite detailed analysis and design models increasing performance of developers, as studied by Goulao et al. [3]. In this work we use the Requirements Specification Language (RSL) [4] that offers controlled domain-driven language. The language is unique in possessing an extensive meta-model allowing for automated transformations. The presented tool implements RSL and offers an editor (similar and extended in relation to e.g. that of Kamalrudin et al. [5]), with the ability to define significantly more precise requirements representation than typical requirements management tools (Requisite Pro, DOORS, etc.). What is very important, the tool contains an integrated model transformation environment that allows for generating UML models (component, class, interaction) equipped even with dynamic code. This is possible due to the characteristics of RSL that operates at the level of subject-verb-object sentences unambiguously linked with a central domain vocabulary. II. T HE R E DS EE DS T OOL OVERVIEW The presented tool is called ReDSeeDS - Requirements Driven Software Development System. The key drivers in the tool are use cases and their scenarios. This is shown in Figure 1. The use case model is built using a slightly disambiguated (in relation to UML) diagrammatic notation. Each of the use cases is described using precise RSL scenarios (see descriptions below).

Figure 1.

ReDSeeDS tool - overview of the translation process

The tool supports transformations from use case, scenario and domain models, and uses a transformation-specific language called MOLA [6]. This language is graphical and the programs resemble extended activity diagrams (see Fig. 1 centre). It is partially declarative and partially imperative and allows for defining sophisticated model transformation rules. The target language of the transformations is a subset of UML, suitable for architectural and detailed design modeling (see see Fig. 1 - right). The ReDSeeDS tool contains means to transfer and visualise the generated UML models in a UML editor (currently: Enterprise Architect, but the tool API and its modular design allows for integration with other such tools). The target UML editor serves also as a code generator. This way, the UML class models generated by ReDSeeDS can be easily translated into e.g. Java code. The transformation in ReDSeeDS can also generate code for method bodies. The ReDSeeDS tool was implemented using Eclipse (just like the MOLA tool). A glimpse of the tool UI is shown in Figure 2. The tool’s most important elements are the Software case browser, Use case scenario editor and Notion editor. The browser allows to manage “software cases”: coherent sets of requirements, design and code artifacts for specific projects. The requirements part complies with RSL and is equipped with several RSL editors. The UC scenario editor allows for introducing scenarios in controlled language (see Fig. 2 - centre). The scenarios contain mainly subject-verb-object imperative sentences denoting the usersystem interaction sequences. They also contain conditional sentences thus allowing for alternative courses of interaction. All the terms found in the scenarios (domain elements, UI elements) are organised in a central domain specifi-

Figure 2.

ReDSeeDS tool main UI screen with a highlighted scenario Figure 4.

Figure 3.

Transformation of use cases into controller classes

cation. It contains all the notions: nouns (noun phrases) and verbs (verb phrases) coherently referenced from various scenario sentences. This coherence is maintained automatically. Whenever a verb or a noun is used, it is always checked in the domain specification and potentially attached to an existing notion. For new notions, an editor is offered that allows for defining the notion (e.g. its attributes) and associating it with other notions. III. F ROM U SE C ASES TO C ODE Using the ReDSeeDS tool and the MOLA language, several transformations from RSL to UML and code were developed. The examples in Figures 3 and 4 show a small part of the transformation rules for a transformation into the Model-View-Controller/Presenter code structure. One of the rules specifies to transform every use case into a controller class (“C” class) as illustrated in Figure 3. Another set of rules defines ways to translate from subject-verb-object and conditional sentences into sequences of method calls and “if” statements in Java. This is shown in Figure 4. It can be also noted that the centrally defined notions (e.g. “book” of “error message”) play crucial role in keeping the final code coherent. All the calls in code that are generated based on the same notion refer to the same class and associated objects in Java (see e.g. “book” and “mBook”). Depending on the type of notion (domain or UI), the method calls refer to a model layer (“M”) class objects or a view layer (“V”) class objects. The result of the final transformation depends (among other elements) highly on the quality of the source RSL model. It can be noted that writing precise use case scenarios is rewarded with significant part of the target code generated. This includes also the complete view layer with

Transformation of scenarios into dynamic code

form layouts (buttons, text fields, etc.) and event handling (button presses). More information can be found in other work by the authors [7]. It is important to note for conclusion that with the presented tool, use cases and requirements in general, become first-class software development artifacts. They contribute directly to the code generation path, thus the effort put into making them precise pays off directly in reducing implementation effort. ACKNOWLEDGMENT This research has been carried out in the REMICS project and partially funded by the EU (contract number ICT257793 under the 7th Framework Programme), see http: //www.remics.eu/. R EFERENCES [1] T. Yue, L. C. Briand, and Y. Labiche, “A systematic review of transformation approaches between user requirements and analysis models,” Requirements Engineering, vol. 16, no. 2, pp. 75–99, 2011. ´ [2] H. Astudillo, G. Génova, M. Smiałek, J. Llorens Morillo, P. Metz, and R. Prieto-Diáz, “Use cases in model-driven software engineering,” Lecture Notes in Computer Science, vol. 3844, pp. 262–271, 2006. [3] M. Goulao, A. Moreira, J. Araujo, and J. Santos, “Streamlining scenario modeling with model-driven development: A case study,” in Model-Driven Requirements Engineering Workshop (MoDRE’11), 2011, pp. 55–63. ´ [4] H. Kaindl, M. Smiałek, P. Wagner, and et al., “Requirements specification language definition,” ReDSeeDS Project, Project Deliverable D2.4.2, 2009, www.redseeds.eu. [5] M. Kamalrudin, J. Grundy, and J. Hosking, “Tool support for essential use cases to better capture software requirements,” in Proc. Int. Conf. Automated Soft. Eng., 2010, pp. 255–264. [6] A. Kalnins, J. Barzdins, and E. Celms, “Model transformation language MOLA,” Lecture Notes in Computer Science, vol. 3599, pp. 14–28, 2004, mDAFA’04. ´ [7] M. Smiałek, “Requirements-level programming for rapid software evolution,” in Databases and Information Systems VI. IOS Press, 2011, ch. 3, pp. 37–51.

Suggest Documents