An Approach for Generating Class and Sequence Models
Total Page:16
File Type:pdf, Size:1020Kb
Int'l Conf. Software Eng. Research and Practice | SERP'16 | 253 An Approach for Generating Class and Sequence Models Márcio A. Miranda2,3, Marcos G. Ribeiro4, Renan D. Tavares3, Thiago H. B. Dias3, Humberto T. Marques-Neto3, Mark A. J. Song1,3 1Department of Computer Science / Centro Universitário UNA / Belo Horizonte, MG, Brazil 2Department of Computer Science / Federal Institute of Minas Gerais / Ouro Branco, MG, Brazil 3Department of Computer Science / Pontifical Catholic University of Minas Gerais / Belo Horizonte, MG, Brazil 4Department of Computer Engineering / Federal Center of Technological Education of Minas Gerais / Timóteo, MG, Brazil [email protected], [email protected], {rdtavares, thdias}@sga.pucminas.br, {humberto, song}@pucminas.br, [email protected] Abstract— The use of domain-specific languages has been One of the resources that have been generating interest gaining traction in the requirement analysis and discovery are Domain-Specific Languages (DSL). Although limited process due to features such as establishing standardized in scope, they define a communication standard between team communication, allowing the automation of certain engineers and domain specialists. They can also help mini- stages of the process, and bringing productivity gains mize natural language uncertainty and ambiguity. Readabil- without compromising quality. In this paper we proposed ity, understandability and productivity are also fundamental and implemented the Language of Use Cases to SEquence characteristics to justify the use of DSL to describe use cases Diagram (LUCSED), a domain-specific language for the [8], [9], [10]. textual specification of use cases and, through our LUCSED- In this paper we propose and implement an external tool, automatically generate use case, sequence and class DSL called Language of Use Cases to SEquence Diagram diagrams. To assess the viability of our solution, we carried (LUCSED), which defines standards of a language which out several tests aiming to cover a diversity of scenarios allows requirement analysts to specify textual use cases. We found in software development. Our approach can be useful also propose a tool called LUCSEDTool which comprises in requirement analysis and modeling, and seeks to min- automatic generation of use case, class, and sequence di- imize problems present in natural language specifications, agrams from the specification. The tool maps the specifi- such as: uncertainty, ambiguity, complexity and an intense cation following language rules for the Extensible Markup dependence on domain knowledge by specialists. Language Metadata Interchange (XMI) input standard, sup- ported by Unified Modeling Language (UML) modeling Keywords: Automatic Generation, Class Diagram, Domain- software, such as Astah [11] and others. Specific Language, Sequence Diagram, Use Case Specification. The remainder of this article is structured as follows. Section 2 briefly describes some of the relevant related work 1. Introduction developed in the last two decades. Section 3 presents our proposed approach, highlighting the main grammar rules in Currently, there are many different ways to analyze and LUCSED, the sentence patterns supported by the language specify software requirements, such as user stories, mod- and the artifact generation process. We present and discuss els and formal languages. To [1], capturing and mapping our results in Section 4. Finally, we conduct a conclusive requirements is mostly done through textual use case spec- analysis and state our final considerations. ifications, so that even laymen are able to understand them. However, the inherent use of natural language can negatively 2. Related Work affect artifact quality, due to difficulties such as ambiguity, In the beginning of the past decade, [12] proposed a set of redundancy, inconsistency and incompleteness [2], [3]. rules to normalize textual use case specification. Following According to [4], representing requirements in a standard- this standard, analysts can infer which classes, objects, asso- ized way which is easily understood by all participants of a ciations, attributes and operations belong to a use case and project can mitigate the problem, and even bring a certain generate sequence diagrams from this information. However, level of automation to the process [5]. Thus, to reach this this is done manually instead of automatically, since no tool goal, it is necessary to formalize structural and behavioral to test the proposed standard has been implemented, relying aspects of use case specifications [2], [6], [7]. instead on specialist knowledge. ISBN: 1-60132-446-4, CSREA Press © 254 Int'l Conf. Software Eng. Research and Practice | SERP'16 | A few years later, [13] proposed a solution to explore and software engineers are already used to programming the most common problems in use case modeling, showing language formality, and this reduces language learning time inconsistencies between use case models and their textual and optimizes resource reuse [5], [21]. specifications. Later, [14] presented a meta-model to de- scribe textual use cases. It defines a textual representation 3. Proposed Solution of use case behavior, easily understood by readers who do Our proposed DSL (LUCSED) contemplates use case not have full command the subject. To model use cases nar- detailing and along with LUCSEDtool enables the automatic ratives, they developed the Narrative Use Case Description generation of UML diagrams in requirement-oriented soft- Toolkit for Evaluation and Simulation (NaUTiluS) tool. ware processes, following object orientation principles and The work [15] proposed and implemented a tool called the Model-View-Controller (MVC) architectural model. Procasor to automatically generate executable code from use LUCSEDtool is a support tool used to map relevant case specifications. Similarly to our work, they defined a information in use case detailing into an XMI input stan- standard to specify textual use cases in a format recognized dard, recognized by UML modeling software. It is also by their tool, but they did not generate UML models, able to generate artifacts directly in the .astah format, and and LUCSEDTool does not generate executable code. In if users already have Astah installed in their computers, [4], authors present a language for use case specification they can choose to open the diagram in Astah in the based on Xtext and called SilabReq. From use cases, the correct format. LUCSEDtool is available for download at tool generates domain models, a list of system operations, https://github.com/assismiranda/LUCSEDTool. a UML use case model, and state, activity and sequence The conversion of use case specifications into UML diagrams. In the following year, the same author proposed diagrams follows the process shown in Figure 1. The process dividing specifications into different abstraction levels, since consists in mapping textual use cases written in the LUCSED use cases are used by people in different roles with different language into object oriented models, specifically use case, needs during software development, from end users, require- classes and sequence diagrams. Note that a possible sub- ment engineers and business analysts, to project engineers, sequent stage is the automatic generation of model source developers and testers. codes, since most modeling tools are capable of generating In the papers [16], authors proposed and implemented source code from UML models. a tool to automatically generate sequence diagrams from use case specifications written in the English language. The solution uses the natural language parser Stanford Parser [The Stanford Natural Language Processing Group] [17] to identify objects and interactions among them from use case specifications. The parser analyzes sentences and classify words into adjectives, adverbs, articles, pronouns, nouns, verbs, etc. Therefore, the solution ignores situations in se- Fig. 1: LUCSED-to-UML transition quence diagrams such as combined fragments and messages to self, and does not generate other UML models. When designing the DSL, we sought to follow a set of In the following year, the work [18] proposed an approach relevant requirements, to achieve features like simplicity and called aToucan, based on existing solutions, to automatically objectivity, in order to offer a clear and self-explanatory generate UML analysis models comprising class, sequence syntax which would help reduce language learning time. and activity diagrams from a use case model. They also used LUCSED use case detailing was based on the tem- natural language specifications (English) and used Stanford plate proposed by the unified software development process Parser [17] to map specifications. OpenUP (Open Unified Process) [22]. Thus, the specification However, natural language is free, ambiguous and defines is composed by the following attributes: use case name, brief no team communication standard, making automatically description, actors, basic and alternate flows, main scenarios, generating artifacts, and consequentially traceability between pre-conditions, post-conditions, and special requirements specification, model and source code, very difficult. and extension points, as shown in Figure 2. The highlighted Conversely, properly designed domain-specific languages, words are reserved words in the proposed DSL. unlike natural languages, establish a common language to be used by all team members, and their formality standardized The original template was focused on natural languages,