COMDEVALCO Development Tools for Procedural ... - CiteSeerX

3 downloads 168 Views 143KB Size Report
test-driven development methodology, and a Component Definition, ..... [14] Pathfinder project, Pathfinder MDA http://www.pathfindermda.com/index.php.
Int. J. of Computers, Communications & Control, ISSN 1841-9836, E-ISSN 1841-9844 Vol. III (2008), Suppl. issue: Proceedings of ICCCC 2008, pp. 243-247

C OM D E VAL C O Development Tools for Procedural Paradigm István Gergely Czibula, Codru¸t-Lucian Laz˘ar, Ioan Laz˘ar, Simona Motogna, Bazil Pârv Abstract: This paper presents an Agile MDA (Model-Driven Architecture) process, based on test-driven development methodology, and a Component Definition, Validation, and Composition (C OM D E VAL C O) Workbench that allows developers to build, run and test executable models in short, incremental, iterative cycles. The system behavior is modeled with UML Structured Activities, which give a complete and precise description. Testing and debugging techniques implemented comply to OMG Model-level Testing and Debugging Specification and UML Testing Profile. Keywords: Computer-aided software engineering, Object-oriented design methods, Debugging aids, Testing tools.

1

Introduction

MDA framework [8] refers to the specification of software systems in a platform-independent way (PIM Platform-Independent Models) and their transformation into a platform-specific one (PSM - Platform-Specific Models). MDA emphasizes the idea of using models (usually UML diagrams) as primary artifacts throughout the software engineering lifecycle. Because development processes based on MDA are heavy-weight, agile software development methodologies were developed, applying agile principles and defining methods for delivering small slices of working code as soon as possible: models have to be constructed, run, tested and modified in short incremental, iterative cycles. UML 2 is the de-facto standard for modeling software systems, but agile processes tend to minimize the usage of UML models. To be ready for applying agile principles, models must act just like code [4]. A model is executable if it contains a complete and precise behavior description. Because UML does not cover model execution, UML 2 Action Semantics [11] were introduced in order to provide the necessary foundation. But building such an UML-based model is a tedious task or even an impossible one, because of many UML semantic variation points. This paper is part of a series [12, 2, 13] referring to C OM D E VAL C O - a framework for definition, validation, and composition of software components. Its main constituents are: an object-based modeling language, a toolset, and a component repository. Paper describes the model definition and validation tools, included in the C OM D E VAL C O Workbench. The paper is organized as follows: after this introductory section, the second discusses related work and sketches our proposal. Next section describes the C OM D E VAL C O Workbench, mainly its interface related to modeling, debug, and model simulation. Fourth section presents an example application developed using the workbench, while the last one contains some conclusions and outlines the future work.

2 2.1

Agile MDA and executable models Related work

Some independent efforts aiming to develop environments for manipulating executable models are in progress. OMEGA Toolset, Pathfinder, and Kermeta are relevant examples. OMEGA Toolset [7] provides development based on formal techniques for embedded and real-time systems. The development methodology is based on a subset of the UML modeling and specification capabilities, including: class diagrams and state machines, Object Constraint Language (OCL), use case diagrams, and an extension of UML sequence diagrams. PathFinder [14] offers model-based development solutions for systems engineering and software development. It facilitates the construction of PIMs, then their translation to PSMs, i.e. executable systems. Kermeta [5] is a metaprogramming environment based on an object-oriented DSL (Domain Specific Language) optimized for metamodel engineering. Kermeta allows model and meta-model prototyping and simulation. The ideas behind existing proprietary tools are quite similar. The process of creating executable models is as follows: (a) system decomposition into a set of components, (b) component modeling using class diagrams, (c) modeling of class behavior using state machines, and (d) specification of the actions used in state diagrams using a proprietary action language. Copyright © 2006-2008 by CCC Publications - Agora University Ed. House. All rights reserved.

244

István Gergely Czibula, Codru¸t-Lucian Laz˘ar, Ioan Laz˘ar, Simona Motogna, Bazil Pârv

Two categories of action languages were developed so far: [1, 15, 16], resembling the basic concepts of UML 2 Action Semantics, and [6], extending OCL query expressions and adding side-effect capabilities to OCL. Unfortunately, all these languages provide only a concrete syntax and does not provide graphical notations for activity diagrams. Also, the model execution needs an additional step: transforming PIM into a PSM. This way, the time delay between model change and model execution prevents rapid prototyping.

2.2

Our Solution

The proposed solution, C OM D E VAL C O Workbench, helps developer to build, test, and execute models based on UML structured activities. The concrete syntax and graphical notations used for UML structured activities are defined in PAL Action Language [2]. PAL allows both textual and graphical notations, thus simplifying the construction of UML structured activities. Also, the workbench implements testing and debugging techniques which comply to the Model-level Testing and Debugging Specification [10] and the UML Testing Profile [9].

3

C OM D E VAL C O Development Tool

C OM D E VAL C O Workbench is an Eclipse RCP [3] application having three main components: PAL Graphical Editor (builds models using PAL graphical noations), PAL Textual Editor (builds models based on PAL textual notations) and Model Executor (an engine for executing, testing and debugging models). The internal representation of the modeled artifacts uses the proposed object model (Figure 1): the test-cases, operations, statements, pre- and post-conditions are stored as instances of the classes in the model. The resulting object model is updated using both editors (the changes made in one editor being immediately visible in the other) and is executed and tested with the ModelExecutor. The main classes in the diagram are: TestCase (developer-defined test), Operation (model for an operation), Statement and all its subclasses (models for structured programming statements: assignment, if, while, etc.).

Figure 1: PAL Metamodel extract

3.1

C OM D E VALCO Workbench

The model of a software system is contained in a project, shown in ProjectView (Figure 2-(1)). It includes several packages, each containing test cases and operations. The workbench interface offers a Modeling Perspective (Figure 2) and a Debug/Simulation Perspective (Figure 3). Using the Modeling Perspective, the developer models the software system with the PalTextEditor (Figure 2(2)) and/or the PalGraphicalEditor (Figure 2-(3)). This perspective has an OutlineView (Figure 2-(4)), displaying the structure of the operations, and a PropertiesView (Figure 2-(5)), showing the properties of the model elements. A ConsoleView and ErrorLogView (Figure 2-(5)) are also available; these views represent the standard input/output.

C OM D E VAL C O Development Tools for Procedural Paradigm

Figure 2: Modeling Perspective

Figure 3: Debug/Simulation Perspective

245

246

István Gergely Czibula, Codru¸t-Lucian Laz˘ar, Ioan Laz˘ar, Simona Motogna, Bazil Pârv

The Debug/Simulation Perspective allows the developer to execute the model in debug mode. It contains a DebugView (Figure 3-(1)), displaying the invocation chain between operations, up to the breakpoint. Breakpoints are shown in the BreakpointsView (Figure 3-(2)); when a breakpoint is reached, the execution is suspended and the user can resume it or execute the program step-by-step. By clicking on an operation in the DebugView, its state is displayed in the VariablesView (Figure 3-(2)). During the debug process (Figure 3-(3,4)), both editors are available, as well as the ConsoleView and ErrorLogView (Figure 3-(5)) panels.

3.2

PalTextEditor

This editor automatically creates default implementations for attributes and referred but un-implemented operations. Following the test-first design approach, the developer has to create a test case, then to run the test in order be sure that the test fails, and finally to implement and update the code. During design process, the editor reports all not-implemented elements and provides an automatic way to create default implementations for them. Based on the PAL source code, the editor automatically updates the object model and performs the syntactic analysis, providing an immediate feedback for the developer. Syntactic errors are reported and can be analyzed using ErorLogView.

3.3

PalGraphicalEditor

This editor allows the user to create programs or operations described by structured programming statements (compound statement, sequence, decision, loop) by using graphical primitives defined in PAL [2]. Other simple statements like: variable declaration, assignment, procedure call, etc., are also supported. The editor performs automatic layout of graphical objects, so the user is not concerned with their position on the screen, being able to concentrate on the actual modeling tasks. Also, the editor supports breakpoint management and shows feedback during debug sessions.

3.4

Model Executor

C OM D E VAL C O Workbench uses a virtual machine, Model Executor, that executes the object model of the target system, structured as a tree (like an Abstract Syntax Tree). The Model Executor walks through the tree and directly interprets each model element. This direct interpretation offers the opportunity to play with the model (i.e. to change the model and see the results immediately), allowing developers to run and test executable models in short, incremental, iterative cycles. Also, Model Executor offers debugging support for any program or operation, as it was described above.

4

Example

C OM D E VAL C O Workbench is organized in a way that encourages test-driven development. The main steps of using it are described below, using a greatest common divisor (gcd) sample application. First step is to create a new project for the target application. Next steps, detailed below, create tests, operations or programs. Using the Modeling perspective, a new test-case is first added to the project, then constructed and executed in order to assure that the test will fail. The next step is the implementation of the functionality for which the testcase was created. For our example, the test-case invokes an operation named gcd inside the test, with two integer arguments (12, 30) and asserts that the result is 6 (see Figure 3). At this moment, the tool creates a model for this test-case made of a root Testcase element with a CompoundStatement, which, in turn, contains a CallStatement and an AssertStatement. The tool generates a stub gcd operation with the proper list of parameters and a default body; its model is Operation element with two Parameter elements and a body - a CompoundStatament containing a ReturnStatement. The developer models this operation just like the test-case; a possible implementation is shown in Figure 2. When the operation modeling is complete, the test-case is executed again. If the tests fail, the debug mode can be used. Figure 3 shows the execution of the test-case stopped at a breakpoint that was set in the gdc operation. When all tests pass, the workbench allows the restructuring of the written code, both for test-cases and operations, in order to improve the code structure.

C OM D E VAL C O Development Tools for Procedural Paradigm

5

247

Conclusions and Further Work

This paper describes a development tool, C OM D E VAL C O Workbench, allowing developers to construct, run and test executable models in short, incremental, iterative cycles. The use of PAL Language reduces the complexity of building executable models, by simplifying the construction of UML structured activities. Using a virtual machine that executes the model by direct interpretation of the model elements, C OM D E VAL C O Workbench eliminates the time delay between the model change and model execution. In the future, we intend to extend C OM D E VAL C O Workbench in order to include object-oriented and componentbased language constructs, as well as model transformation capabilities.

Acknowledgements This work was supported by the grant ID_546, sponsored by NURC - Romanian National University Research Council (CNCSIS).

References [1] Carter, K., The Action Specification Language Reference Manual, 2002. http://www.kc.com/ [2] Laz˘ar, I., Pârv, B., Motogna, S., Czibula, I.G., Laz˘ar, C.L., An Agile MDA Approach for Executable UML Activities, Studia UBB, Informatica, LII, No. 2, 2007, pp. 101-114. [3] McAffer, J. and Lemieux, J.-M., Eclipse Rich Client Platform: Designing, Coding, and Packaging Java Applications, Addison-Wesley Professional, 2005. [4] Mellor, S.J., Agile MDA, Technical Report, Project Technology, 2005. http://www.omg.org/mda/mda_files/AgileMDA.pdf [5] Muller, P.A. et al, On executable meta-languages applied to model transformations, Model Transformations In Practice Workshop, Montego Bay, Jamaica, 2005. [6] Muller, P.A., Studer, P., Fondement, F., and Bézivin, J. Platform Independent Web Application Modeling and Development with Netsilon, SoSym, 4, No. 4, 2005, pp. 424-442. [7] Omega toolset, http://www-omega.imag.fr/tools.php [8] Object Management Group, MDA Guide Version 1.0.1, 2003. http://www.omg.org/docs/omg/03-06-01.pdf [9] Object Management Group. UML 2.0 Testing Profile Specification, 2005, http://www.omg.org/cgi-bin/apps/doc?formal/0507-07.pdf. [10] Object Management Group, Model-level Testing and Debugging, 2007, http://www.omg.org/cgi-bin/doc?ptc/2007-05-14/ [11] Object Management Group, UML 2.1.1 Superstructure Specification, 2007, http://www.omg.org/cgi-bin/doc?ptc/07-0203/ [12] Pârv, B., Motogna, S., Laz˘ar, I., Czibula, I.G., Laz˘ar, C.L., C OM D E VAL C O - a framework for software component definition, validation, and composition, Studia UBB, Informatica, LII, No. 2, 2007, pp. 59-68. [13] Pârv, B., Laz˘ar, and Motogna, S., C OM D E VAL C O framework - the modeling language for procedural paradigm, IJCCC, 3, No. 2, 2008 (in print). [14] Pathfinder project, Pathfinder MDA http://www.pathfindermda.com/index.php [15] ProjTech AL: Project Technology, Inc, Object Action Language, 2002. [16] Telelogic AB, UML 2.0 Action Semantics and Telelogic TAU/Architect and TAU/Developer Action Language, Version 1.0, 2004.

István Gergely Czibula, Codru¸t-Lucian Laz˘ar, Ioan Laz˘ar, Simona Motogna, Bazil Pârv Babe¸s-Bolyai University Faculty of Mathematics and Computer Science Department of Computer Science 1, M. Kog˘alniceanu, Cluj-Napoca 400084, România E-mail: {istvanc,ilazar,motogna,bparv}@cs.ubbcluj.ro

Suggest Documents