Applying Model Driven Architecture Approach to Develop Software Systems Case Study

Size: px
Start display at page:

Download "Applying Model Driven Architecture Approach to Develop Software Systems Case Study"

Transcription

1 The International Arab Conference on Information Technology (ACIT 2013) Applying Model Driven Architecture Approach to Develop Software Systems Case Study Mohammed Abdalla Osman Mukhtar College of Computer Science and Information Technology Alzaeim Alazhari University, Khartoum, Sudan Abstract: Model-Driven Architecture (MDA) has been initiated by Object Management Group (OMG) as a new approach to design and develop a complex system. Some developers argue that this approach is still relatively unripe and still need more supporting tools to become mature enough. In this paper, we try to convince those opponents by applying MDA approach in specific case study to proof that MDA has become most preferable technique to develop or reengineer a wide range of software products. The idea behind MDA is both simple and grand, because it is trying to decouple the definition of application systems functionality from technology platform that run on. The objective from this decoupling is to ensure that the functionality of the system can be preserved even there is changing affect the underlying technology platform. We also highlight the most important steps taken to generate the code from high level and low level system abstraction using formal models, excluding the last step which is delegated to generate the code from the last generated model. Case study provided to support the possibility of developing a complete software system using only OMG asset tools. Experiences learned from this case study can be applied to all similar cases. Keywords: MDA, PIM, PSM, QVT, Mapping Specification, Model Transformation. 1. Introduction Model-Driven Architecture is a major initiative by the OMG, and therefore most of the computing industry, to re-use program code. MDA has been the driving rationale behind a large number of the OMG standards efforts since 2001 [1][2][3]. MDA is trying to support ever-changing business environments by using effective tools to design complex systems, and keeping the software development cost (coding effort, delivering-to-customer, etc.) at an reasonable margin [4]. MDA uses a number of powerful standard tools, like UML [5], MOF [6], OCL [7], XMI [8], BPMN [9] and QVT [10]. Mainly MDA is initiated to shift the focus of software development process from coding to modeling to achieve the great goal, which is separating system functionality from specific implementation platform. Figure 1. System Creation Stages Using MDA Approach Using MDA-based development approach means the developers will use models as the main product of the process of software development, either for software development and maintenance or software requirements documentation. Referring to Figure1, models are used to represent different levels of abstraction to describe system architecture. These levels can be arranged into four major steps: step one is Computational Independent Model (CIM), followed by second step Platform Independent Model (PIM), we can have more than one Platform Specific Model (PSM) due to platform needed to use in this third step, and the last step is Implementation Code Model. According to these stages, there is two kind of system abstraction, first one contains the high level abstraction models (CIM, PIM) which represent the main system characteristics and the system functionality as proposed and expected by system designers. The second kind of system abstraction contains the low level abstraction models (PSM and Implementation Code Model) which construct the implementation details according to specific platform. Mapping specification from High level abstraction models to low level abstraction models is important. There are transformation tools automate this mapping specification by using special transformation techniques [11][12][13][14]. This paper is organized as follows. Section 2 is representing the ultimate goal of MDA as a reliable method to support creation and development of large software systems providing a new methodology where

2 systems can be evolved, and technologies can integrate and synchronize. Section 3 discusses the concept of model transformation because it is representing the main contribution of MDA in software development field. In section 4 there is a credible case study to support what is the scenario when we try to develop a complete software system. In section 5 there is general description for the methodology that can be used to realize the provided case study. Section 6 discusses some results should we execute the provided case study. The last section is the conclusion of our research. 2. The Ultimate Goal of MDA The ultimate goal of MDA is to be able to develop applications in established domains without developing any new program code. MDA approach is introduced as an important and reliable method to support creation and development of large software systems providing a new methodology where systems can be evolved, and technologies can be integrated and synchronized [15]. As we can see in Figure 2, Model driven architecture approach is depending on architecture constructed four meta-layers each of which is an instance of the layer above. This means the objects for example of layer zero (called M0) is an instance specified by model which is in layer one (called M1). On other hand, we can say M1 holds the model of M0 objects. Similarly, M2 is a model describes the instance which is in M1 that often called a metamodel because it is a model of model. In fact, M2 corresponds to UML [16] or any other modeling language can be derived from M3 metamodel. Finally, layer M3 holds a model of the information about M2. M3 is corresponds to Meta Object Facility (MOF). It is a metametamodel language because it represents the conceptual model of the modeling language [17]. Level 2 Level 3 Level 0 Level 1 The UML A particular use of M1 The MOF Meta A UML model M1 Figure 2. 4 Layers architecture of MDA Self-Described The CWM Another use of M1 A UML model M2 The term Platform Independent Model (PIM) is used to identify a model that structurally describes functionality of a system under process without any details about implementation aspect. While Platform Specific Model (PSM) is used to refer to models that have information about implementation details [18]. MDA should be taken as an approach to integrate and harmonize between two different technologies. MDA methodology has been built on specifying the mapping between the items that constructing the source model (PIM) to the corresponding items which are constructing the target model (PSM). The mappings from source model to target model can be complex due to a given item from PIM may be mapped to many items in PSM, for instance a single element in Business Process Modeling Notation (BPMN) as PIM can be mapped to a DDL(SQL), an Entity Java Bean (EJB), and Remote Interface [10]. The main innovation in MDA is to attempt to remove implementation detail altogether from the PIM specification, and to package the PSM code base into coherent subsystems whose constructs are on the same sort of scale as the PIM constructs. This is why the relationship between the PIM and PSM is considered to be a mapping rather than a compilation or interpretation. A secondary but significant innovation is that all the models are MOF model instances, thereby leveraging the large and expanding base of MOF-based toolsets. The collection of MOF-based models, PSM-interfaced code, and toolsets is a significant increase in the scale of capital equipment available to software developers [19]. 3. Model Transformation With the widely used of model transformations there is a rising need for formal methods concentrating on a systematic model transformations development [20]. There are two types of model transformation; Vertical Transformation and Horizontal Transformation. Vertical model transformations are affecting system abstraction level from specification prospective, while the Horizontal transformations do not. Vertical model transformations are used during forward or reverse system engineering to abstract or refine a model. Horizontal model transformations are used to enhance or optimize or reconstruct the internal structure and/or quality of software model [21]. According to figure 2, the vertical transformation can be done from one layer to other direct lower layer (i.e from M3 to M2, or from M2 to M1), while the horizontal transformation can be done within the same modeling layer. Some of MDA critics argue that creating and developing of more than one model (one for PIM and another one for PSM) affects MDA efficiency, and this serious weakness can be considered as a factor to overbalance the good advantages of MDA approach. MDA developers defend this accusation by saying after a PIM has been created, the process of PSM instantiation can completely be done automatically using model transformation process [22]. PIM and PSM models describe one system and these two models have much in common. Therefore, it is significant to propose a transformations definition that simplifies the process of converting a PIM model that used to describe system functionality into one or more PSM model that used to describe the

3 implementation of this functionality for the same system. It is noteworthy that each of these two models can be created using different modeling languages, off course with different set of notions that may built on different platform technologies. model transformation definition is an algorithm which is automated and executed using some formal language [23]. There are many languages to automate and execute this transformation like KerMeta [24], MATA [25], or QVT [26]. A. Model Transformation Scenario To complete the picture about using MDA approach to create software system, we need to know the steps that should be taken. QVT is the main model transformation language, which is used by most of OMG assets and many MOF-based modeling languages. In our case study, QVT should be taken to generate PSM instances that later should be passed to the tool of code generation to generate final code. Figure 3 represents models needed as input to execute the QVT code, QVT code receives three inputs: PIM model, PIM model instance, and PSM model. The output from executing of QVT code according to these three inputs is the model instance of PSM model. Patient wishing to treatment Feel Sick Person in Good Health Figure 4. Simple State Machine to Describe Patient Treatment Steps A. First Step Taking the Medication Reservation Bought Medication Request for Diagnosis Go to the Pharmacy Patient s reservation list Patient Taking Prescription Medication More Examination The first step is to create the metamodel of STM as PIM (Figure 5), to take as first input passed to QVT Engine using XML Metadata Interchange (XMI) file format. XMI is an important tool initiated by OMG to facilitate model interchanging property between different modeling tools [28]. Specified as Source PIM Model Instance Conforming to Activity Diagram (PIM) Execution Specified as Input Input QVT-R Engine Execute QVT-R Code Development Produces Output Specified as Target PSM Model Instance Conforming to Web Prog Lang (PSM) Figure 3. Using QVT Engine to Generate PSM Instances 4. GraphEditor(GE) Software System Case Study We want to build an editor which will allow us to specify State Transition Machines (STM), using the graphical notation of Figure 4 [27]. We know that this case study is a simple one, but it is suitable to cope all what we need to do during the system creation lifecycle using MDA approach, and we believe that most of complex systems structurally similar to this case study. This GE will be able to design an application in which patients buy treatment card once obtaining a location on reservation list. When they are going to the pharmacy, they will buy medication as it has been described in the prescription. Due to more examinations, patients may be rescheduled on reservation waiting list. Figure 5. STM Metamodel (PIM) B. Second Step Now as the second step we need to create the PIM model instance also to pass as second input for the QVT Engine. To do that most of modeling languages like MOF and UML has Instances Model which is used to provide a standard way to talk about instances [19]. Figure 6 represents an example of some instances of instances model for STM case study, while Table 1 contains a complete description to all instances in this case study. :State Name = WishTreate Source Target SampleTrans :Transition :State Name = ReservList TriggeredBy :Event Name = Reservation Figure 6. Some Instances of Instances Model for STM Metamodel (PIM)

4 Table 1. All instances of Instances Model for STM Metamodel (PIM) 1 Obj. State Transition Event A T T R I B U T E S Name C. Third Step 1WishTreate 1WishTreate 1Reservation 2Healthy 2ReservList 2MoreDiagnos 3ReservList 3PreMedic 3ReqDiagnos Source Name 4PreMedic 4PreMedic 4ToPharmacy 5BuyMedic 5BuyMedic 5TakeMedic 6Healthy 6FeelSick 1ReservList 2PreMedic Target 3ReservList 4BuyMedic 5Healthy 6WishTreate 1Reservation 2ReqDiagnos Triggered 3MoreDiagnos By 4ToPharmacy 5TakeMedic 6FeelSick Third step is to develop GE metamodel as PSM (the platform in this case can be any graph editor or other MOF-based modeling language) to use as a third input passing to the QVT Engine through QVT code. As we mentioned earlier the output from QVT Code is the instances of PSM (GE) metamodel. Figure 7 shows the GE metamodel. Figure 7. GE Metamodel (PSM) D. Fourth Step After preparing all input requirements to execute the QVT code, the fourth step is to specify independently the mapping between PIM metamodel and PSM metamodel: Table 2. PIM to PSM Mapping Specifications 1 STM (PIM) State Transition Event GE (PSM) Node ArcEnd, which will been specified by EndNotation 2 attribute. Arc Each combination of attribute value within the same column and the same prefix number constructing one instance (especially for Transition object). That mean we have 5 instances from State object, 6 instances from Transition object, and 6 instances form Event object. 2 Simple if it s source node, or None if it s target. E. Fifth Step The last step in this case study is to write QVT code to generate instances of GE or PSM. Figure 8 contains the QVT-R code to implement and execute the mapping specification of Table. 2. This code used to generate model instance for the PSM of Graph Editor (GE) Software. transformation STMGE(STM:PIM_STM, GE:GE_PSM){ key State {name; key Transition {source, target, triggeredby; key Event {name; key Node {nodetext; key ArcEnd{arc; key Arc {source, target; top relation STMToGraph { n : String; Check only domain STM s :PIM_STM::STM {name = n; Enforce domain GE g :GE_PSM::Graph {name = n; top relation StateToNode{ n, ns : String; check only domain STM s:pim_stm::state{ stm = st : PIM_STM::STM {name = n, name = ns; enforce domain GE nd : GE_PSM::Node{ graph = gr : GE_PSM::Graph {name = n, shape = 'circle', nodetext = ns ; when { STMToGraph (st, gr); top relation TransitionToArc{ ng : String; Check only domain STM s: PIM_STM::Transition { stm = st : PIM_STM::STM {, source = so : PIM_STM::State {, target = ta : PIM_STM::State{ ; enforce domain GE a : GE_PSM::Arc{ graph = gr :GE_PSM::Graph {, line = 'thin', source = sr : GE_PSM::ArcEnd { arrowhead = 'none', node = no : GE_PSM::Node { --arc = a : GE_PSM::Arc {, target = tr : GE_PSM::ArcEnd { arrowhead = 'simple', node = nta : GE_PSM::Node{ arc = a : GE_PSM::Arc { ; when { STMToGraph (st, gr); StateToNode(so, no); StateToNode(ta, nta); top relation EventToArc{ n : String; checkonly domain STM tr : PIM_STM::Transition{ triggeredby = e:pim_stm::event{name=n enforce domain GE a: GE_PSM::Arc{arcText=n; when { TransitionToArc(tr, a); Figure 8. QVT-R Code [29]

5 5. General Methodology We take metamodels for PIM (source model) and PSM (target model) prepared with a CASE tool of UML such as MagicDraw[30]. Using the previous tool, we export each metamodel to EMF [31] XMI [32] format, which is used later to create the model instance for the PIM. Then we need to pass these three inputs (PIM XMI file, PSM XMI file and PIM model instance) to the QVT-R code to generate the PSM model instance in XMI format. Later we will process the generated PSM XMI file with an XSLT [33] processor to generate the appropriate code. 6. Result and Discussion The result from the code above will be a number of GE instances and many features that have been applied to generate these instances. The bottom part of Figure 9 shows the report after executing an example of QVT code (there are 23 generated instances and 63 features applied). Figure 9. An example of QVT code and its output using MediniQVT [34] The output after executing the QVT code should be in an XMI file format. We can use any tool (like MagicDraw) to graphically display this kind of file format. We can t say that our code is the perfect, but any code may be error prone, or contain logical error that will not affect the execution, while it is definitely affecting the output. Later we should pass this output file to generate the final code. As the final product, generated code may need minor manual modification also. 7. Conclusion In this paper we provided a complete case study to highlight the important steps required if we try to create a system using MDA approach. We can conclude that the idea behind MDA is both simple and grand [10], because it is trying to decouple the definition of application systems functionality (in PIM) from technology platform that run on (in PSM). The objective from this decoupling is to ensure that the functionality of the system can be preserved even there is changing affect the underlying technology platform. References [1] Object Management Group, MDA Guide Version 1.0.1, OMG document omg/ , no. June, [2] J. M. Favre, Towards a Basic Theory to Model Model Driven Engineering, in 3rd Workshop in Software Model Engineering, WiSME, [3] D. S. Frankel, G. Booch, J. Rumbaugh, and B. Selic, An MDA Manifesto, MDA Journal, vol. 2004, no. April, pp. 1 9, [4] M. F. Gholami and R. Ramsin, Strategies for Improving MDA-Based Development Processes, 2010 International Conference on Intelligent Systems, Modelling and Simulation, pp , Jan [5] Object Management Group (OMG), OMG Unified Modeling Language ( OMG UML ), Superstructure V2.4.1, no. August, [6] Object Management Group (OMG), OMG Meta Object Facility ( MOF ) Core Specification, [7] Object Management Group (OMG), OMG Object Constraint Language ( OCL ), vol. 03, no. January [8] Object Management Group (OMG), OMG MOF 2 XMI Mapping Specification, [9] Object Management Group (OMG), Business Process Model and Notation ( BPMN ), v2.0, [10] A. Mcneile, MDA: The Vision With The Hole? metamaxim.com, [11] K. Czarnecki and S. Helsen, Classification of Model Transformation Approaches, in OOPSLA 03 Workshop on Generative Techniques in the Context of Model-Driven Architecture, 2003, pp [12] Object Management Group (OMG), Meta Object Facility ( MOF ) 2. 0 Query / View / Transformation Specification, no. January, [13] T. Mens, K. Czarnecki, P. Van Gorp, and A. Cherchago, A Taxonomy of Model Transformations, in Dagstuhl Seminar Proceedings 04101, 2005, pp [14] S. R. Judson, Pattern-based model transformation, in Companion of the 18th annual ACM SIGPLAN conference on Object-

6 oriented programming, systems, languages, and applications - OOPSLA 03, 2003, p [15] F. Bezivin, Jean; Slimane, Hammoudi ; Lopes, Denivaldo; Jouault, Applying MDA Approach to B2B Applications : A Road Map, Design, no. 1, pp. 1 6, [16] Object Management Group (OMG), UML 2.0 Infrastructure Specification, [17] M. A. O. Mukhtar, A. Azween, and A. G. Downe, A Proposed Compiler to Integrate Model Driven Architecture with Web Services Road Map, International Journal of Computer Applications, vol. 15, no. 7, pp. 1 7, [18] Object Management Group, MDA - Executive Overview, [Online]. Available: [19] R. M. Colomb, Metamodelling and Model-Driven Architecture. Unpublished, [20] J. M. Küster, Definition and validation of model transformations, Software & Systems Modeling, vol. 5, no. 3, pp , Aug [21] A. Christoph, Describing Horizontal Model Transformations with Graph Rewriting Rules, Springer-Verlag Berlin Heidelberg LNCS, vol. 3599, pp , [22] M. B. Kuznetsov, UML model transformation and its application to MDA technology, Programming and Computer Software, vol. 33, no. 1, pp , Feb [23] X. Qafmolla, Automation of Web Services Development Using Model Driven Techniques, Architecture, vol. 3, pp , [24] N. Moha, S. Sen, C. Faucher, O. Barais, and J.-M. Jézéquel, Evaluation of Kermeta for solving graph-based problems, International Journal on Software Tools for Technology Transfer, vol. 12, no. 3 4, pp , Apr [25] J. Whittle, P. Jayaraman, A. Elkhodary, and A. Moreira, MATA : A Unified Approach for Composing UML Aspect Models Based on Graph Transformation, pp , [26] A. Mukhtar, Mohammed Abdalla Osman; Azween, Mapping of Behavior Model using Model-Driven Architecture, International Journal of Computer Applications, vol. 13, no. 8, pp , [27] R. M. Colomb, Developing Methods for Using Model-Driven Architecture to Develop Quality Software Products at Low Cost Entirely by Re- Use of Existing Components, vol. Funded Pro. p. 15, [28] Y. Xiao-mei, Mapping Approach for Model Transformation of MDA based on XMI / XML Platform, in First International Workshop on Education Technology and Computer Science, [29] M. A. O. Mukhtar, M. F. B. Hassan, and J. Bin Jaafar, Optimizing Method to Provide Model Transformation of Model-Driven Architecture as Web-Based Services, in 2012 International Conference on Computer & Information Science (ICCIS), 2012, pp [30] MagicDraw User Manual, No Magic, Inc, [31] E. Documentation, eclipse - The Eclipse Modeling Framework (EMF) Overview, [Online]. Available: [32] Object Management Group (OMG), OMG MOF 2 XMI Mapping Specification, [33] D. Li, X. Li, and V. Stolz, QVT-based model transformation using XSLT, ACM SIGSOFT Software Engineering Notes, vol. 36, no. 1, pp. 1 8, Jan [34] Object Management Group (OMG), medini QVT, ikv++ Technologies ag, [Online]. Available: Mohammed Abdalla Osman Mukhtar was born in Khartoum Sudan 1975; he graduated from Sudan University of Science & Technology in Sudan, Faculty of Computer Sciences & Information Technology in He got his Master degree in Computer Sciences from University of Khartoum in Sudan He is Currently Ph.D. student in Universiti Teknologi PETRONAS (UTP), Computer & Information Sciences Department. His domain of work is: Development of Web Applications Using Model Driven Architecture Approach.